From 6dac44d67ff4c362c55ca322c273eb56bc0f9bc7 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 20 Dec 2022 21:08:51 +0100 Subject: [PATCH] Rename class props to match ctor param --- src/Controllers/Admin/FaqController.php | 5 +---- src/Controllers/Admin/NewsController.php | 5 +---- src/Controllers/Admin/QuestionsController.php | 5 +---- src/Controllers/Admin/UserShirtController.php | 5 +---- src/Controllers/Admin/UserWorkLogController.php | 5 +---- src/Controllers/NewsController.php | 8 ++++---- src/Controllers/OAuthController.php | 8 ++++---- src/Controllers/SettingsController.php | 5 +---- src/Database/Migration/Migration.php | 5 +---- 9 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/Controllers/Admin/FaqController.php b/src/Controllers/Admin/FaqController.php index a148b478..d73ef381 100644 --- a/src/Controllers/Admin/FaqController.php +++ b/src/Controllers/Admin/FaqController.php @@ -14,8 +14,6 @@ class FaqController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'faq.view', @@ -25,10 +23,9 @@ class FaqController extends BaseController public function __construct( protected LoggerInterface $log, protected Faq $faq, - Redirector $redirector, + protected Redirector $redirect, protected Response $response ) { - $this->redirect = $redirector; } public function edit(Request $request): Response diff --git a/src/Controllers/Admin/NewsController.php b/src/Controllers/Admin/NewsController.php index 5bc83cc6..c68cae32 100644 --- a/src/Controllers/Admin/NewsController.php +++ b/src/Controllers/Admin/NewsController.php @@ -15,8 +15,6 @@ class NewsController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'admin_news', @@ -26,10 +24,9 @@ class NewsController extends BaseController protected Authenticator $auth, protected LoggerInterface $log, protected News $news, - Redirector $redirector, + protected Redirector $redirect, protected Response $response ) { - $this->redirect = $redirector; } public function edit(Request $request): Response diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php index 87d4652c..59164bbd 100644 --- a/src/Controllers/Admin/QuestionsController.php +++ b/src/Controllers/Admin/QuestionsController.php @@ -16,8 +16,6 @@ class QuestionsController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'question.add', @@ -28,10 +26,9 @@ class QuestionsController extends BaseController protected Authenticator $auth, protected LoggerInterface $log, protected Question $question, - Redirector $redirector, + protected Redirector $redirect, protected Response $response ) { - $this->redirect = $redirector; } public function index(): Response diff --git a/src/Controllers/Admin/UserShirtController.php b/src/Controllers/Admin/UserShirtController.php index b4498039..78c84b12 100644 --- a/src/Controllers/Admin/UserShirtController.php +++ b/src/Controllers/Admin/UserShirtController.php @@ -16,8 +16,6 @@ class UserShirtController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'editShirt' => 'user.edit.shirt', @@ -28,11 +26,10 @@ class UserShirtController extends BaseController protected Authenticator $auth, protected Config $config, protected LoggerInterface $log, - Redirector $redirector, + protected Redirector $redirect, protected Response $response, protected User $user ) { - $this->redirect = $redirector; } public function editShirt(Request $request): Response diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php index 19f90a8c..fd76122c 100644 --- a/src/Controllers/Admin/UserWorkLogController.php +++ b/src/Controllers/Admin/UserWorkLogController.php @@ -19,8 +19,6 @@ class UserWorkLogController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'admin_user_worklog', @@ -31,11 +29,10 @@ class UserWorkLogController extends BaseController protected Config $config, protected LoggerInterface $log, protected Worklog $worklog, - Redirector $redirector, + protected Redirector $redirect, protected Response $response, protected User $user ) { - $this->redirect = $redirector; } public function editWorklog(Request $request): Response diff --git a/src/Controllers/NewsController.php b/src/Controllers/NewsController.php index ddd0db98..39cbd88a 100644 --- a/src/Controllers/NewsController.php +++ b/src/Controllers/NewsController.php @@ -16,8 +16,6 @@ class NewsController extends BaseController { use HasUserNotifications; - protected Redirector $redirect; - /** @var array */ protected array $permissions = [ 'news', @@ -32,11 +30,10 @@ class NewsController extends BaseController protected Config $config, protected LoggerInterface $log, protected News $news, - Redirector $redirector, + protected Redirector $redirect, protected Response $response, protected Request $request ) { - $this->redirect = $redirector; } public function index(): Response @@ -153,6 +150,9 @@ class NewsController extends BaseController ); } + /** + * @param array $data + */ protected function renderView(string $page, array $data): Response { $data += $this->getNotifications(); diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index 6972767d..8c7c5150 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -31,7 +31,7 @@ class OAuthController extends BaseController protected Config $config, protected LoggerInterface $log, protected OAuth $oauth, - protected Redirector $redirector, + protected Redirector $redirect, protected Session $session, protected UrlGenerator $url ) { @@ -59,7 +59,7 @@ class OAuthController extends BaseController ); $this->session->set('oauth2_state', $provider->getState()); - return $this->redirector->to($authorizationUrl); + return $this->redirect->to($authorizationUrl); } if ( @@ -188,7 +188,7 @@ class OAuthController extends BaseController $this->log->info('Disconnected OAuth from {provider}', ['provider' => $providerName]); $this->addNotification('oauth.disconnected'); - return $this->redirector->back(); + return $this->redirect->back(); } 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_allow_registration', $config['allow_registration']); - return $this->redirector->to('/register'); + return $this->redirect->to('/register'); } } diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index 073b71a9..54f3e9a0 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -15,8 +15,6 @@ class SettingsController extends BaseController use HasUserNotifications; use ChecksArrivalsAndDepartures; - protected Redirector $redirect; - /** @var string[] */ protected array $permissions = [ 'user_settings', @@ -26,10 +24,9 @@ class SettingsController extends BaseController protected Authenticator $auth, protected Config $config, protected LoggerInterface $log, - Redirector $redirector, + protected Redirector $redirect, protected Response $response ) { - $this->redirect = $redirector; } public function profile(): Response diff --git a/src/Database/Migration/Migration.php b/src/Database/Migration/Migration.php index 08580cc2..51628a9a 100644 --- a/src/Database/Migration/Migration.php +++ b/src/Database/Migration/Migration.php @@ -6,13 +6,10 @@ use Illuminate\Database\Schema\Builder as SchemaBuilder; abstract class Migration { - protected SchemaBuilder $schema; - /** * Migration constructor. */ - public function __construct(SchemaBuilder $schemaBuilder) + public function __construct(protected SchemaBuilder $schema) { - $this->schema = $schemaBuilder; } }