Rename class props to match ctor param

This commit is contained in:
Michael Weimann 2022-12-20 21:08:51 +01:00
parent 202eae5136
commit 6dac44d67f
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
9 changed files with 15 additions and 36 deletions

View File

@ -14,8 +14,6 @@ class FaqController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string> */ /** @var array<string> */
protected array $permissions = [ protected array $permissions = [
'faq.view', 'faq.view',
@ -25,10 +23,9 @@ class FaqController extends BaseController
public function __construct( public function __construct(
protected LoggerInterface $log, protected LoggerInterface $log,
protected Faq $faq, protected Faq $faq,
Redirector $redirector, protected Redirector $redirect,
protected Response $response protected Response $response
) { ) {
$this->redirect = $redirector;
} }
public function edit(Request $request): Response public function edit(Request $request): Response

View File

@ -15,8 +15,6 @@ class NewsController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string> */ /** @var array<string> */
protected array $permissions = [ protected array $permissions = [
'admin_news', 'admin_news',
@ -26,10 +24,9 @@ class NewsController extends BaseController
protected Authenticator $auth, protected Authenticator $auth,
protected LoggerInterface $log, protected LoggerInterface $log,
protected News $news, protected News $news,
Redirector $redirector, protected Redirector $redirect,
protected Response $response protected Response $response
) { ) {
$this->redirect = $redirector;
} }
public function edit(Request $request): Response public function edit(Request $request): Response

View File

@ -16,8 +16,6 @@ class QuestionsController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string> */ /** @var array<string> */
protected array $permissions = [ protected array $permissions = [
'question.add', 'question.add',
@ -28,10 +26,9 @@ class QuestionsController extends BaseController
protected Authenticator $auth, protected Authenticator $auth,
protected LoggerInterface $log, protected LoggerInterface $log,
protected Question $question, protected Question $question,
Redirector $redirector, protected Redirector $redirect,
protected Response $response protected Response $response
) { ) {
$this->redirect = $redirector;
} }
public function index(): Response public function index(): Response

View File

@ -16,8 +16,6 @@ class UserShirtController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string, string> */ /** @var array<string, string> */
protected array $permissions = [ protected array $permissions = [
'editShirt' => 'user.edit.shirt', 'editShirt' => 'user.edit.shirt',
@ -28,11 +26,10 @@ class UserShirtController extends BaseController
protected Authenticator $auth, protected Authenticator $auth,
protected Config $config, protected Config $config,
protected LoggerInterface $log, protected LoggerInterface $log,
Redirector $redirector, protected Redirector $redirect,
protected Response $response, protected Response $response,
protected User $user protected User $user
) { ) {
$this->redirect = $redirector;
} }
public function editShirt(Request $request): Response public function editShirt(Request $request): Response

View File

@ -19,8 +19,6 @@ class UserWorkLogController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string> */ /** @var array<string> */
protected array $permissions = [ protected array $permissions = [
'admin_user_worklog', 'admin_user_worklog',
@ -31,11 +29,10 @@ class UserWorkLogController extends BaseController
protected Config $config, protected Config $config,
protected LoggerInterface $log, protected LoggerInterface $log,
protected Worklog $worklog, protected Worklog $worklog,
Redirector $redirector, protected Redirector $redirect,
protected Response $response, protected Response $response,
protected User $user protected User $user
) { ) {
$this->redirect = $redirector;
} }
public function editWorklog(Request $request): Response public function editWorklog(Request $request): Response

View File

@ -16,8 +16,6 @@ class NewsController extends BaseController
{ {
use HasUserNotifications; use HasUserNotifications;
protected Redirector $redirect;
/** @var array<string, string> */ /** @var array<string, string> */
protected array $permissions = [ protected array $permissions = [
'news', 'news',
@ -32,11 +30,10 @@ class NewsController extends BaseController
protected Config $config, protected Config $config,
protected LoggerInterface $log, protected LoggerInterface $log,
protected News $news, protected News $news,
Redirector $redirector, protected Redirector $redirect,
protected Response $response, protected Response $response,
protected Request $request protected Request $request
) { ) {
$this->redirect = $redirector;
} }
public function index(): Response public function index(): Response
@ -153,6 +150,9 @@ class NewsController extends BaseController
); );
} }
/**
* @param array $data
*/
protected function renderView(string $page, array $data): Response protected function renderView(string $page, array $data): Response
{ {
$data += $this->getNotifications(); $data += $this->getNotifications();

View File

@ -31,7 +31,7 @@ class OAuthController extends BaseController
protected Config $config, protected Config $config,
protected LoggerInterface $log, protected LoggerInterface $log,
protected OAuth $oauth, protected OAuth $oauth,
protected Redirector $redirector, protected Redirector $redirect,
protected Session $session, protected Session $session,
protected UrlGenerator $url protected UrlGenerator $url
) { ) {
@ -59,7 +59,7 @@ class OAuthController extends BaseController
); );
$this->session->set('oauth2_state', $provider->getState()); $this->session->set('oauth2_state', $provider->getState());
return $this->redirector->to($authorizationUrl); return $this->redirect->to($authorizationUrl);
} }
if ( if (
@ -188,7 +188,7 @@ class OAuthController extends BaseController
$this->log->info('Disconnected OAuth from {provider}', ['provider' => $providerName]); $this->log->info('Disconnected OAuth from {provider}', ['provider' => $providerName]);
$this->addNotification('oauth.disconnected'); $this->addNotification('oauth.disconnected');
return $this->redirector->back(); return $this->redirect->back();
} }
protected function getProvider(string $name): AbstractProvider protected function getProvider(string $name): AbstractProvider
@ -326,6 +326,6 @@ class OAuthController extends BaseController
$this->session->set('oauth2_enable_password', $config['enable_password']); $this->session->set('oauth2_enable_password', $config['enable_password']);
$this->session->set('oauth2_allow_registration', $config['allow_registration']); $this->session->set('oauth2_allow_registration', $config['allow_registration']);
return $this->redirector->to('/register'); return $this->redirect->to('/register');
} }
} }

View File

@ -15,8 +15,6 @@ class SettingsController extends BaseController
use HasUserNotifications; use HasUserNotifications;
use ChecksArrivalsAndDepartures; use ChecksArrivalsAndDepartures;
protected Redirector $redirect;
/** @var string[] */ /** @var string[] */
protected array $permissions = [ protected array $permissions = [
'user_settings', 'user_settings',
@ -26,10 +24,9 @@ class SettingsController extends BaseController
protected Authenticator $auth, protected Authenticator $auth,
protected Config $config, protected Config $config,
protected LoggerInterface $log, protected LoggerInterface $log,
Redirector $redirector, protected Redirector $redirect,
protected Response $response protected Response $response
) { ) {
$this->redirect = $redirector;
} }
public function profile(): Response public function profile(): Response

View File

@ -6,13 +6,10 @@ use Illuminate\Database\Schema\Builder as SchemaBuilder;
abstract class Migration abstract class Migration
{ {
protected SchemaBuilder $schema;
/** /**
* Migration constructor. * Migration constructor.
*/ */
public function __construct(SchemaBuilder $schemaBuilder) public function __construct(protected SchemaBuilder $schema)
{ {
$this->schema = $schemaBuilder;
} }
} }