diff --git a/.phpcs.xml b/.phpcs.xml index 8484fa65..20840a0e 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -8,6 +8,7 @@ public/index.php src tests + /config/config.php @@ -31,5 +32,9 @@ /includes + + /includes + + diff --git a/db/factories/AngelTypeFactory.php b/db/factories/AngelTypeFactory.php index a9f6d822..65804d0a 100644 --- a/db/factories/AngelTypeFactory.php +++ b/db/factories/AngelTypeFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class AngelTypeFactory extends Factory { /** @var string */ - protected $model = AngelType::class; + protected $model = AngelType::class; // phpcs:ignore /** * @return array diff --git a/db/factories/FaqFactory.php b/db/factories/FaqFactory.php index 06fef751..f5c26f4a 100644 --- a/db/factories/FaqFactory.php +++ b/db/factories/FaqFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class FaqFactory extends Factory { /** @var string */ - protected $model = Faq::class; + protected $model = Faq::class; // phpcs:ignore /** * @return array diff --git a/db/factories/GroupFactory.php b/db/factories/GroupFactory.php index 186581d6..afdc3fbc 100644 --- a/db/factories/GroupFactory.php +++ b/db/factories/GroupFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class GroupFactory extends Factory { /** @var string */ - protected $model = Group::class; + protected $model = Group::class; // phpcs:ignore /** * @return array diff --git a/db/factories/MessageFactory.php b/db/factories/MessageFactory.php index 5cfab4ca..8bc1015a 100644 --- a/db/factories/MessageFactory.php +++ b/db/factories/MessageFactory.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class MessageFactory extends Factory { /** @var string */ - protected $model = Message::class; + protected $model = Message::class; // phpcs:ignore /** * @return array diff --git a/db/factories/NewsCommentFactory.php b/db/factories/NewsCommentFactory.php index bf78570f..7ddf40a5 100644 --- a/db/factories/NewsCommentFactory.php +++ b/db/factories/NewsCommentFactory.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class NewsCommentFactory extends Factory { /** @var string */ - protected $model = NewsComment::class; + protected $model = NewsComment::class; // phpcs:ignore /** * @return array diff --git a/db/factories/NewsFactory.php b/db/factories/NewsFactory.php index 0ab12ab5..20bf4af3 100644 --- a/db/factories/NewsFactory.php +++ b/db/factories/NewsFactory.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class NewsFactory extends Factory { /** @var string */ - protected $model = News::class; + protected $model = News::class; // phpcs:ignore /** * @return array diff --git a/db/factories/PrivilegeFactory.php b/db/factories/PrivilegeFactory.php index 5516b6b4..907cac0c 100644 --- a/db/factories/PrivilegeFactory.php +++ b/db/factories/PrivilegeFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class PrivilegeFactory extends Factory { /** @var string */ - protected $model = Privilege::class; + protected $model = Privilege::class; // phpcs:ignore /** * @return array diff --git a/db/factories/QuestionFactory.php b/db/factories/QuestionFactory.php index 406f28e6..47fb70a2 100644 --- a/db/factories/QuestionFactory.php +++ b/db/factories/QuestionFactory.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class QuestionFactory extends Factory { /** @var string */ - protected $model = Question::class; + protected $model = Question::class; // phpcs:ignore /** * @return array diff --git a/db/factories/RoomFactory.php b/db/factories/RoomFactory.php index 352b4489..40e67284 100644 --- a/db/factories/RoomFactory.php +++ b/db/factories/RoomFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class RoomFactory extends Factory { /** @var string */ - protected $model = Room::class; + protected $model = Room::class; // phpcs:ignore /** * @return array diff --git a/db/factories/Shifts/ScheduleFactory.php b/db/factories/Shifts/ScheduleFactory.php index d9edbec5..14aa6653 100644 --- a/db/factories/Shifts/ScheduleFactory.php +++ b/db/factories/Shifts/ScheduleFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class ScheduleFactory extends Factory { /** @var string */ - protected $model = Schedule::class; + protected $model = Schedule::class; // phpcs:ignore /** * @return array diff --git a/db/factories/Shifts/ShiftTypeFactory.php b/db/factories/Shifts/ShiftTypeFactory.php index 283bf4e7..83bf27a9 100644 --- a/db/factories/Shifts/ShiftTypeFactory.php +++ b/db/factories/Shifts/ShiftTypeFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class ShiftTypeFactory extends Factory { /** @var string */ - protected $model = ShiftType::class; + protected $model = ShiftType::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/ContactFactory.php b/db/factories/User/ContactFactory.php index 5772a22d..bcbe1870 100644 --- a/db/factories/User/ContactFactory.php +++ b/db/factories/User/ContactFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class ContactFactory extends Factory { /** @var string */ - protected $model = Contact::class; + protected $model = Contact::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/LicenseFactory.php b/db/factories/User/LicenseFactory.php index 34627609..a37fd9d3 100644 --- a/db/factories/User/LicenseFactory.php +++ b/db/factories/User/LicenseFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class LicenseFactory extends Factory { /** @var string */ - protected $model = License::class; + protected $model = License::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/PasswordResetFactory.php b/db/factories/User/PasswordResetFactory.php index f1fbc212..21a947cc 100644 --- a/db/factories/User/PasswordResetFactory.php +++ b/db/factories/User/PasswordResetFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class PasswordResetFactory extends Factory { /** @var string */ - protected $model = PasswordReset::class; + protected $model = PasswordReset::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/PersonalDataFactory.php b/db/factories/User/PersonalDataFactory.php index 447a135e..9bf1860d 100644 --- a/db/factories/User/PersonalDataFactory.php +++ b/db/factories/User/PersonalDataFactory.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class PersonalDataFactory extends Factory { /** @var string */ - protected $model = PersonalData::class; + protected $model = PersonalData::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/SettingsFactory.php b/db/factories/User/SettingsFactory.php index aefd3187..b9deb8cc 100644 --- a/db/factories/User/SettingsFactory.php +++ b/db/factories/User/SettingsFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class SettingsFactory extends Factory { /** @var string */ - protected $model = Settings::class; + protected $model = Settings::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/StateFactory.php b/db/factories/User/StateFactory.php index d84c184c..9e003d00 100644 --- a/db/factories/User/StateFactory.php +++ b/db/factories/User/StateFactory.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class StateFactory extends Factory { /** @var string */ - protected $model = State::class; + protected $model = State::class; // phpcs:ignore /** * @return array diff --git a/db/factories/User/UserFactory.php b/db/factories/User/UserFactory.php index 3db6801e..2f758660 100644 --- a/db/factories/User/UserFactory.php +++ b/db/factories/User/UserFactory.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class UserFactory extends Factory { /** @var string */ - protected $model = User::class; + protected $model = User::class; // phpcs:ignore /** * @return array diff --git a/db/factories/UserAngelTypeFactory.php b/db/factories/UserAngelTypeFactory.php index d457a21c..5b2205ab 100644 --- a/db/factories/UserAngelTypeFactory.php +++ b/db/factories/UserAngelTypeFactory.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class UserAngelTypeFactory extends Factory { /** @var string */ - protected $model = UserAngelType::class; + protected $model = UserAngelType::class; // phpcs:ignore /** * @return array diff --git a/db/factories/WorklogFactory.php b/db/factories/WorklogFactory.php index 3d073b03..8a56fbae 100644 --- a/db/factories/WorklogFactory.php +++ b/db/factories/WorklogFactory.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\Factory; class WorklogFactory extends Factory { /** @var string */ - protected $model = Worklog::class; + protected $model = Worklog::class; // phpcs:ignore /** * @return array diff --git a/db/migrations/2018_01_01_000001_import_install_sql.php b/db/migrations/2018_01_01_000001_import_install_sql.php index 21c617f7..88ace70d 100644 --- a/db/migrations/2018_01_01_000001_import_install_sql.php +++ b/db/migrations/2018_01_01_000001_import_install_sql.php @@ -6,7 +6,8 @@ use Engelsystem\Database\Migration\Migration; class ImportInstallSql extends Migration { - protected $oldTables = [ + /** @var array */ + protected array $oldTables = [ 'AngelTypes', 'EventConfig', 'GroupPrivileges', diff --git a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php index ceb9f474..dfe3b53e 100644 --- a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php +++ b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php @@ -7,7 +7,7 @@ use Engelsystem\Database\Migration\Migration; class AddAngelSupporterPermissions extends Migration { /** @var string[] */ - protected $data = [ + protected array $data = [ '2-Engel', 'shiftentry_edit_angeltype_supporter', ]; diff --git a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php index aba6afec..c74d60e1 100644 --- a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php +++ b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php @@ -8,7 +8,7 @@ use Illuminate\Database\Schema\Blueprint; class ChangeUsersContactDectFieldSize extends Migration { /** @var array */ - protected $tables = [ + protected array $tables = [ 'AngelTypes' => 'contact_dect', 'users_contact' => 'dect', ]; diff --git a/db/migrations/2021_05_23_000000_set_admin_password.php b/db/migrations/2021_05_23_000000_set_admin_password.php index 3c759161..2a61e3db 100644 --- a/db/migrations/2021_05_23_000000_set_admin_password.php +++ b/db/migrations/2021_05_23_000000_set_admin_password.php @@ -11,10 +11,8 @@ class SetAdminPassword extends Migration { use Reference; - /** @var Authenticator */ protected Authenticator $auth; - /** @var Config */ protected Config $config; public function __construct(SchemaBuilder $schemaBuilder, Authenticator $auth, Config $config) diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index 44feac37..73fd3e99 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -39,8 +39,7 @@ class ImportSchedule extends BaseController /** @var LoggerInterface */ protected $log; - /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'schedule.import', ]; diff --git a/src/Application.php b/src/Application.php index 8885047d..a4bab7e9 100644 --- a/src/Application.php +++ b/src/Application.php @@ -12,21 +12,19 @@ use Psr\Http\Server\MiddlewareInterface; class Application extends Container { - /** @var string|null */ - protected $appPath = null; + protected ?string $appPath = null; - /** @var bool */ - protected $isBootstrapped = false; + protected bool $isBootstrapped = false; /** @var MiddlewareInterface[]|string[] */ - protected $middleware; + protected array $middleware; /** * Registered service providers * * @var array */ - protected $serviceProviders = []; + protected array $serviceProviders = []; /** * Application constructor. diff --git a/src/Config/Config.php b/src/Config/Config.php index a71c2811..0a4ed0d4 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -11,7 +11,7 @@ class Config extends Fluent * * @var array */ - protected $attributes = []; + protected $attributes = []; // phpcs:ignore /** * @param string|array $key diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php index a9f24e7a..b19ccc7e 100644 --- a/src/Config/ConfigServiceProvider.php +++ b/src/Config/ConfigServiceProvider.php @@ -11,16 +11,11 @@ use Illuminate\Database\QueryException; class ConfigServiceProvider extends ServiceProvider { /** @var array */ - protected $configFiles = ['app.php', 'config.default.php', 'config.php']; + protected array $configFiles = ['app.php', 'config.default.php', 'config.php']; - /** @var EventConfig */ - protected $eventConfig; - - public function __construct(Application $app, EventConfig $eventConfig = null) + public function __construct(Application $app, protected ?EventConfig $eventConfig = null) { parent::__construct($app); - - $this->eventConfig = $eventConfig; } public function register(): void diff --git a/src/Container/ServiceProvider.php b/src/Container/ServiceProvider.php index a9304e17..bacec920 100644 --- a/src/Container/ServiceProvider.php +++ b/src/Container/ServiceProvider.php @@ -6,8 +6,7 @@ use Engelsystem\Application; abstract class ServiceProvider { - /** @var Application */ - protected $app; + protected Application $app; /** * ServiceProvider constructor. diff --git a/src/Controllers/Admin/FaqController.php b/src/Controllers/Admin/FaqController.php index d2a48b8b..fce3a656 100644 --- a/src/Controllers/Admin/FaqController.php +++ b/src/Controllers/Admin/FaqController.php @@ -14,20 +14,16 @@ class FaqController extends BaseController { use HasUserNotifications; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Faq */ - protected $faq; + protected Faq $faq; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'faq.view', 'faq.edit', ]; diff --git a/src/Controllers/Admin/LogsController.php b/src/Controllers/Admin/LogsController.php index 7ccf1af6..64f9c988 100644 --- a/src/Controllers/Admin/LogsController.php +++ b/src/Controllers/Admin/LogsController.php @@ -9,14 +9,12 @@ use Engelsystem\Models\LogEntry; class LogsController extends BaseController { - /** @var LogEntry */ - protected $log; + protected LogEntry $log; - /** @var Response */ - protected $response; + protected Response $response; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'admin_log', ]; diff --git a/src/Controllers/Admin/NewsController.php b/src/Controllers/Admin/NewsController.php index 9977a550..e6408a08 100644 --- a/src/Controllers/Admin/NewsController.php +++ b/src/Controllers/Admin/NewsController.php @@ -15,23 +15,18 @@ class NewsController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var News */ - protected $news; + protected News $news; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'admin_news', ]; diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php index a4736028..70990aad 100644 --- a/src/Controllers/Admin/QuestionsController.php +++ b/src/Controllers/Admin/QuestionsController.php @@ -16,23 +16,18 @@ class QuestionsController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Question */ - protected $question; + protected Question $question; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'question.add', 'question.edit', ]; diff --git a/src/Controllers/Admin/UserShirtController.php b/src/Controllers/Admin/UserShirtController.php index 27052a06..24c48913 100644 --- a/src/Controllers/Admin/UserShirtController.php +++ b/src/Controllers/Admin/UserShirtController.php @@ -16,26 +16,20 @@ class UserShirtController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Config */ - protected $config; + protected Config $config; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; - /** @var User */ - protected $user; + protected User $user; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'editShirt' => 'user.edit.shirt', 'saveShirt' => 'user.edit.shirt', ]; diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php index ff0bcfeb..4a3af6f7 100644 --- a/src/Controllers/Admin/UserWorkLogController.php +++ b/src/Controllers/Admin/UserWorkLogController.php @@ -19,29 +19,22 @@ class UserWorkLogController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Config */ - protected $config; + protected Config $config; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Worklog */ - protected $worklog; + protected Worklog $worklog; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; - /** @var User */ - protected $user; + protected User $user; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'admin_user_worklog', ]; diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php index 9d49782e..34799822 100644 --- a/src/Controllers/ApiController.php +++ b/src/Controllers/ApiController.php @@ -6,8 +6,7 @@ use Engelsystem\Http\Response; class ApiController extends BaseController { - /** @var Response */ - protected $response; + protected Response $response; public function __construct(Response $response) { diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php index 14695050..5db84332 100644 --- a/src/Controllers/AuthController.php +++ b/src/Controllers/AuthController.php @@ -15,23 +15,18 @@ class AuthController extends BaseController { use HasUserNotifications; - /** @var Response */ - protected $response; + protected Response $response; - /** @var SessionInterface */ - protected $session; + protected SessionInterface $session; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Config */ - protected $config; + protected Config $config; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'login' => 'login', 'postLogin' => 'login', ]; diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index a557b1a1..6f9e9a27 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -9,7 +9,7 @@ abstract class BaseController use ValidatesRequest; /** @var string[]|string[][] A list of Permissions required to access the controller or certain pages */ - protected $permissions = []; + protected array $permissions = []; /** * Returns the list of permissions diff --git a/src/Controllers/CreditsController.php b/src/Controllers/CreditsController.php index 9315f92c..70d6e01a 100644 --- a/src/Controllers/CreditsController.php +++ b/src/Controllers/CreditsController.php @@ -8,14 +8,11 @@ use Engelsystem\Http\Response; class CreditsController extends BaseController { - /** @var Config */ - protected $config; + protected Config $config; - /** @var Response */ - protected $response; + protected Response $response; - /** @var Version */ - protected $version; + protected Version $version; public function __construct(Response $response, Config $config, Version $version) { diff --git a/src/Controllers/DesignController.php b/src/Controllers/DesignController.php index 2268b4cf..e5f39611 100644 --- a/src/Controllers/DesignController.php +++ b/src/Controllers/DesignController.php @@ -11,11 +11,9 @@ use Engelsystem\Models\User\User; class DesignController extends BaseController { - /** @var Response */ - protected $response; + protected Response $response; - /** @var Config */ - protected $config; + protected Config $config; public function __construct(Response $response, Config $config) { diff --git a/src/Controllers/FaqController.php b/src/Controllers/FaqController.php index b66f269c..29febf1f 100644 --- a/src/Controllers/FaqController.php +++ b/src/Controllers/FaqController.php @@ -10,17 +10,14 @@ class FaqController extends BaseController { use HasUserNotifications; - /** @var Config */ - protected $config; + protected Config $config; - /** @var Faq */ - protected $faq; + protected Faq $faq; - /** @var Response */ - protected $response; + protected Response $response; /** @var string[] */ - protected $permissions = [ + protected array $permissions = [ 'faq.view', ]; diff --git a/src/Controllers/HealthController.php b/src/Controllers/HealthController.php index d730aba9..07ec4394 100644 --- a/src/Controllers/HealthController.php +++ b/src/Controllers/HealthController.php @@ -6,8 +6,7 @@ use Engelsystem\Http\Response; class HealthController extends BaseController { - /** @var Response */ - protected $response; + protected Response $response; public function __construct(Response $response) { diff --git a/src/Controllers/HomeController.php b/src/Controllers/HomeController.php index df2646ee..6960c291 100644 --- a/src/Controllers/HomeController.php +++ b/src/Controllers/HomeController.php @@ -9,14 +9,11 @@ use Engelsystem\Http\Response; class HomeController extends BaseController { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Config */ - protected $config; + protected Config $config; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; public function __construct(Authenticator $auth, Config $config, Redirector $redirect) { diff --git a/src/Controllers/MessagesController.php b/src/Controllers/MessagesController.php index 3b416d3b..ca9bd793 100644 --- a/src/Controllers/MessagesController.php +++ b/src/Controllers/MessagesController.php @@ -12,32 +12,26 @@ use Engelsystem\Models\User\User; use Illuminate\Database\Query\Expression as QueryExpression; use Illuminate\Support\Collection; use Engelsystem\Http\Exceptions\HttpForbidden; +use Psr\Http\Message\RequestInterface; class MessagesController extends BaseController { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; - /** @var Response */ - protected $request; + protected RequestInterface $request; - /** @var Database */ - protected $db; + protected Database $db; - /** @var Message */ - protected $message; + protected Message $message; - /** @var User */ - protected $user; + protected User $user; /** @var string[] */ - protected $permissions = [ + protected array $permissions = [ 'user_messages', ]; diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php index 9865ffd8..6ec6a525 100644 --- a/src/Controllers/Metrics/Controller.php +++ b/src/Controllers/Metrics/Controller.php @@ -13,23 +13,17 @@ use Psr\Log\LogLevel; class Controller extends BaseController { - /** @var Config */ - protected $config; + protected Config $config; - /** @var MetricsEngine */ - protected $engine; + protected MetricsEngine $engine; - /** @var Request */ - protected $request; + protected Request $request; - /** @var Response */ - protected $response; + protected Response $response; - /** @var Stats */ - protected $stats; + protected Stats $stats; - /** @var Version */ - protected $version; + protected Version $version; public function __construct( Response $response, diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php index dc5c2111..0910a40e 100644 --- a/src/Controllers/Metrics/MetricsEngine.php +++ b/src/Controllers/Metrics/MetricsEngine.php @@ -6,8 +6,7 @@ use Engelsystem\Renderer\EngineInterface; class MetricsEngine implements EngineInterface { - /** @var string */ - protected $prefix = 'engelsystem_'; + protected string $prefix = 'engelsystem_'; /** * Render metrics diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php index a5aaea42..451d3619 100644 --- a/src/Controllers/Metrics/Stats.php +++ b/src/Controllers/Metrics/Stats.php @@ -30,8 +30,7 @@ use Illuminate\Support\Collection; class Stats { - /** @var Database */ - protected $db; + protected Database $db; public function __construct(Database $db) { diff --git a/src/Controllers/NewsController.php b/src/Controllers/NewsController.php index ee1b5553..e0c7f65b 100644 --- a/src/Controllers/NewsController.php +++ b/src/Controllers/NewsController.php @@ -16,32 +16,24 @@ class NewsController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var NewsComment */ - protected $comment; + protected NewsComment $comment; - /** @var Config */ - protected $config; + protected Config $config; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var News */ - protected $news; + protected News $news; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; - /** @var Request */ - protected $request; + protected Request $request; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'news', 'meetings' => 'user_meetings', 'comment' => 'news_comments', diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index dfc52f60..088c4ed0 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -25,29 +25,21 @@ class OAuthController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var AuthController */ - protected $authController; + protected AuthController $authController; - /** @var Config */ - protected $config; + protected Config $config; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var OAuth */ - protected $oauth; + protected OAuth $oauth; - /** @var Redirector */ - protected $redirector; + protected Redirector $redirector; - /** @var Session */ - protected $session; + protected Session $session; - /** @var UrlGenerator */ - protected $url; + protected UrlGenerator $url; public function __construct( Authenticator $auth, diff --git a/src/Controllers/PasswordResetController.php b/src/Controllers/PasswordResetController.php index 6c21add0..64236e97 100644 --- a/src/Controllers/PasswordResetController.php +++ b/src/Controllers/PasswordResetController.php @@ -15,20 +15,16 @@ class PasswordResetController extends BaseController { use HasUserNotifications; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var EngelsystemMailer */ - protected $mail; + protected EngelsystemMailer $mail; - /** @var Response */ - protected $response; + protected Response $response; - /** @var SessionInterface */ - protected $session; + protected SessionInterface $session; /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'reset' => 'login', 'postReset' => 'login', 'resetPassword' => 'login', diff --git a/src/Controllers/QuestionsController.php b/src/Controllers/QuestionsController.php index 555dc1bf..5a38940d 100644 --- a/src/Controllers/QuestionsController.php +++ b/src/Controllers/QuestionsController.php @@ -14,23 +14,18 @@ class QuestionsController extends BaseController { use HasUserNotifications; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Question */ - protected $question; + protected Question $question; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; /** @var string[] */ - protected $permissions = [ + protected array $permissions = [ 'question.add', ]; diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index fd44e13b..f2bd78ac 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -15,23 +15,18 @@ class SettingsController extends BaseController use HasUserNotifications; use ChecksArrivalsAndDepartures; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Config */ - protected $config; + protected Config $config; - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var Redirector */ - protected $redirect; + protected Redirector $redirect; - /** @var Response */ - protected $response; + protected Response $response; /** @var string[] */ - protected $permissions = [ + protected array $permissions = [ 'user_settings', ]; diff --git a/src/Database/Database.php b/src/Database/Database.php index ca1d5ded..bc54370c 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -7,8 +7,7 @@ use PDO; class Database { - /** @var DatabaseConnection */ - protected $connection; + protected DatabaseConnection $connection; public function __construct(DatabaseConnection $connection) { diff --git a/src/Database/Db.php b/src/Database/Db.php index 240ef48a..ab407fa9 100644 --- a/src/Database/Db.php +++ b/src/Database/Db.php @@ -9,8 +9,7 @@ use PDO; /** @deprecated */ class Db { - /** @var CapsuleManager */ - protected static $dbManager; + protected static CapsuleManager $dbManager; /** * Set the database connection manager diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php index b70ad3cc..6e76bbb8 100644 --- a/src/Database/Migration/Migrate.php +++ b/src/Database/Migration/Migrate.php @@ -19,17 +19,14 @@ class Migrate /** @var string */ public const DOWN = 'down'; - /** @var Application */ - protected $app; + protected Application $app; - /** @var SchemaBuilder */ - protected $schema; + protected SchemaBuilder $schema; /** @var callable */ protected $output; - /** @var string */ - protected $table = 'migrations'; + protected string $table = 'migrations'; /** * Migrate constructor diff --git a/src/Database/Migration/Migration.php b/src/Database/Migration/Migration.php index 60e313cc..17d45311 100644 --- a/src/Database/Migration/Migration.php +++ b/src/Database/Migration/Migration.php @@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Builder as SchemaBuilder; abstract class Migration { - /** @var SchemaBuilder */ - protected $schema; + protected SchemaBuilder $schema; /** * Migration constructor. diff --git a/src/Events/EventDispatcher.php b/src/Events/EventDispatcher.php index e18f2a43..e0a3487a 100644 --- a/src/Events/EventDispatcher.php +++ b/src/Events/EventDispatcher.php @@ -8,7 +8,7 @@ use Illuminate\Support\Str; class EventDispatcher { /** @var callable[] */ - protected $listeners; + protected array $listeners; public function listen(array|string $events, callable|string $listener): void { diff --git a/src/Events/Listener/News.php b/src/Events/Listener/News.php index f4177f3c..50305a64 100644 --- a/src/Events/Listener/News.php +++ b/src/Events/Listener/News.php @@ -12,14 +12,11 @@ use Symfony\Component\Mailer\Exception\TransportException; class News { - /** @var LoggerInterface */ - protected $log; + protected LoggerInterface $log; - /** @var EngelsystemMailer */ - protected $mailer; + protected EngelsystemMailer $mailer; - /** @var UserSettings */ - protected $settings; + protected UserSettings $settings; public function __construct( LoggerInterface $log, diff --git a/src/Events/Listener/OAuth2.php b/src/Events/Listener/OAuth2.php index 2a773a27..406119f1 100644 --- a/src/Events/Listener/OAuth2.php +++ b/src/Events/Listener/OAuth2.php @@ -12,13 +12,11 @@ use Psr\Log\LoggerInterface; class OAuth2 { - /** @var Authenticator */ protected Authenticator $auth; /** @var array */ protected array $config; - /** @var LoggerInterface */ protected LoggerInterface $log; public function __construct(Config $config, LoggerInterface $log, Authenticator $auth) diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php index c5598ec9..90774a35 100644 --- a/src/Exceptions/Handler.php +++ b/src/Exceptions/Handler.php @@ -10,14 +10,12 @@ use Throwable; class Handler { - /** @var string */ - protected $environment; + protected string $environment; /** @var HandlerInterface[] */ - protected $handler = []; + protected array $handler = []; - /** @var Request */ - protected $request; + protected ?Request $request = null; /** @var string */ public const ENV_PRODUCTION = 'prod'; diff --git a/src/Exceptions/Handlers/Legacy.php b/src/Exceptions/Handlers/Legacy.php index 24894a0e..c83d6e3e 100644 --- a/src/Exceptions/Handlers/Legacy.php +++ b/src/Exceptions/Handlers/Legacy.php @@ -8,8 +8,7 @@ use Throwable; class Legacy implements HandlerInterface { - /** @var LoggerInterface */ - protected $log; + protected ?LoggerInterface $log = null; public function render(Request $request, Throwable $e): void { diff --git a/src/Exceptions/Handlers/Whoops.php b/src/Exceptions/Handlers/Whoops.php index c23a87f8..e75495b8 100644 --- a/src/Exceptions/Handlers/Whoops.php +++ b/src/Exceptions/Handlers/Whoops.php @@ -13,8 +13,7 @@ use Whoops\Run as WhoopsRunner; class Whoops extends Legacy implements HandlerInterface { - /** @var Application */ - protected $app; + protected Application $app; /** * Whoops constructor. diff --git a/src/Helpers/Assets.php b/src/Helpers/Assets.php index 07085b05..75a54d54 100644 --- a/src/Helpers/Assets.php +++ b/src/Helpers/Assets.php @@ -4,10 +4,8 @@ namespace Engelsystem\Helpers; class Assets { - /** @var string */ protected string $assetsPath; - /** @var string */ protected string $manifestFile = 'manifest.json'; /** diff --git a/src/Helpers/Authenticator.php b/src/Helpers/Authenticator.php index 1f443482..8c23059f 100644 --- a/src/Helpers/Authenticator.php +++ b/src/Helpers/Authenticator.php @@ -11,28 +11,21 @@ use Symfony\Component\HttpFoundation\Session\Session; class Authenticator { - /** @var User|null */ protected ?User $user = null; - /** @var ServerRequestInterface */ protected ServerRequestInterface $request; - /** @var Session */ protected Session $session; - /** @var UserRepository */ protected UserRepository $userRepository; /** @var string[] */ protected array $permissions = []; - /** @var int|string|null */ - protected $passwordAlgorithm = PASSWORD_DEFAULT; + protected int|string|null $passwordAlgorithm = PASSWORD_DEFAULT; - /** @var int */ protected int $defaultRole = 20; - /** @var int */ protected int $guestRole = 10; public function __construct(ServerRequestInterface $request, Session $session, UserRepository $userRepository) diff --git a/src/Helpers/Schedule/Conference.php b/src/Helpers/Schedule/Conference.php index a438c5f6..3169d561 100644 --- a/src/Helpers/Schedule/Conference.php +++ b/src/Helpers/Schedule/Conference.php @@ -9,25 +9,20 @@ class Conference use CalculatesTime; /** @var string required */ - protected $title; + protected string $title; /** @var string required */ - protected $acronym; + protected string $acronym; - /** @var string|null */ - protected $start; + protected ?string $start = null; - /** @var string|null */ - protected $end; + protected ?string $end = null; - /** @var int|null */ - protected $days; + protected ?int $days = null; - /** @var string|null */ - protected $timeslotDuration; + protected ?string $timeslotDuration = null; - /** @var string|null */ - protected $baseUrl; + protected ?string $baseUrl = null; /** * Event constructor. diff --git a/src/Helpers/Schedule/Day.php b/src/Helpers/Schedule/Day.php index 99c26be8..c63e61cf 100644 --- a/src/Helpers/Schedule/Day.php +++ b/src/Helpers/Schedule/Day.php @@ -9,19 +9,19 @@ use Carbon\Carbon; class Day { /** @var string required */ - protected $date; + protected string $date; /** @var Carbon required */ - protected $start; + protected Carbon $start; /** @var Carbon required */ - protected $end; + protected Carbon $end; /** @var int required */ - protected $index; + protected int $index; /** @var Room[] */ - protected $room; + protected array $room; /** * Day constructor. diff --git a/src/Helpers/Schedule/Event.php b/src/Helpers/Schedule/Event.php index 2fb545d6..c85ebdf6 100644 --- a/src/Helpers/Schedule/Event.php +++ b/src/Helpers/Schedule/Event.php @@ -11,70 +11,66 @@ class Event use CalculatesTime; /** @var string required globally unique */ - protected $guid; + protected string $guid; /** @var int required globally unique */ - protected $id; + protected int $id; /** @var Room required, string in XML */ - protected $room; + protected Room $room; /** @var string required */ - protected $title; + protected string $title; /** @var string required */ - protected $subtitle; + protected string $subtitle; /** @var string required */ - protected $type; + protected string $type; /** @var Carbon required */ - protected $date; + protected Carbon $date; /** @var string required time (hh:mm:ss || hh:mm) */ - protected $start; + protected string $start; /** @var string required (h?h:mm:ss || h?h:mm) */ - protected $duration; + protected string $duration; /** @var string required */ - protected $abstract; + protected string $abstract; /** @var string required globally unique */ - protected $slug; + protected string $slug; /** @var string required */ - protected $track; + protected string $track; - /** @var string|null */ - protected $logo; + protected ?string $logo = null; /** @var string[] id => name */ - protected $persons; + protected array $persons; /** @var string|null two letter code */ - protected $language; + protected ?string $language = null; - /** @var string|null */ - protected $description; + protected ?string $description = null; /** @var string|null license (and opt out in XML, null if not recorded, empty if no license defined) */ - protected $recording; + protected ?string $recording = null; /** @var array href => title */ - protected $links; + protected array $links; /** @var array href => name */ - protected $attachments; + protected array $attachments; - /** @var string|null */ - protected $url; + protected ?string $url = null; - /** @var string|null */ - protected $videoDownloadUrl; + protected ?string $videoDownloadUrl = null; /** @var Carbon Calculated */ - protected $endDate; + protected Carbon $endDate; /** * Event constructor. diff --git a/src/Helpers/Schedule/Room.php b/src/Helpers/Schedule/Room.php index 1c6e0b11..e856d253 100644 --- a/src/Helpers/Schedule/Room.php +++ b/src/Helpers/Schedule/Room.php @@ -7,10 +7,10 @@ namespace Engelsystem\Helpers\Schedule; class Room { /** @var string required */ - protected $name; + protected string $name; /** @var Event[] */ - protected $event; + protected array $event; /** * Room constructor. diff --git a/src/Helpers/Schedule/Schedule.php b/src/Helpers/Schedule/Schedule.php index e5d4f26a..1ca54309 100644 --- a/src/Helpers/Schedule/Schedule.php +++ b/src/Helpers/Schedule/Schedule.php @@ -8,14 +8,12 @@ use Carbon\Carbon; class Schedule { - /** @var string */ - protected $version; + protected string $version; - /** @var Conference */ - protected $conference; + protected Conference $conference; /** @var Day[] */ - protected $day; + protected array $day; /** * @param Day[] $days diff --git a/src/Helpers/Schedule/XmlParser.php b/src/Helpers/Schedule/XmlParser.php index bf52fe3a..9e852be3 100644 --- a/src/Helpers/Schedule/XmlParser.php +++ b/src/Helpers/Schedule/XmlParser.php @@ -9,22 +9,20 @@ use SimpleXMLElement; class XmlParser { - /** @var SimpleXMLElement */ - protected $scheduleXML; + protected SimpleXMLElement $scheduleXML; - /** @var Schedule */ - protected $schedule; + protected Schedule $schedule; public function load(string $xml): bool { - $this->scheduleXML = simplexml_load_string($xml); + $scheduleXML = simplexml_load_string($xml); - if (!$this->scheduleXML) { + if (!$scheduleXML) { return false; } + $this->scheduleXML = $scheduleXML; $this->parseXml(); - return true; } diff --git a/src/Helpers/Translation/TranslationServiceProvider.php b/src/Helpers/Translation/TranslationServiceProvider.php index eb43df14..097d54d4 100644 --- a/src/Helpers/Translation/TranslationServiceProvider.php +++ b/src/Helpers/Translation/TranslationServiceProvider.php @@ -13,8 +13,7 @@ use Symfony\Component\HttpFoundation\Session\Session; class TranslationServiceProvider extends ServiceProvider { - /** @var GettextTranslator */ - protected $translators = []; + protected GettextTranslator|array $translators = []; public function register(): void { diff --git a/src/Helpers/Translation/Translator.php b/src/Helpers/Translation/Translator.php index 776a5f1b..d3edb351 100644 --- a/src/Helpers/Translation/Translator.php +++ b/src/Helpers/Translation/Translator.php @@ -5,13 +5,11 @@ namespace Engelsystem\Helpers\Translation; class Translator { /** @var string[] */ - protected $locales; + protected array $locales; - /** @var string */ - protected $locale; + protected string $locale; - /** @var string */ - protected $fallbackLocale; + protected string $fallbackLocale; /** @var callable */ protected $getTranslatorCallback; diff --git a/src/Helpers/Version.php b/src/Helpers/Version.php index 11a668aa..f4668bf8 100644 --- a/src/Helpers/Version.php +++ b/src/Helpers/Version.php @@ -6,14 +6,11 @@ use Engelsystem\Config\Config; class Version { - /** @var Config */ - protected $config; + protected Config $config; - /** @vat string */ - protected $storage; + protected string $storage; - /** @var string */ - protected $versionFile = 'VERSION'; + protected string $versionFile = 'VERSION'; public function __construct(string $storage, Config $config) { diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php index 53500df3..24c9bec7 100644 --- a/src/Http/Exceptions/HttpException.php +++ b/src/Http/Exceptions/HttpException.php @@ -7,11 +7,10 @@ use Throwable; class HttpException extends RuntimeException { - /** @var int */ - protected $statusCode; + protected int $statusCode; /** @var array */ - protected $headers = []; + protected array $headers = []; /** * @param array $headers diff --git a/src/Http/Exceptions/ValidationException.php b/src/Http/Exceptions/ValidationException.php index cecfd23b..9a71c199 100644 --- a/src/Http/Exceptions/ValidationException.php +++ b/src/Http/Exceptions/ValidationException.php @@ -8,8 +8,7 @@ use Throwable; class ValidationException extends RuntimeException { - /** @var Validator */ - protected $validator; + protected Validator $validator; /** * @param Throwable|null $previous diff --git a/src/Http/Redirector.php b/src/Http/Redirector.php index 841c081b..38713b70 100644 --- a/src/Http/Redirector.php +++ b/src/Http/Redirector.php @@ -4,14 +4,11 @@ namespace Engelsystem\Http; class Redirector { - /** @var Request */ - protected $request; + protected Request $request; - /** @var Response */ - protected $response; + protected Response $response; - /** @var UrlGeneratorInterface */ - protected $url; + protected UrlGeneratorInterface $url; public function __construct(Request $request, Response $response, UrlGeneratorInterface $url) { diff --git a/src/Http/Response.php b/src/Http/Response.php index 3ca0e7cc..d8539f94 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -12,27 +12,13 @@ class Response extends SymfonyResponse implements ResponseInterface { use MessageTrait; - /** - * @var SessionInterface - */ - protected $session; - - /** @var Renderer */ - protected $renderer; - - /** - * @param array $headers - */ public function __construct( string $content = '', int $status = 200, array $headers = [], - Renderer $renderer = null, - SessionInterface $session = null + protected ?Renderer $renderer = null, + protected ?SessionInterface $session = null ) { - $this->renderer = $renderer; - $this->session = $session; - parent::__construct($content, $status, $headers); } diff --git a/src/Http/Validation/ValidatesRequest.php b/src/Http/Validation/ValidatesRequest.php index a390fc64..09b1d99a 100644 --- a/src/Http/Validation/ValidatesRequest.php +++ b/src/Http/Validation/ValidatesRequest.php @@ -7,8 +7,7 @@ use Engelsystem\Http\Request; trait ValidatesRequest { - /** @var Validator */ - protected $validator; + protected Validator $validator; /** * @param array $rules diff --git a/src/Http/Validation/Validator.php b/src/Http/Validation/Validator.php index b64268db..33021f96 100644 --- a/src/Http/Validation/Validator.php +++ b/src/Http/Validation/Validator.php @@ -10,13 +10,13 @@ use Respect\Validation\Validator as RespectValidator; class Validator { /** @var string[] */ - protected $errors = []; + protected array $errors = []; /** @var array */ - protected $data = []; + protected array $data = []; /** @var array */ - protected $mapping = [ + protected array $mapping = [ 'accepted' => 'TrueVal', 'int' => 'IntVal', 'float' => 'FloatVal', @@ -24,7 +24,7 @@ class Validator ]; /** @var array */ - protected $nestedRules = ['optional', 'not']; + protected array $nestedRules = ['optional', 'not']; /** * @param array $data diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index 9d486c37..044bc1ef 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -11,7 +11,8 @@ use Throwable; class Logger extends AbstractLogger { - protected $allowedLevels = [ + /** @var array */ + protected $allowedLevels = [ // phpcs:ignore LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::DEBUG, @@ -22,8 +23,7 @@ class Logger extends AbstractLogger LogLevel::WARNING, ]; - /** @var LogEntry */ - protected $log; + protected LogEntry $log; public function __construct(LogEntry $log) { diff --git a/src/Logger/UserAwareLogger.php b/src/Logger/UserAwareLogger.php index b0e7b3be..6c469747 100644 --- a/src/Logger/UserAwareLogger.php +++ b/src/Logger/UserAwareLogger.php @@ -8,8 +8,7 @@ use Stringable; class UserAwareLogger extends Logger { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; /** * Logs with an arbitrary level and prepends the user diff --git a/src/Mail/EngelsystemMailer.php b/src/Mail/EngelsystemMailer.php index 936abf40..f5c1c4a1 100644 --- a/src/Mail/EngelsystemMailer.php +++ b/src/Mail/EngelsystemMailer.php @@ -9,14 +9,11 @@ use Symfony\Component\Mailer\MailerInterface; class EngelsystemMailer extends Mailer { - /** @var Renderer|null */ - protected $view; + protected ?Renderer $view = null; - /** @var Translator|null */ - protected $translation; + protected ?Translator $translation = null; - /** @var string */ - protected $subjectPrefix = null; + protected ?string $subjectPrefix = null; /** * @param Renderer|null $view diff --git a/src/Mail/Mailer.php b/src/Mail/Mailer.php index d4addac1..7b766a5c 100644 --- a/src/Mail/Mailer.php +++ b/src/Mail/Mailer.php @@ -7,14 +7,11 @@ use Symfony\Component\Mime\Email; class Mailer { - /** @var MailerInterface */ - protected $mailer; + protected MailerInterface $mailer; - /** @var string */ - protected $fromAddress = ''; + protected string $fromAddress = ''; - /** @var string */ - protected $fromName = null; + protected ?string $fromName = null; public function __construct(MailerInterface $mailer) { diff --git a/src/Mail/Transport/LogTransport.php b/src/Mail/Transport/LogTransport.php index 6b14c4a8..c87b6dee 100644 --- a/src/Mail/Transport/LogTransport.php +++ b/src/Mail/Transport/LogTransport.php @@ -8,8 +8,7 @@ use Symfony\Component\Mailer\Transport\AbstractTransport; class LogTransport extends AbstractTransport { - /** @var LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; public function __construct(LoggerInterface $logger) { diff --git a/src/Middleware/AddHeaders.php b/src/Middleware/AddHeaders.php index 41f4d8d7..f97623d1 100644 --- a/src/Middleware/AddHeaders.php +++ b/src/Middleware/AddHeaders.php @@ -10,8 +10,7 @@ use Psr\Http\Server\RequestHandlerInterface; class AddHeaders implements MiddlewareInterface { - /** @var Config */ - protected $config; + protected Config $config; public function __construct(Config $config) { diff --git a/src/Middleware/CallableHandler.php b/src/Middleware/CallableHandler.php index 97183d9f..eb851e0a 100644 --- a/src/Middleware/CallableHandler.php +++ b/src/Middleware/CallableHandler.php @@ -15,8 +15,7 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface /** @var callable */ protected $callable; - /** @var Container */ - protected $container; + protected ?Container $container = null; /** * @param callable $callable The callable that should be wrapped diff --git a/src/Middleware/Dispatcher.php b/src/Middleware/Dispatcher.php index 803e8c59..e2772f94 100644 --- a/src/Middleware/Dispatcher.php +++ b/src/Middleware/Dispatcher.php @@ -15,22 +15,16 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface use ResolvesMiddlewareTrait; /** @var MiddlewareInterface[]|string[] */ - protected $stack; + protected array $stack; - /** @var Application */ - protected $container; - - /** @var RequestHandlerInterface */ - protected $next; + protected RequestHandlerInterface $next; /** * @param MiddlewareInterface[]|string[] $stack - * @param Application|null $container */ - public function __construct(array $stack = [], Application $container = null) + public function __construct(array $stack = [], protected ?Application $container = null) { $this->stack = $stack; - $this->container = $container; } /** diff --git a/src/Middleware/ErrorHandler.php b/src/Middleware/ErrorHandler.php index ed1791ec..21232dfd 100644 --- a/src/Middleware/ErrorHandler.php +++ b/src/Middleware/ErrorHandler.php @@ -16,18 +16,16 @@ use Twig\Loader\LoaderInterface as TwigLoader; class ErrorHandler implements MiddlewareInterface { - /** @var TwigLoader */ - protected $loader; + protected TwigLoader $loader; - /** @var string */ - protected $viewPrefix = 'errors/'; + protected string $viewPrefix = 'errors/'; /** * A list of inputs that are not saved from form input * * @var array */ - protected $formIgnore = [ + protected array $formIgnore = [ 'password', 'password_confirmation', 'password2', diff --git a/src/Middleware/ExceptionHandler.php b/src/Middleware/ExceptionHandler.php index ad49d497..3d875496 100644 --- a/src/Middleware/ExceptionHandler.php +++ b/src/Middleware/ExceptionHandler.php @@ -12,8 +12,7 @@ use Throwable; class ExceptionHandler implements MiddlewareInterface { - /** @var ContainerInterface */ - protected $container; + protected ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index ad33a53a..01fcdce8 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -13,7 +13,8 @@ use Psr\Http\Server\RequestHandlerInterface; class LegacyMiddleware implements MiddlewareInterface { - protected $free_pages = [ + /** @var array */ + protected array $free_pages = [ 'admin_event_config', 'angeltypes', 'atom', @@ -28,11 +29,9 @@ class LegacyMiddleware implements MiddlewareInterface 'admin_shifts_history', ]; - /** @var ContainerInterface */ - protected $container; + protected ContainerInterface $container; - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; public function __construct(ContainerInterface $container, Authenticator $auth) { diff --git a/src/Middleware/RequestHandler.php b/src/Middleware/RequestHandler.php index d43cbdcc..e9c05c85 100644 --- a/src/Middleware/RequestHandler.php +++ b/src/Middleware/RequestHandler.php @@ -16,8 +16,7 @@ class RequestHandler implements MiddlewareInterface { use ResolvesMiddlewareTrait; - /** @var Application */ - protected $container; + protected Application $container; public function __construct(Application $container) { diff --git a/src/Middleware/RouteDispatcher.php b/src/Middleware/RouteDispatcher.php index 1076e987..c6852af6 100644 --- a/src/Middleware/RouteDispatcher.php +++ b/src/Middleware/RouteDispatcher.php @@ -12,14 +12,11 @@ use Psr\Http\Server\RequestHandlerInterface; class RouteDispatcher implements MiddlewareInterface { - /** @var FastRouteDispatcher */ - protected $dispatcher; + protected FastRouteDispatcher $dispatcher; - /** @var ResponseInterface */ - protected $response; + protected ResponseInterface $response; - /** @var MiddlewareInterface|null */ - protected $notFound; + protected ?MiddlewareInterface $notFound = null; /** * @param ResponseInterface $response Default response diff --git a/src/Middleware/SessionHandler.php b/src/Middleware/SessionHandler.php index 4b4a0dcc..351524a1 100644 --- a/src/Middleware/SessionHandler.php +++ b/src/Middleware/SessionHandler.php @@ -11,11 +11,10 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; class SessionHandler implements MiddlewareInterface { - /** @var SessionStorageInterface */ - protected $session; + protected SessionStorageInterface $session; /** @var string[] */ - protected $paths = []; + protected array $paths = []; /** * @param array $paths diff --git a/src/Middleware/SetLocale.php b/src/Middleware/SetLocale.php index e8040735..beffc5be 100644 --- a/src/Middleware/SetLocale.php +++ b/src/Middleware/SetLocale.php @@ -12,14 +12,11 @@ use Symfony\Component\HttpFoundation\Session\Session; class SetLocale implements MiddlewareInterface { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Translator */ - protected $translator; + protected Translator $translator; - /** @var Session */ - protected $session; + protected Session $session; public function __construct(Translator $translator, Session $session, Authenticator $auth) { diff --git a/src/Middleware/VerifyCsrfToken.php b/src/Middleware/VerifyCsrfToken.php index bc36182b..a5e3aa08 100644 --- a/src/Middleware/VerifyCsrfToken.php +++ b/src/Middleware/VerifyCsrfToken.php @@ -11,8 +11,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; class VerifyCsrfToken implements MiddlewareInterface { - /** @var SessionInterface */ - protected $session; + protected SessionInterface $session; public function __construct(SessionInterface $session) { diff --git a/src/Models/AngelType.php b/src/Models/AngelType.php index e55847e8..085c1c15 100644 --- a/src/Models/AngelType.php +++ b/src/Models/AngelType.php @@ -43,8 +43,8 @@ class AngelType extends BaseModel { use HasFactory; - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'name', 'description', @@ -60,7 +60,7 @@ class AngelType extends BaseModel ]; /** @var array */ - protected $casts = [ + protected $casts = [ // phpcs:ignore 'restricted' => 'boolean', 'requires_driver_license' => 'boolean', 'no_self_signup' => 'boolean', diff --git a/src/Models/BaseModel.php b/src/Models/BaseModel.php index c5cb40cd..ab0c7f62 100644 --- a/src/Models/BaseModel.php +++ b/src/Models/BaseModel.php @@ -16,5 +16,5 @@ use Illuminate\Database\Query\Builder as QueryBuilder; abstract class BaseModel extends Model { /** @var bool Disable timestamps by default because of "Datensparsamkeit" */ - public $timestamps = false; + public $timestamps = false; // phpcs:ignore } diff --git a/src/Models/EventConfig.php b/src/Models/EventConfig.php index 34c0e4a7..f5906bc8 100644 --- a/src/Models/EventConfig.php +++ b/src/Models/EventConfig.php @@ -19,19 +19,19 @@ use Illuminate\Database\Query\Builder as QueryBuilder; class EventConfig extends BaseModel { /** @var string The primary key for the model */ - protected $primaryKey = 'name'; + protected $primaryKey = 'name'; // phpcs:ignore /** @var bool Indicates if the IDs are auto-incrementing */ - public $incrementing = false; + public $incrementing = false; // phpcs:ignore /** @var string Required because it is not event_configs */ - protected $table = 'event_config'; + protected $table = 'event_config'; // phpcs:ignore /** @var array Values that are mass assignable */ - protected $fillable = ['name', 'value']; + protected $fillable = ['name', 'value']; // phpcs:ignore - /** @var array The configuration values that should be cast to native types */ - protected $valueCasts = [ + /** @var array The configuration values that should be cast to native types */ + protected array $valueCasts = [ 'buildup_start' => 'datetime_human', 'event_start' => 'datetime_human', 'event_end' => 'datetime_human', @@ -40,7 +40,7 @@ class EventConfig extends BaseModel ]; /** @var bool It could be interesting to know when a value changed the last time */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore /** * Value accessor diff --git a/src/Models/Faq.php b/src/Models/Faq.php index c77e4c74..d7e46eb3 100644 --- a/src/Models/Faq.php +++ b/src/Models/Faq.php @@ -24,13 +24,13 @@ class Faq extends BaseModel use HasFactory; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore /** @var string The models table */ - public $table = 'faq'; + public $table = 'faq'; // phpcs:ignore - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'question', 'text', ]; diff --git a/src/Models/Group.php b/src/Models/Group.php index 2c901469..a79d7dd7 100644 --- a/src/Models/Group.php +++ b/src/Models/Group.php @@ -25,7 +25,7 @@ class Group extends BaseModel use HasFactory; /** @var string[] */ - protected $fillable = [ + protected $fillable = [ // phpcs:ignore 'name', ]; diff --git a/src/Models/LogEntry.php b/src/Models/LogEntry.php index 789c0b13..e6ee0129 100644 --- a/src/Models/LogEntry.php +++ b/src/Models/LogEntry.php @@ -22,7 +22,7 @@ use Illuminate\Support\Collection as SupportCollection; class LogEntry extends BaseModel { /** @var bool enable timestamps for created_at */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore /** @var null Disable updated_at */ public const UPDATED_AT = null; @@ -32,7 +32,7 @@ class LogEntry extends BaseModel * * @var array */ - protected $fillable = [ + protected $fillable = [ // phpcs:ignore 'level', 'message', ]; diff --git a/src/Models/Message.php b/src/Models/Message.php index d7947e9f..55553882 100644 --- a/src/Models/Message.php +++ b/src/Models/Message.php @@ -36,25 +36,25 @@ class Message extends BaseModel use UsesUserModel; /** @var bool enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'receiver_id' => 'integer', 'read' => 'boolean', ]; - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'user_id', 'receiver_id', 'read', 'text', ]; - /** @var array */ - protected $attributes = [ + /** @var array */ + protected $attributes = [ // phpcs:ignore 'read' => false, ]; diff --git a/src/Models/News.php b/src/Models/News.php index b76680fc..d0bf3a43 100644 --- a/src/Models/News.php +++ b/src/Models/News.php @@ -38,23 +38,23 @@ class News extends BaseModel use UsesUserModel; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var array */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'is_meeting' => 'boolean', 'is_pinned' => 'boolean', ]; - /** @var array Default attributes */ - protected $attributes = [ + /** @var array Default attributes */ + protected $attributes = [ // phpcs:ignore 'is_meeting' => false, 'is_pinned' => false, ]; - /** @var array */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'title', 'text', 'is_meeting', diff --git a/src/Models/NewsComment.php b/src/Models/NewsComment.php index 5634c745..5f1c8d27 100644 --- a/src/Models/NewsComment.php +++ b/src/Models/NewsComment.php @@ -32,16 +32,16 @@ class NewsComment extends BaseModel use UsesUserModel; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'news_id' => 'integer', ]; - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'news_id', 'text', 'user_id', diff --git a/src/Models/OAuth.php b/src/Models/OAuth.php index f0d1fb37..62de480e 100644 --- a/src/Models/OAuth.php +++ b/src/Models/OAuth.php @@ -28,24 +28,23 @@ class OAuth extends BaseModel { use UsesUserModel; - /** @var string */ - public $table = 'oauth'; + public $table = 'oauth'; // phpcs:ignore /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', ]; - /** @var string[] */ - protected $dates = [ + /** @var array */ + protected $dates = [ // phpcs:ignore 'expires_at', ]; - /** @var array */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'provider', 'identifier', 'access_token', diff --git a/src/Models/Privilege.php b/src/Models/Privilege.php index 5189acba..52298fe3 100644 --- a/src/Models/Privilege.php +++ b/src/Models/Privilege.php @@ -24,8 +24,8 @@ class Privilege extends BaseModel { use HasFactory; - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'name', 'description', ]; diff --git a/src/Models/Question.php b/src/Models/Question.php index 15513947..331e6409 100644 --- a/src/Models/Question.php +++ b/src/Models/Question.php @@ -34,15 +34,15 @@ class Question extends BaseModel use UsesUserModel; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var string[] */ - protected $dates = [ + /** @var array */ + protected $dates = [ // phpcs:ignore 'answered_at' ]; - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'user_id', 'text', 'answerer_id', @@ -50,8 +50,8 @@ class Question extends BaseModel 'answered_at', ]; - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'answerer_id' => 'integer', ]; diff --git a/src/Models/Room.php b/src/Models/Room.php index f245b40f..b3638f17 100644 --- a/src/Models/Room.php +++ b/src/Models/Room.php @@ -30,10 +30,10 @@ class Room extends BaseModel use HasFactory; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var array */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'name', 'dect', 'map_url', diff --git a/src/Models/Shifts/Schedule.php b/src/Models/Shifts/Schedule.php index 88d956cb..abc5c039 100644 --- a/src/Models/Shifts/Schedule.php +++ b/src/Models/Shifts/Schedule.php @@ -37,17 +37,17 @@ class Schedule extends BaseModel use HasFactory; /** @var bool enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'shift_type' => 'integer', 'minutes_before' => 'integer', 'minutes_after' => 'integer', ]; - /** @var array Values that are mass assignable */ - protected $fillable = [ + /** @var array Values that are mass assignable */ + protected $fillable = [ // phpcs:ignore 'name', 'url', 'shift_type', diff --git a/src/Models/Shifts/ScheduleShift.php b/src/Models/Shifts/ScheduleShift.php index 4bd131e3..9ab99344 100644 --- a/src/Models/Shifts/ScheduleShift.php +++ b/src/Models/Shifts/ScheduleShift.php @@ -20,16 +20,16 @@ use Illuminate\Database\Query\Builder as QueryBuilder; class ScheduleShift extends BaseModel { /** @var string The primary key for the model */ - protected $primaryKey = 'shift_id'; + protected $primaryKey = 'shift_id'; // phpcs:ignore /** @var string Required because it is not schedule_shifts */ - protected $table = 'schedule_shift'; + protected $table = 'schedule_shift'; // phpcs:ignore - /** @var array Values that are mass assignable */ - protected $fillable = ['shift_id', 'schedule_id', 'guid']; + /** @var array Values that are mass assignable */ + protected $fillable = ['shift_id', 'schedule_id', 'guid']; // phpcs:ignore - /** @var array */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'shift_id' => 'integer', 'schedule_id' => 'integer', ]; diff --git a/src/Models/Shifts/ShiftType.php b/src/Models/Shifts/ShiftType.php index ffe5fd9c..cd62282c 100644 --- a/src/Models/Shifts/ShiftType.php +++ b/src/Models/Shifts/ShiftType.php @@ -25,8 +25,8 @@ class ShiftType extends BaseModel { use HasFactory; - /** @var array */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'name', 'description', ]; diff --git a/src/Models/User/Contact.php b/src/Models/User/Contact.php index 4583acf0..5d5209df 100644 --- a/src/Models/User/Contact.php +++ b/src/Models/User/Contact.php @@ -19,10 +19,14 @@ class Contact extends HasUserModel use HasFactory; /** @var string The table associated with the model */ - protected $table = 'users_contact'; + protected $table = 'users_contact'; // phpcs:ignore - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'dect', 'email', diff --git a/src/Models/User/HasUserModel.php b/src/Models/User/HasUserModel.php index 47fbd14d..18abbbf8 100644 --- a/src/Models/User/HasUserModel.php +++ b/src/Models/User/HasUserModel.php @@ -9,18 +9,26 @@ abstract class HasUserModel extends BaseModel use UsesUserModel; /** @var string The primary key for the model */ - protected $primaryKey = 'user_id'; + protected $primaryKey = 'user_id'; // phpcs:ignore - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', ]; - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', ]; - /** The relationships that should be touched on save */ - protected $touches = ['user']; + /** + * The relationships that should be touched on save + * + * @var array + */ + protected $touches = ['user']; // phpcs:ignore } diff --git a/src/Models/User/License.php b/src/Models/User/License.php index a5e0e535..13a76872 100644 --- a/src/Models/User/License.php +++ b/src/Models/User/License.php @@ -25,10 +25,10 @@ class License extends HasUserModel use HasFactory; /** @var string The table associated with the model */ - protected $table = 'users_licenses'; + protected $table = 'users_licenses'; // phpcs:ignore /** @var array Default attributes */ - protected $attributes = [ + protected $attributes = [ // phpcs:ignore 'has_car' => false, 'drive_forklift' => false, 'drive_car' => false, @@ -37,8 +37,12 @@ class License extends HasUserModel 'drive_12t' => false, ]; - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'has_car', 'drive_forklift', @@ -48,8 +52,8 @@ class License extends HasUserModel 'drive_12t', ]; - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'has_car' => 'boolean', 'drive_forklift' => 'boolean', 'drive_car' => 'boolean', diff --git a/src/Models/User/PasswordReset.php b/src/Models/User/PasswordReset.php index 5adff6f5..18307804 100644 --- a/src/Models/User/PasswordReset.php +++ b/src/Models/User/PasswordReset.php @@ -18,13 +18,17 @@ class PasswordReset extends HasUserModel use HasFactory; /** @var bool enable timestamps for created_at */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore /** @var null Disable updated_at */ public const UPDATED_AT = null; - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'token', ]; diff --git a/src/Models/User/PersonalData.php b/src/Models/User/PersonalData.php index cc89047a..6854c439 100644 --- a/src/Models/User/PersonalData.php +++ b/src/Models/User/PersonalData.php @@ -26,16 +26,20 @@ class PersonalData extends HasUserModel use HasFactory; /** @var string The table associated with the model */ - protected $table = 'users_personal_data'; + protected $table = 'users_personal_data'; // phpcs:ignore - /** @var array The attributes that should be mutated to dates */ - protected $dates = [ + /** @var array The attributes that should be mutated to dates */ + protected $dates = [ // phpcs:ignore 'planned_arrival_date', 'planned_departure_date', ]; - /** The attributes that are mass assignable. */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'first_name', 'last_name', diff --git a/src/Models/User/Settings.php b/src/Models/User/Settings.php index 69a84f73..0c7552b1 100644 --- a/src/Models/User/Settings.php +++ b/src/Models/User/Settings.php @@ -27,10 +27,10 @@ class Settings extends HasUserModel use HasFactory; /** @var string The table associated with the model */ - protected $table = 'users_settings'; + protected $table = 'users_settings'; // phpcs:ignore - /** @var array Default attributes */ - protected $attributes = [ + /** @var array Default attributes */ + protected $attributes = [ // phpcs:ignore 'email_human' => false, 'email_goody' => false, 'email_shiftinfo' => false, @@ -38,8 +38,12 @@ class Settings extends HasUserModel 'mobile_show' => false, ]; - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'language', 'theme', @@ -51,7 +55,7 @@ class Settings extends HasUserModel ]; /** @var string[] */ - protected $casts = [ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'theme' => 'integer', 'email_human' => 'boolean', diff --git a/src/Models/User/State.php b/src/Models/User/State.php index d6ffbfc1..b93cbf39 100644 --- a/src/Models/User/State.php +++ b/src/Models/User/State.php @@ -26,10 +26,10 @@ class State extends HasUserModel use HasFactory; /** @var string The table associated with the model */ - protected $table = 'users_state'; + protected $table = 'users_state'; // phpcs:ignore - /** @var array Default attributes */ - protected $attributes = [ + /** @var array Default attributes */ + protected $attributes = [ // phpcs:ignore 'arrived' => false, 'active' => false, 'force_active' => false, @@ -37,8 +37,8 @@ class State extends HasUserModel 'got_voucher' => 0, ]; - /** @var array */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'arrived' => 'boolean', 'active' => 'boolean', @@ -47,13 +47,17 @@ class State extends HasUserModel 'got_voucher' => 'integer', ]; - /** @var array The attributes that should be mutated to dates */ - protected $dates = [ + /** @var array The attributes that should be mutated to dates */ + protected $dates = [ // phpcs:ignore 'arrival_date', ]; - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'arrived', 'arrival_date', diff --git a/src/Models/User/User.php b/src/Models/User/User.php index 0cecf0cf..093a973b 100644 --- a/src/Models/User/User.php +++ b/src/Models/User/User.php @@ -68,10 +68,14 @@ class User extends BaseModel use HasFactory; /** @var bool enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** The attributes that are mass assignable */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'name', 'password', 'email', @@ -79,14 +83,14 @@ class User extends BaseModel 'last_login_at', ]; - /** @var array The attributes that should be hidden for serialization */ - protected $hidden = [ + /** @var array The attributes that should be hidden for serialization */ + protected $hidden = [ // phpcs:ignore 'api_key', 'password', ]; - /** @var array The attributes that should be mutated to dates */ - protected $dates = [ + /** @var array The attributes that should be mutated to dates */ + protected $dates = [ // phpcs:ignore 'last_login_at', ]; diff --git a/src/Models/UserAngelType.php b/src/Models/UserAngelType.php index fc8e84d5..556a0a19 100644 --- a/src/Models/UserAngelType.php +++ b/src/Models/UserAngelType.php @@ -34,21 +34,21 @@ class UserAngelType extends Pivot use UsesUserModel; /** @var bool Increment the IDs */ - public $incrementing = true; + public $incrementing = true; // phpcs:ignore /** @var bool Disable timestamps */ - public $timestamps = false; + public $timestamps = false; // phpcs:ignore - /** @var array */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'user_id', 'angel_type_id', 'confirm_user_id', 'supporter', ]; - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'angel_type_id' => 'integer', 'confirm_user_id' => 'integer', diff --git a/src/Models/Worklog.php b/src/Models/Worklog.php index 92d57ab9..6c3398aa 100644 --- a/src/Models/Worklog.php +++ b/src/Models/Worklog.php @@ -32,22 +32,26 @@ class Worklog extends BaseModel use UsesUserModel; /** @var bool Enable timestamps */ - public $timestamps = true; + public $timestamps = true; // phpcs:ignore - /** @var array The attributes that should be mutated to dates */ - protected $dates = [ + /** @var array The attributes that should be mutated to dates */ + protected $dates = [ // phpcs:ignore 'worked_at', ]; - /** @var string[] */ - protected $casts = [ + /** @var array */ + protected $casts = [ // phpcs:ignore 'user_id' => 'integer', 'creator_id' => 'integer', 'hours' => 'float', ]; - /** The attributes that are mass assignable. */ - protected $fillable = [ + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ // phpcs:ignore 'user_id', 'creator_id', 'hours', diff --git a/src/Renderer/Engine.php b/src/Renderer/Engine.php index fc5c6ffe..210ff688 100644 --- a/src/Renderer/Engine.php +++ b/src/Renderer/Engine.php @@ -5,7 +5,7 @@ namespace Engelsystem\Renderer; abstract class Engine implements EngineInterface { /** @var array */ - protected $sharedData = []; + protected array $sharedData = []; /** * @param mixed[]|string $key diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php index 2234e69e..ec23bc81 100644 --- a/src/Renderer/Renderer.php +++ b/src/Renderer/Renderer.php @@ -9,7 +9,7 @@ class Renderer use LoggerAwareTrait; /** @var EngineInterface[] */ - protected $renderer = []; + protected array $renderer = []; /** * Render a template diff --git a/src/Renderer/Twig/Extensions/Assets.php b/src/Renderer/Twig/Extensions/Assets.php index f5d573b9..a9f13267 100644 --- a/src/Renderer/Twig/Extensions/Assets.php +++ b/src/Renderer/Twig/Extensions/Assets.php @@ -10,11 +10,9 @@ use Twig\TwigFunction; class Assets extends TwigExtension { - /** @var AssetsProvider */ - protected $assets; + protected AssetsProvider $assets; - /** @var UrlGeneratorInterface */ - protected $urlGenerator; + protected UrlGeneratorInterface $urlGenerator; public function __construct(AssetsProvider $assets, UrlGeneratorInterface $urlGenerator) { diff --git a/src/Renderer/Twig/Extensions/Authentication.php b/src/Renderer/Twig/Extensions/Authentication.php index 1b181fa9..0841ea4a 100644 --- a/src/Renderer/Twig/Extensions/Authentication.php +++ b/src/Renderer/Twig/Extensions/Authentication.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Authentication extends TwigExtension { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; public function __construct(Authenticator $auth) { diff --git a/src/Renderer/Twig/Extensions/Config.php b/src/Renderer/Twig/Extensions/Config.php index db3bbcc5..c109ff20 100644 --- a/src/Renderer/Twig/Extensions/Config.php +++ b/src/Renderer/Twig/Extensions/Config.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Config extends TwigExtension { - /** @var EngelsystemConfig */ - protected $config; + protected EngelsystemConfig $config; public function __construct(EngelsystemConfig $config) { diff --git a/src/Renderer/Twig/Extensions/Csrf.php b/src/Renderer/Twig/Extensions/Csrf.php index 22d8aa74..08aaa817 100644 --- a/src/Renderer/Twig/Extensions/Csrf.php +++ b/src/Renderer/Twig/Extensions/Csrf.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Csrf extends TwigExtension { - /** @var SessionInterface */ - protected $session; + protected SessionInterface $session; public function __construct(SessionInterface $session) { diff --git a/src/Renderer/Twig/Extensions/Develop.php b/src/Renderer/Twig/Extensions/Develop.php index 7f5e0696..f96ecdfe 100644 --- a/src/Renderer/Twig/Extensions/Develop.php +++ b/src/Renderer/Twig/Extensions/Develop.php @@ -9,11 +9,9 @@ use Twig\TwigFunction; class Develop extends TwigExtension { - /** @var Config */ - protected $config; + protected Config $config; - /** @var VarDumper|null */ - protected $dumper; + protected ?VarDumper $dumper = null; public function __construct(Config $config) { diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php index f840c1d0..ac94edaf 100644 --- a/src/Renderer/Twig/Extensions/Globals.php +++ b/src/Renderer/Twig/Extensions/Globals.php @@ -11,11 +11,9 @@ use function array_key_exists; class Globals extends TwigExtension implements GlobalsInterface { - /** @var Authenticator */ - protected $auth; + protected Authenticator $auth; - /** @var Request */ - protected $request; + protected Request $request; public function __construct(Authenticator $auth, Request $request) { diff --git a/src/Renderer/Twig/Extensions/Legacy.php b/src/Renderer/Twig/Extensions/Legacy.php index ecf8eb8f..3a8635aa 100644 --- a/src/Renderer/Twig/Extensions/Legacy.php +++ b/src/Renderer/Twig/Extensions/Legacy.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Legacy extends TwigExtension { - /** @var Request */ - protected $request; + protected Request $request; public function __construct(Request $request) { diff --git a/src/Renderer/Twig/Extensions/Markdown.php b/src/Renderer/Twig/Extensions/Markdown.php index 6a3d661c..7ea02b1d 100644 --- a/src/Renderer/Twig/Extensions/Markdown.php +++ b/src/Renderer/Twig/Extensions/Markdown.php @@ -8,8 +8,7 @@ use Twig\TwigFilter; class Markdown extends TwigExtension { - /** @var Parsedown */ - protected $renderer; + protected Parsedown $renderer; public function __construct(Parsedown $renderer) { diff --git a/src/Renderer/Twig/Extensions/Session.php b/src/Renderer/Twig/Extensions/Session.php index 4381874e..70781304 100644 --- a/src/Renderer/Twig/Extensions/Session.php +++ b/src/Renderer/Twig/Extensions/Session.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Session extends TwigExtension { - /** @var SymfonySession */ - protected $session; + protected SymfonySession $session; public function __construct(SymfonySession $session) { diff --git a/src/Renderer/Twig/Extensions/Translation.php b/src/Renderer/Twig/Extensions/Translation.php index f36777e2..dfb46f02 100644 --- a/src/Renderer/Twig/Extensions/Translation.php +++ b/src/Renderer/Twig/Extensions/Translation.php @@ -9,8 +9,7 @@ use Twig\TwigFunction; class Translation extends TwigExtension { - /** @var Translator */ - protected $translator; + protected Translator $translator; public function __construct(Translator $translator) { diff --git a/src/Renderer/Twig/Extensions/Url.php b/src/Renderer/Twig/Extensions/Url.php index d2267df0..9a4e52a1 100644 --- a/src/Renderer/Twig/Extensions/Url.php +++ b/src/Renderer/Twig/Extensions/Url.php @@ -8,8 +8,7 @@ use Twig\TwigFunction; class Url extends TwigExtension { - /** @var UrlGeneratorInterface */ - protected $urlGenerator; + protected UrlGeneratorInterface $urlGenerator; public function __construct(UrlGeneratorInterface $urlGenerator) { diff --git a/src/Renderer/TwigEngine.php b/src/Renderer/TwigEngine.php index b93e07ec..d7a17c98 100644 --- a/src/Renderer/TwigEngine.php +++ b/src/Renderer/TwigEngine.php @@ -9,8 +9,7 @@ use Twig\Error\SyntaxError as SyntaxError; class TwigEngine extends Engine { - /** @var Twig */ - protected $twig; + protected Twig $twig; public function __construct(Twig $twig) { diff --git a/src/Renderer/TwigServiceProvider.php b/src/Renderer/TwigServiceProvider.php index 0431d905..8ead82d4 100644 --- a/src/Renderer/TwigServiceProvider.php +++ b/src/Renderer/TwigServiceProvider.php @@ -24,7 +24,7 @@ use TwigBridge\Extension\Laravel\Model as TwigModel; class TwigServiceProvider extends ServiceProvider { /** @var array */ - protected $extensions = [ + protected array $extensions = [ 'assets' => Assets::class, 'authentication' => Authentication::class, 'config' => Config::class, diff --git a/tests/Unit/Controllers/Admin/FaqControllerTest.php b/tests/Unit/Controllers/Admin/FaqControllerTest.php index a0c1d4bd..a706a4b2 100644 --- a/tests/Unit/Controllers/Admin/FaqControllerTest.php +++ b/tests/Unit/Controllers/Admin/FaqControllerTest.php @@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Session\Session; class FaqControllerTest extends ControllerTest { /** @var array */ - protected $data = [ + protected array $data = [ 'question' => 'Foo?', 'text' => 'Bar!', ]; diff --git a/tests/Unit/Controllers/Admin/NewsControllerTest.php b/tests/Unit/Controllers/Admin/NewsControllerTest.php index 3243005f..3259be81 100644 --- a/tests/Unit/Controllers/Admin/NewsControllerTest.php +++ b/tests/Unit/Controllers/Admin/NewsControllerTest.php @@ -16,11 +16,10 @@ use Symfony\Component\HttpFoundation\Session\Session; class NewsControllerTest extends ControllerTest { - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; /** @var array */ - protected $data = [ + protected array $data = [ [ 'title' => 'Foo', 'text' => '**foo**', diff --git a/tests/Unit/Controllers/Admin/QuestionsControllerTest.php b/tests/Unit/Controllers/Admin/QuestionsControllerTest.php index 9da14780..162d3518 100644 --- a/tests/Unit/Controllers/Admin/QuestionsControllerTest.php +++ b/tests/Unit/Controllers/Admin/QuestionsControllerTest.php @@ -17,11 +17,9 @@ use PHPUnit\Framework\MockObject\MockObject; class QuestionsControllerTest extends ControllerTest { - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var User */ - protected $user; + protected User $user; /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::index diff --git a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php index 02187e18..9e23b1f1 100644 --- a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php +++ b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php @@ -18,17 +18,13 @@ use PHPUnit\Framework\MockObject\MockObject; class UserWorkLogControllerTest extends ControllerTest { - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var Redirector|MockObject */ - protected $redirect; + protected Redirector|MockObject $redirect; - /** @var User */ - protected $user; + protected User $user; - /** @var UserWorkLogController */ - protected $controller; + protected UserWorkLogController $controller; /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog diff --git a/tests/Unit/Controllers/ControllerTest.php b/tests/Unit/Controllers/ControllerTest.php index ddce9530..4525de21 100644 --- a/tests/Unit/Controllers/ControllerTest.php +++ b/tests/Unit/Controllers/ControllerTest.php @@ -20,20 +20,15 @@ abstract class ControllerTest extends TestCase { use HasDatabase; - /** @var Config */ - protected $config; + protected Config $config; - /** @var TestLogger */ - protected $log; + protected TestLogger $log; - /** @var Response|MockObject */ - protected $response; + protected Response|MockObject $response; - /** @var Request */ - protected $request; + protected Request $request; - /** @var Session */ - protected $session; + protected Session $session; /** * @param string|null $type diff --git a/tests/Unit/Controllers/MessagesControllerTest.php b/tests/Unit/Controllers/MessagesControllerTest.php index 4e36e8a4..f1835828 100644 --- a/tests/Unit/Controllers/MessagesControllerTest.php +++ b/tests/Unit/Controllers/MessagesControllerTest.php @@ -21,23 +21,16 @@ class MessagesControllerTest extends ControllerTest { use HasDatabase; - /** @var MessagesController */ - protected $controller; + protected MessagesController $controller; - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var User */ - protected $userA; - /** @var User */ - protected $userB; + protected User $userA; + protected User $userB; - /** @var Carbon */ - protected $now; - /** @var Carbon */ - protected $oneMinuteAgo; - /** @var Carbon */ - protected $twoMinutesAgo; + protected Carbon $now; + protected Carbon $oneMinuteAgo; + protected Carbon $twoMinutesAgo; /** * @testdox index: underNormalConditions -> returnsCorrectViewAndData diff --git a/tests/Unit/Controllers/NewsControllerTest.php b/tests/Unit/Controllers/NewsControllerTest.php index 7edc7197..498baea0 100644 --- a/tests/Unit/Controllers/NewsControllerTest.php +++ b/tests/Unit/Controllers/NewsControllerTest.php @@ -19,11 +19,10 @@ class NewsControllerTest extends ControllerTest { use HasDatabase; - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; /** @var array */ - protected $data = [ + protected array $data = [ [ 'title' => 'Foo', 'text' => 'foo', diff --git a/tests/Unit/Controllers/OAuthControllerTest.php b/tests/Unit/Controllers/OAuthControllerTest.php index 3b17ceae..1026cfa8 100644 --- a/tests/Unit/Controllers/OAuthControllerTest.php +++ b/tests/Unit/Controllers/OAuthControllerTest.php @@ -29,41 +29,30 @@ class OAuthControllerTest extends TestCase { use HasDatabase; - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var AuthController|MockObject */ - protected $authController; + protected AuthController|MockObject $authController; - /** @var User */ - protected $authenticatedUser; + protected User $authenticatedUser; - /** @var User */ - protected $otherAuthenticatedUser; + protected User $otherAuthenticatedUser; - /** @var User */ - protected $otherUser; + protected User $otherUser; - /** @var Config */ - protected $config; + protected Config $config; - /** @var TestLogger */ - protected $log; + protected TestLogger $log; - /** @var OAuth */ - protected $oauth; + protected OAuth $oauth; - /** @var Redirector|MockObject $redirect */ - protected $redirect; + protected Redirector|MockObject $redirect; - /** @var Session */ - protected $session; + protected Session $session; - /** @var UrlGenerator|MockObject */ - protected $url; + protected UrlGenerator|MockObject $url; /** @var string[][] */ - protected $oauthConfig = [ + protected array $oauthConfig = [ 'testprovider' => [ 'client_id' => 'testsystem', 'client_secret' => 'foo-bar-baz', diff --git a/tests/Unit/Controllers/PasswordResetControllerTest.php b/tests/Unit/Controllers/PasswordResetControllerTest.php index 71a3ac5f..f2c5a445 100644 --- a/tests/Unit/Controllers/PasswordResetControllerTest.php +++ b/tests/Unit/Controllers/PasswordResetControllerTest.php @@ -28,7 +28,7 @@ class PasswordResetControllerTest extends TestCase use HasDatabase; /** @var array */ - protected $args = []; + protected array $args = []; /** * @covers \Engelsystem\Controllers\PasswordResetController::reset diff --git a/tests/Unit/Controllers/QuestionsControllerTest.php b/tests/Unit/Controllers/QuestionsControllerTest.php index 44c7a9e3..0181e687 100644 --- a/tests/Unit/Controllers/QuestionsControllerTest.php +++ b/tests/Unit/Controllers/QuestionsControllerTest.php @@ -17,11 +17,9 @@ use PHPUnit\Framework\MockObject\MockObject; class QuestionsControllerTest extends ControllerTest { - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var User */ - protected $user; + protected User $user; /** * @covers \Engelsystem\Controllers\QuestionsController::index diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php index 56531d13..33073671 100644 --- a/tests/Unit/Controllers/SettingsControllerTest.php +++ b/tests/Unit/Controllers/SettingsControllerTest.php @@ -21,14 +21,11 @@ class SettingsControllerTest extends ControllerTest { use HasDatabase; - /** @var Authenticator|MockObject */ - protected $auth; + protected Authenticator|MockObject $auth; - /** @var User */ - protected $user; + protected User $user; - /** @var SettingsController */ - protected $controller; + protected SettingsController $controller; protected function setUpProfileTest(): array { diff --git a/tests/Unit/Controllers/Stub/ControllerImplementation.php b/tests/Unit/Controllers/Stub/ControllerImplementation.php index a8bf538c..54c1989e 100644 --- a/tests/Unit/Controllers/Stub/ControllerImplementation.php +++ b/tests/Unit/Controllers/Stub/ControllerImplementation.php @@ -7,7 +7,7 @@ use Engelsystem\Controllers\BaseController; class ControllerImplementation extends BaseController { /** @var array */ - protected $permissions = [ + protected array $permissions = [ 'foo', 'lorem' => [ 'ipsum', diff --git a/tests/Unit/Controllers/Stub/TestModel.php b/tests/Unit/Controllers/Stub/TestModel.php index dc054753..ce8e42f2 100644 --- a/tests/Unit/Controllers/Stub/TestModel.php +++ b/tests/Unit/Controllers/Stub/TestModel.php @@ -13,8 +13,8 @@ use Illuminate\Database\Eloquent\Model; */ class TestModel extends Model { - /** @var string[] */ - protected $fillable = [ + /** @var array */ + protected $fillable = [ // phpcs:ignore 'text', 'another_text', ]; diff --git a/tests/Unit/Database/DatabaseTest.php b/tests/Unit/Database/DatabaseTest.php index bebaf98d..cd0132db 100644 --- a/tests/Unit/Database/DatabaseTest.php +++ b/tests/Unit/Database/DatabaseTest.php @@ -11,8 +11,7 @@ use PHPUnit\Framework\TestCase; class DatabaseTest extends TestCase { - /** @var DatabaseConnection */ - protected $connection; + protected DatabaseConnection $connection; /** * @covers \Engelsystem\Database\Database::__construct() diff --git a/tests/Unit/Events/EventDispatcherTest.php b/tests/Unit/Events/EventDispatcherTest.php index 548108de..ee43ddb7 100644 --- a/tests/Unit/Events/EventDispatcherTest.php +++ b/tests/Unit/Events/EventDispatcherTest.php @@ -8,7 +8,7 @@ use Engelsystem\Test\Unit\TestCase; class EventDispatcherTest extends TestCase { /** @var array */ - protected $firedEvents = []; + protected array $firedEvents = []; /** * @covers \Engelsystem\Events\EventDispatcher::listen diff --git a/tests/Unit/Events/Listener/NewsTest.php b/tests/Unit/Events/Listener/NewsTest.php index d9f92679..0644449d 100644 --- a/tests/Unit/Events/Listener/NewsTest.php +++ b/tests/Unit/Events/Listener/NewsTest.php @@ -18,14 +18,11 @@ class NewsTest extends TestCase { use HasDatabase; - /** @var TestLogger */ - protected $log; + protected TestLogger $log; - /** @var EngelsystemMailer|MockObject */ - protected $mailer; + protected EngelsystemMailer|MockObject $mailer; - /** @var User */ - protected $user; + protected User $user; /** * @covers \Engelsystem\Events\Listener\News::created diff --git a/tests/Unit/FactoriesTest.php b/tests/Unit/FactoriesTest.php index d256876a..7154d7f1 100644 --- a/tests/Unit/FactoriesTest.php +++ b/tests/Unit/FactoriesTest.php @@ -2,17 +2,13 @@ namespace Engelsystem\Test\Unit; -use Engelsystem\Models\AngelType; use Engelsystem\Models\Faq; -use Engelsystem\Models\Group; use Engelsystem\Models\Message; use Engelsystem\Models\News; use Engelsystem\Models\NewsComment; -use Engelsystem\Models\Privilege; use Engelsystem\Models\Question; use Engelsystem\Models\Room; use Engelsystem\Models\Shifts\Schedule; -use Engelsystem\Models\Shifts\ShiftType; use Engelsystem\Models\User\Contact; use Engelsystem\Models\User\License; use Engelsystem\Models\User\PasswordReset; @@ -20,7 +16,6 @@ use Engelsystem\Models\User\PersonalData; use Engelsystem\Models\User\Settings; use Engelsystem\Models\User\State; use Engelsystem\Models\User\User; -use Engelsystem\Models\UserAngelType; use Engelsystem\Models\Worklog; use Illuminate\Database\Eloquent\Model; @@ -30,25 +25,20 @@ class FactoriesTest extends TestCase /** @var string[] */ protected array $models = [ - AngelType::class, Contact::class, Faq::class, - Group::class, License::class, Message::class, News::class, NewsComment::class, PasswordReset::class, PersonalData::class, - Privilege::class, Question::class, Room::class, Schedule::class, Settings::class, - ShiftType::class, State::class, User::class, - UserAngelType::class, Worklog::class, ]; diff --git a/tests/Unit/FakerProvider.php b/tests/Unit/FakerProvider.php index 412b1750..ea606c1f 100644 --- a/tests/Unit/FakerProvider.php +++ b/tests/Unit/FakerProvider.php @@ -7,10 +7,24 @@ use Faker\Provider\Base; class FakerProvider extends Base { /** @var string[] */ - protected static $pronouns = ['fae', 'ae', 'e', 'ey', 'he', 'per', 'she', 'tey', 'they', 've', 'xe', 'ze', 'zie']; + protected static array $pronouns = [ + 'fae', + 'ae', + 'e', + 'ey', + 'he', + 'per', + 'she', + 'tey', + 'they', + 've', + 'xe', + 'ze', + 'zie' + ]; /** @var string[] */ - protected static $shirtSizes = ['S', 'S-G', 'M', 'M-G', 'L', 'L-G', 'XL', 'XL-G', '2XL', '3XL', '4XL']; + protected static array $shirtSizes = ['S', 'S-G', 'M', 'M-G', 'L', 'L-G', 'XL', 'XL-G', '2XL', '3XL', '4XL']; public function pronoun(): string { diff --git a/tests/Unit/HasDatabase.php b/tests/Unit/HasDatabase.php index 902d6e3d..0d464dee 100644 --- a/tests/Unit/HasDatabase.php +++ b/tests/Unit/HasDatabase.php @@ -12,8 +12,7 @@ use Psr\Http\Message\ServerRequestInterface; trait HasDatabase { - /** @var Database */ - protected $database; + protected Database $database; /** * Setup in memory database diff --git a/tests/Unit/Helpers/BarChartTest.php b/tests/Unit/Helpers/BarChartTest.php index c77ce3b4..5afa0c4d 100644 --- a/tests/Unit/Helpers/BarChartTest.php +++ b/tests/Unit/Helpers/BarChartTest.php @@ -31,8 +31,7 @@ class BarChartTest extends TestCase ], ]; - /** @var Renderer&MockObject */ - private $rendererMock; + private Renderer&MockObject $rendererMock; protected function setUp(): void { diff --git a/tests/Unit/Helpers/Stub/UserModelImplementation.php b/tests/Unit/Helpers/Stub/UserModelImplementation.php index 2e1e1731..f6bb0c36 100644 --- a/tests/Unit/Helpers/Stub/UserModelImplementation.php +++ b/tests/Unit/Helpers/Stub/UserModelImplementation.php @@ -9,14 +9,11 @@ use InvalidArgumentException; class UserModelImplementation extends User { - /** @var User */ - public static $user = null; + public static ?User $user = null; - /** @var int */ - public static $id = null; + public static ?int $id = null; - /** @var int */ - public static $apiKey = null; + public static ?string $apiKey = null; /** * @param array $columns diff --git a/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php b/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php index 9c44bf22..86c10ed7 100644 --- a/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php +++ b/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php @@ -7,7 +7,7 @@ use Engelsystem\Http\SessionHandlers\AbstractHandler; class ArrayHandler extends AbstractHandler { /** @var string[] */ - protected $content = []; + protected array $content = []; /** * {@inheritdoc} diff --git a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php index ee3699a6..0ba09ba1 100644 --- a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php +++ b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php @@ -4,11 +4,9 @@ namespace Engelsystem\Test\Unit\Http\Validation\Rules\Stub; class ParentClassImplementation { - /** @var bool */ - public $validateResult = true; + public bool $validateResult = true; - /** @var mixed */ - public $lastInput; + public mixed $lastInput; public function validate(mixed $input): bool { diff --git a/tests/Unit/Mail/MailerServiceProviderTest.php b/tests/Unit/Mail/MailerServiceProviderTest.php index a0227b61..328fe844 100644 --- a/tests/Unit/Mail/MailerServiceProviderTest.php +++ b/tests/Unit/Mail/MailerServiceProviderTest.php @@ -19,7 +19,7 @@ use Symfony\Component\Mailer\Transport\TransportInterface; class MailerServiceProviderTest extends ServiceProviderTest { /** @var array */ - protected $defaultConfig = [ + protected array $defaultConfig = [ 'app_name' => 'Engelsystem App', 'email' => [ 'driver' => 'mail', @@ -32,7 +32,7 @@ class MailerServiceProviderTest extends ServiceProviderTest ]; /** @var array */ - protected $smtpConfig = [ + protected array $smtpConfig = [ 'email' => [ 'driver' => 'smtp', 'host' => 'mail.foo.bar', diff --git a/tests/Unit/Middleware/DispatcherTest.php b/tests/Unit/Middleware/DispatcherTest.php index 39811ef0..82acd76a 100644 --- a/tests/Unit/Middleware/DispatcherTest.php +++ b/tests/Unit/Middleware/DispatcherTest.php @@ -4,7 +4,7 @@ namespace Engelsystem\Test\Unit\Middleware; use Engelsystem\Application; use Engelsystem\Middleware\Dispatcher; -use LogicException; +use Error; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; @@ -122,7 +122,7 @@ class DispatcherTest extends TestCase /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); - $this->expectException(LogicException::class); + $this->expectException(Error::class); $dispatcher = new Dispatcher(); $dispatcher->handle($request); diff --git a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php index db4a011b..af77dd2d 100644 --- a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php +++ b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php @@ -11,12 +11,8 @@ class ResolvesMiddlewareTraitImplementation { use ResolvesMiddlewareTrait; - /** @var Application */ - protected $container; - - public function __construct(Application $container = null) + public function __construct(protected ?Application $container = null) { - $this->container = $container; } public function callResolveMiddleware( diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php index 558f293f..fec36a6e 100644 --- a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php +++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php @@ -9,8 +9,7 @@ use Psr\Http\Server\RequestHandlerInterface; class ReturnResponseMiddleware implements MiddlewareInterface { - /** @var ResponseInterface */ - protected $response; + protected ResponseInterface $response; public function __construct(ResponseInterface $response) { diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php index ab357ce4..747d24f3 100644 --- a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php +++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php @@ -9,8 +9,7 @@ use Psr\Http\Server\RequestHandlerInterface; class ReturnResponseMiddlewareHandler implements RequestHandlerInterface { - /** @var ResponseInterface */ - protected $response; + protected ResponseInterface $response; public function __construct(ResponseInterface $response) { diff --git a/tests/Unit/Models/MessageTest.php b/tests/Unit/Models/MessageTest.php index b0d8de74..fa4872f2 100644 --- a/tests/Unit/Models/MessageTest.php +++ b/tests/Unit/Models/MessageTest.php @@ -12,20 +12,15 @@ use Engelsystem\Models\User\User; */ class MessageTest extends ModelTest { - /** @var User */ - private $user1; + private User $user1; - /** @var User */ - private $user2; + private User $user2; - /** @var Message */ - private $message1; + private Message $message1; - /** @var Message */ - private $message2; + private Message $message2; - /** @var Message */ - private $message3; + private Message $message3; protected function setUp(): void { diff --git a/tests/Unit/Models/NewsCommentsTest.php b/tests/Unit/Models/NewsCommentsTest.php index 0fd7700e..1769e340 100644 --- a/tests/Unit/Models/NewsCommentsTest.php +++ b/tests/Unit/Models/NewsCommentsTest.php @@ -13,14 +13,12 @@ use Engelsystem\Models\User\User; */ class NewsCommentsTest extends ModelTest { - /** @var User */ - private $user; + private User $user; - /** @var News */ - private $news; + private News $news; /** @var array */ - private $newsCommentData; + private array $newsCommentData; /** * Sets up some test objects and test data. diff --git a/tests/Unit/Models/NewsTest.php b/tests/Unit/Models/NewsTest.php index 81980db1..0b735587 100644 --- a/tests/Unit/Models/NewsTest.php +++ b/tests/Unit/Models/NewsTest.php @@ -13,10 +13,9 @@ use Engelsystem\Models\User\User; class NewsTest extends ModelTest { /** @var array */ - private $newsData; + private array $newsData; - /** @var User */ - private $user; + private User $user; protected function setUp(): void { diff --git a/tests/Unit/Models/QuestionTest.php b/tests/Unit/Models/QuestionTest.php index 595d6129..8333095b 100644 --- a/tests/Unit/Models/QuestionTest.php +++ b/tests/Unit/Models/QuestionTest.php @@ -11,15 +11,9 @@ use Illuminate\Support\Str; class QuestionTest extends ModelTest { - /** - * @var User - */ - private $user1; + private User $user1; - /** - * @var User - */ - private $user2; + private User $user2; protected function setUp(): void { diff --git a/tests/Unit/Models/Stub/BaseModelImplementation.php b/tests/Unit/Models/Stub/BaseModelImplementation.php index e7e73b39..9b6903fe 100644 --- a/tests/Unit/Models/Stub/BaseModelImplementation.php +++ b/tests/Unit/Models/Stub/BaseModelImplementation.php @@ -10,14 +10,12 @@ use Illuminate\Database\Eloquent\Builder as QueryBuilder; */ class BaseModelImplementation extends BaseModel { - /** @var array */ - protected $fillable = ['foo']; + /** @var array */ + protected $fillable = ['foo']; // phpcs:ignore - /** @var int */ - public $saveCount = 0; + public int $saveCount = 0; - /** @var QueryBuilder */ - public static $queryBuilder = null; + public static QueryBuilder $queryBuilder = null; /** * @param array $options diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php index d241b948..d99f0208 100644 --- a/tests/Unit/Models/User/UserTest.php +++ b/tests/Unit/Models/User/UserTest.php @@ -31,7 +31,7 @@ class UserTest extends ModelTest use ArraySubsetAsserts; /** @var string[] */ - protected $data = [ + protected array $data = [ 'name' => 'lorem', 'password' => '', 'email' => 'foo@bar.batz', diff --git a/tests/Unit/Models/UserAngelTypeTest.php b/tests/Unit/Models/UserAngelTypeTest.php index 44790a7b..ed9cd99d 100644 --- a/tests/Unit/Models/UserAngelTypeTest.php +++ b/tests/Unit/Models/UserAngelTypeTest.php @@ -11,14 +11,11 @@ use Illuminate\Database\Eloquent\Model; class UserAngelTypeTest extends ModelTest { - /** @var User|Model */ - protected $user; + protected User|Model $user; - /** @var User|Model */ - protected $confirmed; + protected User|Model $confirmed; - /** @var AngelType|Model */ - protected $angeltype; + protected AngelType|Model $angeltype; /** * @covers \Engelsystem\Models\UserAngelType diff --git a/tests/Unit/Renderer/HtmlEngineTest.php b/tests/Unit/Renderer/HtmlEngineTest.php index deda3085..2305fdb7 100644 --- a/tests/Unit/Renderer/HtmlEngineTest.php +++ b/tests/Unit/Renderer/HtmlEngineTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; class HtmlEngineTest extends TestCase { /** @var string[] */ - protected $tmpFileNames = []; + protected array $tmpFileNames = []; /** * @covers \Engelsystem\Renderer\HtmlEngine::get diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 16529627..390c43a3 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -13,8 +13,7 @@ use PHPUnit\Framework\TestCase as PHPUnitTestCase; abstract class TestCase extends PHPUnitTestCase { - /** @var Application */ - protected $app; + protected Application $app; /** * @param array $arguments