diff --git a/.phpcs.xml b/.phpcs.xml index 752ba98d..8484fa65 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -27,5 +27,9 @@ /includes + + /includes + + diff --git a/config/routes.php b/config/routes.php index fc0a51ee..75a4965b 100644 --- a/config/routes.php +++ b/config/routes.php @@ -17,7 +17,7 @@ $route->get('/logout', 'AuthController@logout'); // OAuth $route->addGroup( '/oauth/{provider}', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'OAuthController@index'); $route->post('/connect', 'OAuthController@connect'); $route->post('/disconnect', 'OAuthController@disconnect'); @@ -27,7 +27,7 @@ $route->addGroup( // User settings $route->addGroup( '/settings', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('/profile', 'SettingsController@profile'); $route->post('/profile', 'SettingsController@saveProfile'); $route->get('/password', 'SettingsController@password'); @@ -43,7 +43,7 @@ $route->addGroup( // Password recovery $route->addGroup( '/password/reset', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'PasswordResetController@reset'); $route->post('', 'PasswordResetController@postReset'); $route->get('/{token:.+}', 'PasswordResetController@resetPassword'); @@ -59,7 +59,7 @@ $route->get('/stats', 'Metrics\\Controller@stats'); $route->get('/meetings', 'NewsController@meetings'); $route->addGroup( '/news', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'NewsController@index'); $route->get('/{news_id:\d+}', 'NewsController@show'); $route->post('/{news_id:\d+}', 'NewsController@comment'); @@ -73,7 +73,7 @@ $route->get('/faq', 'FaqController@index'); // Questions $route->addGroup( '/questions', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'QuestionsController@index'); $route->post('', 'QuestionsController@delete'); $route->get('/new', 'QuestionsController@add'); @@ -84,7 +84,7 @@ $route->addGroup( // Messages $route->addGroup( '/messages', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'MessagesController@index'); $route->post('', 'MessagesController@redirectToConversation'); $route->get('/{user_id:\d+}', 'MessagesController@messagesOfConversation'); @@ -102,11 +102,11 @@ $route->get('/design', 'DesignController@index'); // Administration $route->addGroup( '/admin', - function (RouteCollector $route) { + function (RouteCollector $route): void { // FAQ $route->addGroup( '/faq', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('[/{faq_id:\d+}]', 'Admin\\FaqController@edit'); $route->post('[/{faq_id:\d+}]', 'Admin\\FaqController@save'); } @@ -115,7 +115,7 @@ $route->addGroup( // Log $route->addGroup( '/logs', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'Admin\\LogsController@index'); $route->post('', 'Admin\\LogsController@index'); } @@ -124,7 +124,7 @@ $route->addGroup( // Schedule $route->addGroup( '/schedule', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'Admin\\Schedule\\ImportSchedule@index'); $route->get('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@edit'); $route->post('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@save'); @@ -136,7 +136,7 @@ $route->addGroup( // Questions $route->addGroup( '/questions', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'Admin\\QuestionsController@index'); $route->post('', 'Admin\\QuestionsController@delete'); $route->get('/{question_id:\d+}', 'Admin\\QuestionsController@edit'); @@ -147,11 +147,11 @@ $route->addGroup( // User $route->addGroup( '/user/{user_id:\d+}', - function (RouteCollector $route) { + function (RouteCollector $route): void { // Shirts $route->addGroup( '/shirt', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('', 'Admin\\UserShirtController@editShirt'); $route->post('', 'Admin\\UserShirtController@saveShirt'); } @@ -160,7 +160,7 @@ $route->addGroup( // Worklogs $route->addGroup( '/worklog', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@editWorklog'); $route->post('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@saveWorklog'); $route->get( @@ -179,7 +179,7 @@ $route->addGroup( // News $route->addGroup( '/news', - function (RouteCollector $route) { + function (RouteCollector $route): void { $route->get('[/{news_id:\d+}]', 'Admin\\NewsController@edit'); $route->post('[/{news_id:\d+}]', 'Admin\\NewsController@save'); } diff --git a/db/factories/FaqFactory.php b/db/factories/FaqFactory.php index 616ae436..06fef751 100644 --- a/db/factories/FaqFactory.php +++ b/db/factories/FaqFactory.php @@ -13,7 +13,7 @@ class FaqFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'question' => $this->faker->text(100), diff --git a/db/factories/GroupFactory.php b/db/factories/GroupFactory.php index 8c05da23..186581d6 100644 --- a/db/factories/GroupFactory.php +++ b/db/factories/GroupFactory.php @@ -13,7 +13,7 @@ class GroupFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->unique()->word(), diff --git a/db/factories/MessageFactory.php b/db/factories/MessageFactory.php index 2110bc8c..5cfab4ca 100644 --- a/db/factories/MessageFactory.php +++ b/db/factories/MessageFactory.php @@ -14,7 +14,7 @@ class MessageFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'user_id' => User::factory(), diff --git a/db/factories/NewsCommentFactory.php b/db/factories/NewsCommentFactory.php index 4a8880aa..bf78570f 100644 --- a/db/factories/NewsCommentFactory.php +++ b/db/factories/NewsCommentFactory.php @@ -15,7 +15,7 @@ class NewsCommentFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'news_id' => News::factory(), diff --git a/db/factories/NewsFactory.php b/db/factories/NewsFactory.php index e7125386..0ab12ab5 100644 --- a/db/factories/NewsFactory.php +++ b/db/factories/NewsFactory.php @@ -14,7 +14,7 @@ class NewsFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->text(50), diff --git a/db/factories/PrivilegeFactory.php b/db/factories/PrivilegeFactory.php index 25ef0bfe..5516b6b4 100644 --- a/db/factories/PrivilegeFactory.php +++ b/db/factories/PrivilegeFactory.php @@ -13,7 +13,7 @@ class PrivilegeFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->unique()->word(), diff --git a/db/factories/QuestionFactory.php b/db/factories/QuestionFactory.php index cac05b5a..406f28e6 100644 --- a/db/factories/QuestionFactory.php +++ b/db/factories/QuestionFactory.php @@ -15,7 +15,7 @@ class QuestionFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'user_id' => User::factory(), diff --git a/db/factories/RoomFactory.php b/db/factories/RoomFactory.php index a825816c..352b4489 100644 --- a/db/factories/RoomFactory.php +++ b/db/factories/RoomFactory.php @@ -13,7 +13,7 @@ class RoomFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->unique()->firstName(), diff --git a/db/factories/Shifts/ScheduleFactory.php b/db/factories/Shifts/ScheduleFactory.php index c918d23b..d9edbec5 100644 --- a/db/factories/Shifts/ScheduleFactory.php +++ b/db/factories/Shifts/ScheduleFactory.php @@ -13,7 +13,7 @@ class ScheduleFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->unique()->words(4, true), diff --git a/db/factories/User/ContactFactory.php b/db/factories/User/ContactFactory.php index 50557841..5772a22d 100644 --- a/db/factories/User/ContactFactory.php +++ b/db/factories/User/ContactFactory.php @@ -13,7 +13,7 @@ class ContactFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'dect' => $this->faker->optional()->numberBetween(1000, 9999), diff --git a/db/factories/User/LicenseFactory.php b/db/factories/User/LicenseFactory.php index 0d32f2fc..34627609 100644 --- a/db/factories/User/LicenseFactory.php +++ b/db/factories/User/LicenseFactory.php @@ -13,7 +13,7 @@ class LicenseFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { $drive_car = $this->faker->boolean(.8); $drive_3_5t = $drive_car && $this->faker->boolean(.7); diff --git a/db/factories/User/PasswordResetFactory.php b/db/factories/User/PasswordResetFactory.php index 42b290b6..f1fbc212 100644 --- a/db/factories/User/PasswordResetFactory.php +++ b/db/factories/User/PasswordResetFactory.php @@ -13,7 +13,7 @@ class PasswordResetFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'token' => bin2hex(random_bytes(16)), diff --git a/db/factories/User/PersonalDataFactory.php b/db/factories/User/PersonalDataFactory.php index ec3144ac..447a135e 100644 --- a/db/factories/User/PersonalDataFactory.php +++ b/db/factories/User/PersonalDataFactory.php @@ -14,7 +14,7 @@ class PersonalDataFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { $arrival = $this->faker->optional()->dateTimeThisMonth('2 weeks'); $departure = $this->faker->optional()->dateTimeThisMonth('2 weeks'); diff --git a/db/factories/User/SettingsFactory.php b/db/factories/User/SettingsFactory.php index d030ef1e..aefd3187 100644 --- a/db/factories/User/SettingsFactory.php +++ b/db/factories/User/SettingsFactory.php @@ -13,7 +13,7 @@ class SettingsFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'language' => $this->faker->locale(), diff --git a/db/factories/User/StateFactory.php b/db/factories/User/StateFactory.php index ca208066..d84c184c 100644 --- a/db/factories/User/StateFactory.php +++ b/db/factories/User/StateFactory.php @@ -14,7 +14,7 @@ class StateFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { $arrival = $this->faker->optional()->dateTimeThisMonth(); @@ -31,9 +31,8 @@ class StateFactory extends Factory /** * Indicate that the user is arrived * - * @return self */ - public function arrived() + public function arrived(): self { return $this->state( function (array $attributes) { diff --git a/db/factories/User/UserFactory.php b/db/factories/User/UserFactory.php index 0f211297..3db6801e 100644 --- a/db/factories/User/UserFactory.php +++ b/db/factories/User/UserFactory.php @@ -13,7 +13,7 @@ class UserFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->unique()->userName(), diff --git a/db/factories/WorklogFactory.php b/db/factories/WorklogFactory.php index cc0c7c11..3d073b03 100644 --- a/db/factories/WorklogFactory.php +++ b/db/factories/WorklogFactory.php @@ -14,7 +14,7 @@ class WorklogFactory extends Factory /** * @return array */ - public function definition() + public function definition(): array { return [ 'user_id' => User::factory(), 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 7f1619e3..21c617f7 100644 --- a/db/migrations/2018_01_01_000001_import_install_sql.php +++ b/db/migrations/2018_01_01_000001_import_install_sql.php @@ -31,7 +31,7 @@ class ImportInstallSql extends Migration /** * Run the migration */ - public function up() + public function up(): void { foreach ($this->oldTables as $table) { if ($this->schema->hasTable($table)) { @@ -47,7 +47,7 @@ class ImportInstallSql extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->getConnection()->statement('SET FOREIGN_KEY_CHECKS=0;'); diff --git a/db/migrations/2018_01_01_000002_import_update_sql.php b/db/migrations/2018_01_01_000002_import_update_sql.php index a08ea0c7..14bfa15b 100644 --- a/db/migrations/2018_01_01_000002_import_update_sql.php +++ b/db/migrations/2018_01_01_000002_import_update_sql.php @@ -9,7 +9,7 @@ class ImportUpdateSql extends Migration /** * Run the migration */ - public function up() + public function up(): void { if ($this->schema->hasTable('UserWorkLog')) { return; @@ -22,7 +22,7 @@ class ImportUpdateSql extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->dropIfExists('UserWorkLog'); } diff --git a/db/migrations/2018_01_01_000003_fix_old_tables.php b/db/migrations/2018_01_01_000003_fix_old_tables.php index 822846db..e20b7162 100644 --- a/db/migrations/2018_01_01_000003_fix_old_tables.php +++ b/db/migrations/2018_01_01_000003_fix_old_tables.php @@ -10,7 +10,7 @@ class FixOldTables extends Migration /** * Run the migration */ - public function up() + public function up(): void { $connection = $this->schema->getConnection(); @@ -29,7 +29,7 @@ class FixOldTables extends Migration ->where($column, '<', '0001-01-01 00:00:00') ->update([$column => '0001-01-01 00:00:00']); - $this->schema->table($table, function (Blueprint $table) use ($column) { + $this->schema->table($table, function (Blueprint $table) use ($column): void { $table->dateTime($column)->default('0001-01-01 00:00:00')->change(); }); } @@ -38,7 +38,7 @@ class FixOldTables extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { } } diff --git a/db/migrations/2018_01_01_000004_cleanup_group_privileges.php b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php index c453508a..62493b13 100644 --- a/db/migrations/2018_01_01_000004_cleanup_group_privileges.php +++ b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php @@ -9,7 +9,7 @@ class CleanupGroupPrivileges extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; @@ -43,7 +43,7 @@ class CleanupGroupPrivileges extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; 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 eef0575c..ceb9f474 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 @@ -15,7 +15,7 @@ class AddAngelSupporterPermissions extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; @@ -39,7 +39,7 @@ class AddAngelSupporterPermissions extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; @@ -52,10 +52,7 @@ class AddAngelSupporterPermissions extends Migration ); } - /** - * @return string - */ - protected function getQuery(string $type) + protected function getQuery(string $type): string { return sprintf(' %s FROM GroupPrivileges diff --git a/db/migrations/2018_08_30_000000_create_log_entries_table.php b/db/migrations/2018_08_30_000000_create_log_entries_table.php index 12bae831..676c7d7c 100644 --- a/db/migrations/2018_08_30_000000_create_log_entries_table.php +++ b/db/migrations/2018_08_30_000000_create_log_entries_table.php @@ -10,9 +10,9 @@ class CreateLogEntriesTable extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->create('log_entries', function (Blueprint $table) { + $this->schema->create('log_entries', function (Blueprint $table): void { $table->increments('id'); $table->string('level', 20); $table->text('message'); @@ -32,9 +32,9 @@ class CreateLogEntriesTable extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { - $this->schema->create('LogEntries', function (Blueprint $table) { + $this->schema->create('LogEntries', function (Blueprint $table): void { $table->increments('id'); $table->string('level', 20); $table->text('message'); diff --git a/db/migrations/2018_09_11_000000_create_sessions_table.php b/db/migrations/2018_09_11_000000_create_sessions_table.php index b96d18e9..c2207c36 100644 --- a/db/migrations/2018_09_11_000000_create_sessions_table.php +++ b/db/migrations/2018_09_11_000000_create_sessions_table.php @@ -10,9 +10,9 @@ class CreateSessionsTable extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->create('sessions', function (Blueprint $table) { + $this->schema->create('sessions', function (Blueprint $table): void { $table->string('id')->unique(); $table->text('payload'); $table->dateTime('last_activity')->useCurrent(); @@ -22,7 +22,7 @@ class CreateSessionsTable extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->dropIfExists('sessions'); } diff --git a/db/migrations/2018_09_24_000000_create_event_config_table.php b/db/migrations/2018_09_24_000000_create_event_config_table.php index dbd5ef7e..71501a30 100644 --- a/db/migrations/2018_09_24_000000_create_event_config_table.php +++ b/db/migrations/2018_09_24_000000_create_event_config_table.php @@ -20,11 +20,11 @@ class CreateEventConfigTable extends Migration /** * Run the migration */ - public function up() + public function up(): void { foreach (['json', 'text'] as $type) { try { - $this->schema->create('event_config', function (Blueprint $table) use ($type) { + $this->schema->create('event_config', function (Blueprint $table) use ($type): void { $table->string('name')->index()->unique(); $table->{$type}('value'); $table->timestamps(); @@ -69,11 +69,11 @@ class CreateEventConfigTable extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $connection = $this->schema->getConnection(); - $this->schema->create('EventConfig', function (Blueprint $table) { + $this->schema->create('EventConfig', function (Blueprint $table): void { $table->string('event_name')->nullable(); $table->integer('buildup_start_date')->nullable(); $table->integer('event_start_date')->nullable(); @@ -112,10 +112,7 @@ class CreateEventConfigTable extends Migration $this->schema->dropIfExists('event_config'); } - /** - * @return mixed|null - */ - protected function getConfigValue(Collection $config, string $name) + protected function getConfigValue(Collection $config, string $name): mixed { $value = $config->where('name', $name)->first('value', (object)['value' => null])->value; diff --git a/db/migrations/2018_10_01_000000_create_users_tables.php b/db/migrations/2018_10_01_000000_create_users_tables.php index 1f5352c2..936ea6ca 100644 --- a/db/migrations/2018_10_01_000000_create_users_tables.php +++ b/db/migrations/2018_10_01_000000_create_users_tables.php @@ -15,9 +15,9 @@ class CreateUsersTables extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->create('users', function (Blueprint $table) { + $this->schema->create('users', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 24)->unique(); @@ -29,7 +29,7 @@ class CreateUsersTables extends Migration $table->timestamps(); }); - $this->schema->create('users_personal_data', function (Blueprint $table) { + $this->schema->create('users_personal_data', function (Blueprint $table): void { $this->referencesUser($table, true); $table->string('first_name', 64)->nullable(); @@ -40,7 +40,7 @@ class CreateUsersTables extends Migration $table->date('planned_departure_date')->nullable(); }); - $this->schema->create('users_contact', function (Blueprint $table) { + $this->schema->create('users_contact', function (Blueprint $table): void { $this->referencesUser($table, true); $table->string('dect', 5)->nullable(); @@ -48,7 +48,7 @@ class CreateUsersTables extends Migration $table->string('email', 254)->nullable(); }); - $this->schema->create('users_settings', function (Blueprint $table) { + $this->schema->create('users_settings', function (Blueprint $table): void { $this->referencesUser($table, true); $table->string('language', 64); @@ -57,7 +57,7 @@ class CreateUsersTables extends Migration $table->boolean('email_shiftinfo')->default(false); }); - $this->schema->create('users_state', function (Blueprint $table) { + $this->schema->create('users_state', function (Blueprint $table): void { $this->referencesUser($table, true); $table->boolean('arrived')->default(false); @@ -68,7 +68,7 @@ class CreateUsersTables extends Migration $table->integer('got_voucher')->default(0); }); - $this->schema->create('password_resets', function (Blueprint $table) { + $this->schema->create('password_resets', function (Blueprint $table): void { $this->referencesUser($table, true); $table->text('token'); @@ -155,11 +155,11 @@ class CreateUsersTables extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $connection = $this->schema->getConnection(); - $this->schema->create('User', function (Blueprint $table) { + $this->schema->create('User', function (Blueprint $table): void { $table->integer('UID', true); $table->string('Nick', 23)->unique()->default(''); 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 0d38e107..aba6afec 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 @@ -16,7 +16,7 @@ class ChangeUsersContactDectFieldSize extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->changeDectTo(40); } @@ -24,19 +24,19 @@ class ChangeUsersContactDectFieldSize extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->changeDectTo(5); } - protected function changeDectTo(int $length) + protected function changeDectTo(int $length): void { foreach ($this->tables as $table => $column) { if (!$this->schema->hasTable($table)) { continue; } - $this->schema->table($table, function (Blueprint $table) use ($column, $length) { + $this->schema->table($table, function (Blueprint $table) use ($column, $length): void { $table->string($column, $length)->change(); }); } diff --git a/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php index 2527908e..2a86b651 100644 --- a/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php +++ b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php @@ -10,7 +10,7 @@ class FixMissingArrivalDates extends Migration /** * Run the migration */ - public function up() + public function up(): void { $connection = $this->schema->getConnection(); @@ -36,7 +36,7 @@ class FixMissingArrivalDates extends Migration /** * Down is not possible and not needed since this is a bugfix. */ - public function down() + public function down(): void { } } diff --git a/db/migrations/2019_06_12_000000_fix_user_languages.php b/db/migrations/2019_06_12_000000_fix_user_languages.php index c7d1474c..825d2fc7 100644 --- a/db/migrations/2019_06_12_000000_fix_user_languages.php +++ b/db/migrations/2019_06_12_000000_fix_user_languages.php @@ -9,7 +9,7 @@ class FixUserLanguages extends Migration /** * Run the migration */ - public function up() + public function up(): void { $connection = $this->schema->getConnection(); $connection @@ -22,7 +22,7 @@ class FixUserLanguages extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $connection = $this->schema->getConnection(); $connection diff --git a/db/migrations/2019_09_07_000000_migrate_admin_schedule_permissions.php b/db/migrations/2019_09_07_000000_migrate_admin_schedule_permissions.php index e39e22d8..ba157ef9 100644 --- a/db/migrations/2019_09_07_000000_migrate_admin_schedule_permissions.php +++ b/db/migrations/2019_09_07_000000_migrate_admin_schedule_permissions.php @@ -9,7 +9,7 @@ class MigrateAdminSchedulePermissions extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('Privileges')) { return; @@ -29,7 +29,7 @@ class MigrateAdminSchedulePermissions extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('Privileges')) { return; diff --git a/db/migrations/2019_09_07_000001_create_schedule_shift_table.php b/db/migrations/2019_09_07_000001_create_schedule_shift_table.php index c9cd7cfe..ead84855 100644 --- a/db/migrations/2019_09_07_000001_create_schedule_shift_table.php +++ b/db/migrations/2019_09_07_000001_create_schedule_shift_table.php @@ -12,11 +12,11 @@ class CreateScheduleShiftTable extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->create( 'schedules', - function (Blueprint $table) { + function (Blueprint $table): void { $table->increments('id'); $table->string('url'); } @@ -24,7 +24,7 @@ class CreateScheduleShiftTable extends Migration $this->schema->create( 'schedule_shift', - function (Blueprint $table) { + function (Blueprint $table): void { $table->integer('shift_id')->index()->unique(); if ($this->schema->hasTable('Shifts')) { // Legacy table access @@ -42,7 +42,7 @@ class CreateScheduleShiftTable extends Migration if ($this->schema->hasTable('Shifts')) { $this->schema->table( 'Shifts', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('PSID'); } ); @@ -51,7 +51,7 @@ class CreateScheduleShiftTable extends Migration if ($this->schema->hasTable('Room')) { $this->schema->table( 'Room', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('from_frab'); } ); @@ -61,12 +61,12 @@ class CreateScheduleShiftTable extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if ($this->schema->hasTable('Room')) { $this->schema->table( 'Room', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('from_frab') ->default(false); } @@ -76,7 +76,7 @@ class CreateScheduleShiftTable extends Migration if ($this->schema->hasTable('Shifts')) { $this->schema->table( 'Shifts', - function (Blueprint $table) { + function (Blueprint $table): void { $table->integer('PSID') ->nullable()->default(null) ->unique(); diff --git a/db/migrations/2019_10_15_000000_create_news_table.php b/db/migrations/2019_10_15_000000_create_news_table.php index 99448c5d..4cb9bca6 100644 --- a/db/migrations/2019_10_15_000000_create_news_table.php +++ b/db/migrations/2019_10_15_000000_create_news_table.php @@ -64,12 +64,9 @@ class CreateNewsTable extends Migration $this->schema->drop('new_news'); } - /** - * @return void - */ private function createNewNewsTable(): void { - $this->schema->create('news', function (Blueprint $table) { + $this->schema->create('news', function (Blueprint $table): void { $table->increments('id'); $table->string('title', 150); $table->text('text'); @@ -79,9 +76,6 @@ class CreateNewsTable extends Migration }); } - /** - * @return void - */ private function copyPreviousToNewNewsTable(): void { $connection = $this->schema->getConnection(); @@ -104,12 +98,9 @@ class CreateNewsTable extends Migration } } - /** - * @return void - */ private function createPreviousNewsTable(): void { - $this->schema->create('News', function (Blueprint $table) { + $this->schema->create('News', function (Blueprint $table): void { $table->increments('ID'); $table->integer('Datum'); $table->string('Betreff', 150) @@ -120,9 +111,6 @@ class CreateNewsTable extends Migration }); } - /** - * @return void - */ private function copyNewToPreviousNewsTable(): void { $connection = $this->schema->getConnection(); diff --git a/db/migrations/2019_11_12_000000_create_news_comments_table.php b/db/migrations/2019_11_12_000000_create_news_comments_table.php index 66a3b96a..8d108a8c 100644 --- a/db/migrations/2019_11_12_000000_create_news_comments_table.php +++ b/db/migrations/2019_11_12_000000_create_news_comments_table.php @@ -53,12 +53,9 @@ class CreateNewsCommentsTable extends Migration $this->schema->drop('news_comments'); } - /** - * @return void - */ private function createNewNewsCommentsTable(): void { - $this->schema->create('news_comments', function (Blueprint $table) { + $this->schema->create('news_comments', function (Blueprint $table): void { $table->increments('id'); $this->references($table, 'news', 'news_id'); $table->text('text'); @@ -67,9 +64,6 @@ class CreateNewsCommentsTable extends Migration }); } - /** - * @return void - */ private function copyPreviousToNewNewsCommentsTable(): void { $connection = $this->schema->getConnection(); @@ -90,12 +84,9 @@ class CreateNewsCommentsTable extends Migration } } - /** - * @return void - */ private function createPreviousNewsCommentsTable(): void { - $this->schema->create('NewsComments', function (Blueprint $table) { + $this->schema->create('NewsComments', function (Blueprint $table): void { $table->increments('ID'); $this->references($table, 'news', 'Refid'); $table->dateTime('Datum'); @@ -104,9 +95,6 @@ class CreateNewsCommentsTable extends Migration }); } - /** - * @return void - */ private function copyNewToPreviousNewsCommentsTable(): void { $connection = $this->schema->getConnection(); diff --git a/db/migrations/2019_11_25_000000_create_messages_table.php b/db/migrations/2019_11_25_000000_create_messages_table.php index ce1eee9c..118e31f6 100644 --- a/db/migrations/2019_11_25_000000_create_messages_table.php +++ b/db/migrations/2019_11_25_000000_create_messages_table.php @@ -64,14 +64,11 @@ class CreateMessagesTable extends Migration $this->schema->drop('new_messages'); } - /** - * @return void - */ private function createNewMessagesTable(): void { $this->schema->create( 'messages', - function (Blueprint $table) { + function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $this->references($table, 'users', 'receiver_id'); @@ -82,9 +79,6 @@ class CreateMessagesTable extends Migration ); } - /** - * @return void - */ private function copyPreviousToNewMessagesTable(): void { $connection = $this->schema->getConnection(); @@ -109,14 +103,11 @@ class CreateMessagesTable extends Migration } } - /** - * @return void - */ private function createPreviousMessagesTable(): void { $this->schema->create( 'Messages', - function (Blueprint $table) { + function (Blueprint $table): void { $table->increments('id'); $table->integer('Datum'); $this->references($table, 'users', 'SUID'); @@ -128,9 +119,6 @@ class CreateMessagesTable extends Migration ); } - /** - * @return void - */ private function copyNewToPreviousMessagesTable(): void { $connection = $this->schema->getConnection(); diff --git a/db/migrations/2019_11_29_000000_create_questions_table.php b/db/migrations/2019_11_29_000000_create_questions_table.php index f39965e4..6b28ae5b 100644 --- a/db/migrations/2019_11_29_000000_create_questions_table.php +++ b/db/migrations/2019_11_29_000000_create_questions_table.php @@ -17,9 +17,6 @@ class CreateQuestionsTable extends Migration use ChangesReferences; use Reference; - /** - * @return void - */ public function up(): void { $hasPreviousQuestionsTable = $this->schema->hasTable('Questions'); @@ -43,9 +40,6 @@ class CreateQuestionsTable extends Migration } } - /** - * @return void - */ public function down(): void { // Rename as some SQL DBMS handle identifiers case insensitive @@ -63,14 +57,11 @@ class CreateQuestionsTable extends Migration $this->schema->drop('new_questions'); } - /** - * @return void - */ private function createNewQuestionsTable(): void { $this->schema->create( 'questions', - function (Blueprint $table) { + function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $table->text('text'); @@ -82,9 +73,6 @@ class CreateQuestionsTable extends Migration ); } - /** - * @return void - */ private function copyPreviousToNewQuestionsTable(): void { $connection = $this->schema->getConnection(); @@ -104,14 +92,11 @@ class CreateQuestionsTable extends Migration } } - /** - * @return void - */ private function createPreviousQuestionsTable(): void { $this->schema->create( 'Questions', - function (Blueprint $table) { + function (Blueprint $table): void { $table->increments('QID'); $this->references($table, 'users', 'UID'); $table->text('Question'); @@ -123,9 +108,6 @@ class CreateQuestionsTable extends Migration ); } - /** - * @return void - */ private function copyNewToPreviousQuestionsTable(): void { $connection = $this->schema->getConnection(); diff --git a/db/migrations/2019_12_03_000000_user_personal_data_add_pronoun_field.php b/db/migrations/2019_12_03_000000_user_personal_data_add_pronoun_field.php index 3109c888..940466ef 100644 --- a/db/migrations/2019_12_03_000000_user_personal_data_add_pronoun_field.php +++ b/db/migrations/2019_12_03_000000_user_personal_data_add_pronoun_field.php @@ -14,7 +14,7 @@ class UserPersonalDataAddPronounField extends Migration */ public function up(): void { - $this->schema->table('users_personal_data', function (Blueprint $table) { + $this->schema->table('users_personal_data', function (Blueprint $table): void { $table->string('pronoun', 15) ->nullable() ->default(null) @@ -27,7 +27,7 @@ class UserPersonalDataAddPronounField extends Migration */ public function down(): void { - $this->schema->table('users_personal_data', function (Blueprint $table) { + $this->schema->table('users_personal_data', function (Blueprint $table): void { $table->dropColumn('pronoun'); }); } diff --git a/db/migrations/2020_09_02_000000_create_rooms_table.php b/db/migrations/2020_09_02_000000_create_rooms_table.php index ddc66235..c527d096 100644 --- a/db/migrations/2020_09_02_000000_create_rooms_table.php +++ b/db/migrations/2020_09_02_000000_create_rooms_table.php @@ -18,7 +18,7 @@ class CreateRoomsTable extends Migration */ public function up(): void { - $this->schema->create('rooms', function (Blueprint $table) { + $this->schema->create('rooms', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 35)->unique(); $table->string('map_url', 300)->nullable(); @@ -61,7 +61,7 @@ class CreateRoomsTable extends Migration { $connection = $this->schema->getConnection(); - $this->schema->create('Room', function (Blueprint $table) { + $this->schema->create('Room', function (Blueprint $table): void { $table->increments('RID'); $table->string('Name', 35)->unique(); $table->string('map_url', 300)->nullable(); diff --git a/db/migrations/2020_09_07_000000_create_worklogs_table.php b/db/migrations/2020_09_07_000000_create_worklogs_table.php index 193c1aa7..7a078e1e 100644 --- a/db/migrations/2020_09_07_000000_create_worklogs_table.php +++ b/db/migrations/2020_09_07_000000_create_worklogs_table.php @@ -19,7 +19,7 @@ class CreateWorklogsTable extends Migration */ public function up(): void { - $this->schema->create('worklogs', function (Blueprint $table) { + $this->schema->create('worklogs', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $this->references($table, 'users', 'creator_id'); @@ -70,7 +70,7 @@ class CreateWorklogsTable extends Migration { $connection = $this->schema->getConnection(); - $this->schema->create('UserWorkLog', function (Blueprint $table) { + $this->schema->create('UserWorkLog', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $table->integer('work_timestamp'); diff --git a/db/migrations/2020_09_12_000000_create_welcome_angel_permissions_group.php b/db/migrations/2020_09_12_000000_create_welcome_angel_permissions_group.php index 50a73360..766181f0 100644 --- a/db/migrations/2020_09_12_000000_create_welcome_angel_permissions_group.php +++ b/db/migrations/2020_09_12_000000_create_welcome_angel_permissions_group.php @@ -9,7 +9,7 @@ class CreateWelcomeAngelPermissionsGroup extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('Groups')) { return; @@ -38,7 +38,7 @@ class CreateWelcomeAngelPermissionsGroup extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('Groups')) { return; diff --git a/db/migrations/2020_09_27_000000_add_timestamps_to_questions.php b/db/migrations/2020_09_27_000000_add_timestamps_to_questions.php index 8cd8f55f..e5c0d5d8 100644 --- a/db/migrations/2020_09_27_000000_add_timestamps_to_questions.php +++ b/db/migrations/2020_09_27_000000_add_timestamps_to_questions.php @@ -18,7 +18,7 @@ class AddTimestampsToQuestions extends Migration $connection = $this->schema->getConnection(); $now = Carbon::now(); - $this->schema->table('questions', function (Blueprint $table) { + $this->schema->table('questions', function (Blueprint $table): void { $table->timestamp('answered_at')->after('answerer_id')->nullable(); $table->timestamps(); }); @@ -40,7 +40,7 @@ class AddTimestampsToQuestions extends Migration */ public function down(): void { - $this->schema->table('questions', function (Blueprint $table) { + $this->schema->table('questions', function (Blueprint $table): void { $table->dropColumn('answered_at'); $table->dropTimestamps(); }); diff --git a/db/migrations/2020_09_28_000000_create_faq_table_and_permissions.php b/db/migrations/2020_09_28_000000_create_faq_table_and_permissions.php index 730ea2dd..16394f6e 100644 --- a/db/migrations/2020_09_28_000000_create_faq_table_and_permissions.php +++ b/db/migrations/2020_09_28_000000_create_faq_table_and_permissions.php @@ -10,9 +10,9 @@ class CreateFaqTableAndPermissions extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->create('faq', function (Blueprint $table) { + $this->schema->create('faq', function (Blueprint $table): void { $table->increments('id'); $table->string('question'); $table->text('text'); @@ -46,7 +46,7 @@ class CreateFaqTableAndPermissions extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->drop('faq'); diff --git a/db/migrations/2020_09_30_000000_create_questions_permissions.php b/db/migrations/2020_09_30_000000_create_questions_permissions.php index 4c328351..06c22626 100644 --- a/db/migrations/2020_09_30_000000_create_questions_permissions.php +++ b/db/migrations/2020_09_30_000000_create_questions_permissions.php @@ -9,7 +9,7 @@ class CreateQuestionsPermissions extends Migration /** * Run the migration */ - public function up() + public function up(): void { if ($this->schema->hasTable('Privileges')) { $db = $this->schema->getConnection(); @@ -36,7 +36,7 @@ class CreateQuestionsPermissions extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('Privileges')) { return; diff --git a/db/migrations/2020_11_08_000000_create_oauth_table.php b/db/migrations/2020_11_08_000000_create_oauth_table.php index a6147836..96a82954 100644 --- a/db/migrations/2020_11_08_000000_create_oauth_table.php +++ b/db/migrations/2020_11_08_000000_create_oauth_table.php @@ -16,7 +16,7 @@ class CreateOauthTable extends Migration */ public function up(): void { - $this->schema->create('oauth', function (Blueprint $table) { + $this->schema->create('oauth', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $table->string('provider'); diff --git a/db/migrations/2020_11_20_000000_add_name_minutes_and_timestamps_to_schedules.php b/db/migrations/2020_11_20_000000_add_name_minutes_and_timestamps_to_schedules.php index e4a1b885..ccd6e3a5 100644 --- a/db/migrations/2020_11_20_000000_add_name_minutes_and_timestamps_to_schedules.php +++ b/db/migrations/2020_11_20_000000_add_name_minutes_and_timestamps_to_schedules.php @@ -13,13 +13,13 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration /** * Run the migration */ - public function up() + public function up(): void { $connection = $this->schema->getConnection(); $this->schema->table( 'schedules', - function (Blueprint $table) { + function (Blueprint $table): void { $table->string('name')->default('')->after('id'); $table->integer('shift_type')->default(0)->after('name'); $table->integer('minutes_before')->default(0)->after('shift_type'); @@ -37,7 +37,7 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration $this->schema->table( 'schedules', - function (Blueprint $table) { + function (Blueprint $table): void { $table->string('name')->default(null)->change(); $table->integer('shift_type')->default(null)->change(); $table->integer('minutes_before')->default(null)->change(); @@ -61,7 +61,7 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration $this->schema->table( 'schedules', - function (Blueprint $table) { + function (Blueprint $table): void { $this->addReference($table, 'shift_type', 'ShiftTypes'); } ); @@ -71,11 +71,11 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'schedules', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropForeign('schedules_shift_type_foreign'); $table->dropColumn('name'); $table->dropColumn('shift_type'); diff --git a/db/migrations/2020_12_25_000000_add_email_news_to_users_settings.php b/db/migrations/2020_12_25_000000_add_email_news_to_users_settings.php index 170d03ba..5c2a6a61 100644 --- a/db/migrations/2020_12_25_000000_add_email_news_to_users_settings.php +++ b/db/migrations/2020_12_25_000000_add_email_news_to_users_settings.php @@ -12,11 +12,11 @@ class AddEmailNewsToUsersSettings extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('email_news')->default(false)->after('email_shiftinfo'); } ); @@ -25,11 +25,11 @@ class AddEmailNewsToUsersSettings extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('email_news'); } ); diff --git a/db/migrations/2020_12_25_000000_oauth_add_tokens.php b/db/migrations/2020_12_25_000000_oauth_add_tokens.php index 0bbfa5df..4f502327 100644 --- a/db/migrations/2020_12_25_000000_oauth_add_tokens.php +++ b/db/migrations/2020_12_25_000000_oauth_add_tokens.php @@ -12,11 +12,11 @@ class OauthAddTokens extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'oauth', - function (Blueprint $table) { + function (Blueprint $table): void { $table->string('access_token')->nullable()->default(null)->after('identifier'); $table->string('refresh_token')->nullable()->default(null)->after('access_token'); $table->dateTime('expires_at')->nullable()->default(null)->after('refresh_token'); @@ -27,11 +27,11 @@ class OauthAddTokens extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'oauth', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('access_token'); $table->dropColumn('refresh_token'); $table->dropColumn('expires_at'); diff --git a/db/migrations/2020_12_26_000000_news_add_is_pinned.php b/db/migrations/2020_12_26_000000_news_add_is_pinned.php index 8c8c9f5e..30dd28e7 100644 --- a/db/migrations/2020_12_26_000000_news_add_is_pinned.php +++ b/db/migrations/2020_12_26_000000_news_add_is_pinned.php @@ -12,11 +12,11 @@ class NewsAddIsPinned extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'news', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('is_pinned')->default(false)->after('is_meeting'); } ); @@ -25,11 +25,11 @@ class NewsAddIsPinned extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'news', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('is_pinned'); } ); diff --git a/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php b/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php index e640d613..98f0dce6 100644 --- a/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php +++ b/db/migrations/2020_12_28_000001_oauth_change_tokens_to_text.php @@ -12,11 +12,11 @@ class OauthChangeTokensToText extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'oauth', - function (Blueprint $table) { + function (Blueprint $table): void { $table->text('access_token')->change(); $table->text('refresh_token')->change(); } @@ -26,11 +26,11 @@ class OauthChangeTokensToText extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'oauth', - function (Blueprint $table) { + function (Blueprint $table): void { $table->string('access_token')->change(); $table->string('refresh_token')->change(); } 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 21d0b63c..3c759161 100644 --- a/db/migrations/2021_05_23_000000_set_admin_password.php +++ b/db/migrations/2021_05_23_000000_set_admin_password.php @@ -28,7 +28,7 @@ class SetAdminPassword extends Migration /** * Run the migration */ - public function up() + public function up(): void { $admin = $this->auth->authenticate('admin', 'asdfasdf'); $setupPassword = $this->config->get('setup_admin_password'); diff --git a/db/migrations/2021_08_26_000000_add_shirt_edit_permissions.php b/db/migrations/2021_08_26_000000_add_shirt_edit_permissions.php index d4459a14..4c7d905e 100644 --- a/db/migrations/2021_08_26_000000_add_shirt_edit_permissions.php +++ b/db/migrations/2021_08_26_000000_add_shirt_edit_permissions.php @@ -9,7 +9,7 @@ class AddShirtEditPermissions extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; @@ -40,7 +40,7 @@ class AddShirtEditPermissions extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; diff --git a/db/migrations/2021_10_12_000000_add_shifts_description.php b/db/migrations/2021_10_12_000000_add_shifts_description.php index d061f3ee..c2ca9dfc 100644 --- a/db/migrations/2021_10_12_000000_add_shifts_description.php +++ b/db/migrations/2021_10_12_000000_add_shifts_description.php @@ -12,7 +12,7 @@ class AddShiftsDescription extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('Shifts')) { return; @@ -20,7 +20,7 @@ class AddShiftsDescription extends Migration $this->schema->table( 'Shifts', - function (Blueprint $table) { + function (Blueprint $table): void { $table->text('description')->nullable()->after('shifttype_id'); } ); @@ -29,7 +29,7 @@ class AddShiftsDescription extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('Shifts')) { return; @@ -37,7 +37,7 @@ class AddShiftsDescription extends Migration $this->schema->table( 'Shifts', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('description'); } ); diff --git a/db/migrations/2021_12_19_000000_create_user_licenses_table.php b/db/migrations/2021_12_19_000000_create_user_licenses_table.php index 0365fb08..0ed7cc79 100644 --- a/db/migrations/2021_12_19_000000_create_user_licenses_table.php +++ b/db/migrations/2021_12_19_000000_create_user_licenses_table.php @@ -16,7 +16,7 @@ class CreateUserLicensesTable extends Migration */ public function up(): void { - $this->schema->create('users_licenses', function (Blueprint $table) { + $this->schema->create('users_licenses', function (Blueprint $table): void { $this->referencesUser($table, true); $table->boolean('has_car')->default(false); $table->boolean('drive_forklift')->default(false); @@ -54,7 +54,7 @@ class CreateUserLicensesTable extends Migration */ public function down(): void { - $this->schema->create('UserDriverLicenses', function (Blueprint $table) { + $this->schema->create('UserDriverLicenses', function (Blueprint $table): void { $this->referencesUser($table, true); $table->boolean('has_car'); $table->boolean('has_license_car'); diff --git a/db/migrations/2021_12_25_000000_increase_sessions_table_payload_size.php b/db/migrations/2021_12_25_000000_increase_sessions_table_payload_size.php index cc50bac9..bb4c9599 100644 --- a/db/migrations/2021_12_25_000000_increase_sessions_table_payload_size.php +++ b/db/migrations/2021_12_25_000000_increase_sessions_table_payload_size.php @@ -10,9 +10,9 @@ class IncreaseSessionsTablePayloadSize extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->table('sessions', function (Blueprint $table) { + $this->schema->table('sessions', function (Blueprint $table): void { $table->mediumText('payload')->change(); }); } @@ -20,9 +20,9 @@ class IncreaseSessionsTablePayloadSize extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { - $this->schema->table('sessions', function (Blueprint $table) { + $this->schema->table('sessions', function (Blueprint $table): void { $table->text('payload')->change(); }); } diff --git a/db/migrations/2021_12_29_000000_users_settings_add_email_goody.php b/db/migrations/2021_12_29_000000_users_settings_add_email_goody.php index 16a7e2f5..a52e50ce 100644 --- a/db/migrations/2021_12_29_000000_users_settings_add_email_goody.php +++ b/db/migrations/2021_12_29_000000_users_settings_add_email_goody.php @@ -12,13 +12,13 @@ class UsersSettingsAddEmailGoody extends Migration /** * Run the migration */ - public function up() + public function up(): void { $connection = $this->schema->getConnection(); $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('email_goody')->default(false)->after('email_human'); } ); @@ -31,11 +31,11 @@ class UsersSettingsAddEmailGoody extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('email_goody'); } ); diff --git a/db/migrations/2021_12_30_000000_remove_admin_news_html_privilege.php b/db/migrations/2021_12_30_000000_remove_admin_news_html_privilege.php index 29cd7cbc..e2d74eca 100644 --- a/db/migrations/2021_12_30_000000_remove_admin_news_html_privilege.php +++ b/db/migrations/2021_12_30_000000_remove_admin_news_html_privilege.php @@ -9,7 +9,7 @@ class RemoveAdminNewsHtmlPrivilege extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; @@ -27,7 +27,7 @@ class RemoveAdminNewsHtmlPrivilege extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('GroupPrivileges')) { return; diff --git a/db/migrations/2022_05_23_000000_increase_tshirt_field_width.php b/db/migrations/2022_05_23_000000_increase_tshirt_field_width.php index 03a98d1a..10cbce38 100644 --- a/db/migrations/2022_05_23_000000_increase_tshirt_field_width.php +++ b/db/migrations/2022_05_23_000000_increase_tshirt_field_width.php @@ -13,9 +13,9 @@ class IncreaseTshirtFieldWidth extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->table('users_personal_data', function (Blueprint $table) { + $this->schema->table('users_personal_data', function (Blueprint $table): void { $table->string('shirt_size', 10)->change(); }); } @@ -23,9 +23,9 @@ class IncreaseTshirtFieldWidth extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { - $this->schema->table('users_personal_data', function (Blueprint $table) { + $this->schema->table('users_personal_data', function (Blueprint $table): void { $table->string('shirt_size', 4)->change(); }); } diff --git a/db/migrations/2022_06_02_000000_create_voucher_edit_permission.php b/db/migrations/2022_06_02_000000_create_voucher_edit_permission.php index 4a1d3d2b..f9ed7287 100644 --- a/db/migrations/2022_06_02_000000_create_voucher_edit_permission.php +++ b/db/migrations/2022_06_02_000000_create_voucher_edit_permission.php @@ -9,7 +9,7 @@ class CreateVoucherEditPermission extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('Privileges')) { return; @@ -36,7 +36,7 @@ class CreateVoucherEditPermission extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('Privileges')) { return; diff --git a/db/migrations/2022_06_03_000000_shifts_add_transaction_id.php b/db/migrations/2022_06_03_000000_shifts_add_transaction_id.php index 2e31c013..13c791b7 100644 --- a/db/migrations/2022_06_03_000000_shifts_add_transaction_id.php +++ b/db/migrations/2022_06_03_000000_shifts_add_transaction_id.php @@ -18,7 +18,7 @@ class ShiftsAddTransactionId extends Migration return; } - $this->schema->table('Shifts', function (Blueprint $table) { + $this->schema->table('Shifts', function (Blueprint $table): void { $table->uuid('transaction_id')->index()->nullable()->default(null); }); } @@ -32,7 +32,7 @@ class ShiftsAddTransactionId extends Migration return; } - $this->schema->table('Shifts', function (Blueprint $table) { + $this->schema->table('Shifts', function (Blueprint $table): void { $table->dropColumn('transaction_id'); }); } diff --git a/db/migrations/2022_07_21_000000_fix_old_groups_table_id_and_name.php b/db/migrations/2022_07_21_000000_fix_old_groups_table_id_and_name.php index 3b54bb2f..07e96d9f 100644 --- a/db/migrations/2022_07_21_000000_fix_old_groups_table_id_and_name.php +++ b/db/migrations/2022_07_21_000000_fix_old_groups_table_id_and_name.php @@ -32,7 +32,7 @@ class FixOldGroupsTableIdAndName extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->migrate($this->naming, $this->ids); } @@ -40,7 +40,7 @@ class FixOldGroupsTableIdAndName extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->migrate(array_flip($this->naming), array_flip($this->ids)); } @@ -49,7 +49,7 @@ class FixOldGroupsTableIdAndName extends Migration * @param string[] $naming * @param int[] $ids */ - protected function migrate(array $naming, array $ids) + protected function migrate(array $naming, array $ids): void { if (!$this->schema->hasTable('Groups')) { return; diff --git a/db/migrations/2022_10_16_000000_add_mobile_show_to_users_settings.php b/db/migrations/2022_10_16_000000_add_mobile_show_to_users_settings.php index 9e04f7df..66d2d72c 100644 --- a/db/migrations/2022_10_16_000000_add_mobile_show_to_users_settings.php +++ b/db/migrations/2022_10_16_000000_add_mobile_show_to_users_settings.php @@ -10,11 +10,11 @@ class AddMobileShowToUsersSettings extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('mobile_show')->default(false)->after('email_news'); } ); @@ -23,11 +23,11 @@ class AddMobileShowToUsersSettings extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'users_settings', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('mobile_show'); } ); diff --git a/db/migrations/2022_10_17_000000_add_dect_to_rooms.php b/db/migrations/2022_10_17_000000_add_dect_to_rooms.php index 1f28ef87..8717edf8 100644 --- a/db/migrations/2022_10_17_000000_add_dect_to_rooms.php +++ b/db/migrations/2022_10_17_000000_add_dect_to_rooms.php @@ -10,11 +10,11 @@ class AddDectToRooms extends Migration /** * Run the migration */ - public function up() + public function up(): void { $this->schema->table( 'rooms', - function (Blueprint $table) { + function (Blueprint $table): void { $table->text('dect')->nullable()->after('description'); } ); @@ -23,11 +23,11 @@ class AddDectToRooms extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->table( 'rooms', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('dect'); } ); diff --git a/db/migrations/2022_10_21_000000_add_hide_register_to_angeltypes.php b/db/migrations/2022_10_21_000000_add_hide_register_to_angeltypes.php index acc706f1..3174799a 100644 --- a/db/migrations/2022_10_21_000000_add_hide_register_to_angeltypes.php +++ b/db/migrations/2022_10_21_000000_add_hide_register_to_angeltypes.php @@ -10,7 +10,7 @@ class AddHideRegisterToAngeltypes extends Migration /** * Run the migration */ - public function up() + public function up(): void { if (!$this->schema->hasTable('AngelTypes')) { return; @@ -18,7 +18,7 @@ class AddHideRegisterToAngeltypes extends Migration $this->schema->table( 'AngelTypes', - function (Blueprint $table) { + function (Blueprint $table): void { $table->boolean('hide_register')->default(false)->after('show_on_dashboard'); } ); @@ -27,7 +27,7 @@ class AddHideRegisterToAngeltypes extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { if (!$this->schema->hasTable('AngelTypes')) { return; @@ -35,7 +35,7 @@ class AddHideRegisterToAngeltypes extends Migration $this->schema->table( 'AngelTypes', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropColumn('hide_register'); } ); diff --git a/db/migrations/2022_10_23_000000_create_privileges_and_groups_related_tables.php b/db/migrations/2022_10_23_000000_create_privileges_and_groups_related_tables.php index 38e993cb..07f6997b 100644 --- a/db/migrations/2022_10_23_000000_create_privileges_and_groups_related_tables.php +++ b/db/migrations/2022_10_23_000000_create_privileges_and_groups_related_tables.php @@ -108,59 +108,53 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration $this->schema->drop('privileges_new'); } - /** - * @return void - */ protected function createNew(): void { - $this->schema->create('groups', function (Blueprint $table) { + $this->schema->create('groups', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 35)->unique(); }); - $this->schema->create('privileges', function (Blueprint $table) { + $this->schema->create('privileges', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 128)->unique(); $table->string('description', 1024); }); - $this->schema->create('users_groups', function (Blueprint $table) { + $this->schema->create('users_groups', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table)->index(); $this->references($table, 'groups')->index(); }); - $this->schema->create('group_privileges', function (Blueprint $table) { + $this->schema->create('group_privileges', function (Blueprint $table): void { $table->increments('id'); $this->references($table, 'groups')->index(); $this->references($table, 'privileges')->index(); }); } - /** - * @return void - */ protected function createOldTable(): void { - $this->schema->create('Groups', function (Blueprint $table) { + $this->schema->create('Groups', function (Blueprint $table): void { $table->string('Name', 35); $table->integer('UID')->primary(); }); - $this->schema->create('Privileges', function (Blueprint $table) { + $this->schema->create('Privileges', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 128)->unique(); $table->string('desc', 1024); }); - $this->schema->create('UserGroups', function (Blueprint $table) { + $this->schema->create('UserGroups', function (Blueprint $table): void { $table->increments('id'); $this->references($table, 'users', 'uid'); $this->references($table, 'Groups', 'group_id', 'UID', false, 'integer')->index(); $table->index(['uid', 'group_id']); }); - $this->schema->create('GroupPrivileges', function (Blueprint $table) { + $this->schema->create('GroupPrivileges', function (Blueprint $table): void { $table->increments('id'); $this->references($table, 'Groups', 'group_id', 'UID', false, 'integer'); $this->references($table, 'Privileges', 'privilege_id')->index(); @@ -168,9 +162,6 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration }); } - /** - * @return void - */ protected function copyOldToNew(): void { $connection = $this->schema->getConnection(); @@ -220,9 +211,6 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration } } - /** - * @return void - */ protected function copyNewToOld(): void { $connection = $this->schema->getConnection(); diff --git a/db/migrations/2022_11_06_000000_shifttype_remove_angeltype.php b/db/migrations/2022_11_06_000000_shifttype_remove_angeltype.php index 916bbc89..56ebb370 100644 --- a/db/migrations/2022_11_06_000000_shifttype_remove_angeltype.php +++ b/db/migrations/2022_11_06_000000_shifttype_remove_angeltype.php @@ -20,7 +20,7 @@ class ShifttypeRemoveAngeltype extends Migration $this->schema->table( 'ShiftTypes', - function (Blueprint $table) { + function (Blueprint $table): void { $table->dropForeign('shifttypes_ibfk_1'); $table->dropColumn('angeltype_id'); } @@ -38,7 +38,7 @@ class ShifttypeRemoveAngeltype extends Migration $this->schema->table( 'ShiftTypes', - function (Blueprint $table) { + function (Blueprint $table): void { $table->integer('angeltype_id') ->after('name') ->index() diff --git a/db/migrations/2022_11_06_000001_create_shift_types_table.php b/db/migrations/2022_11_06_000001_create_shift_types_table.php index 2f5e3be0..7a211d08 100644 --- a/db/migrations/2022_11_06_000001_create_shift_types_table.php +++ b/db/migrations/2022_11_06_000001_create_shift_types_table.php @@ -18,7 +18,7 @@ class CreateShiftTypesTable extends Migration public function up(): void { $connection = $this->schema->getConnection(); - $this->schema->create('shift_types', function (Blueprint $table) { + $this->schema->create('shift_types', function (Blueprint $table): void { $table->increments('id'); $table->string('name')->unique(); $table->text('description'); @@ -56,7 +56,7 @@ class CreateShiftTypesTable extends Migration public function down(): void { $connection = $this->schema->getConnection(); - $this->schema->create('ShiftTypes', function (Blueprint $table) { + $this->schema->create('ShiftTypes', function (Blueprint $table): void { $table->increments('id'); $table->string('name', 255); $table->mediumText('description'); diff --git a/db/migrations/2022_11_08_000000_create_angel_types_table.php b/db/migrations/2022_11_08_000000_create_angel_types_table.php index 7783e0bc..724a656f 100644 --- a/db/migrations/2022_11_08_000000_create_angel_types_table.php +++ b/db/migrations/2022_11_08_000000_create_angel_types_table.php @@ -19,7 +19,7 @@ class CreateAngelTypesTable extends Migration public function up(): void { $connection = $this->schema->getConnection(); - $this->schema->create('angel_types', function (Blueprint $table) { + $this->schema->create('angel_types', function (Blueprint $table): void { $table->increments('id'); $table->string('name')->unique(); $table->text('description')->default(''); @@ -77,7 +77,7 @@ class CreateAngelTypesTable extends Migration public function down(): void { $connection = $this->schema->getConnection(); - $this->schema->create('AngelTypes', function (Blueprint $table) { + $this->schema->create('AngelTypes', function (Blueprint $table): void { $table->integer('id', true); $table->string('name', 50)->default('')->unique(); $table->boolean('restricted'); diff --git a/db/migrations/2022_11_28_000000_create_user_angel_types_table.php b/db/migrations/2022_11_28_000000_create_user_angel_types_table.php index 18fe9dbf..1d61853b 100644 --- a/db/migrations/2022_11_28_000000_create_user_angel_types_table.php +++ b/db/migrations/2022_11_28_000000_create_user_angel_types_table.php @@ -20,7 +20,7 @@ class CreateUserAngelTypesTable extends Migration { $connection = $this->schema->getConnection(); - $this->schema->create('user_angel_type', function (Blueprint $table) { + $this->schema->create('user_angel_type', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $this->references($table, 'angel_types')->index(); @@ -65,7 +65,7 @@ class CreateUserAngelTypesTable extends Migration { $connection = $this->schema->getConnection(); - $this->schema->create('UserAngelTypes', function (Blueprint $table) { + $this->schema->create('UserAngelTypes', function (Blueprint $table): void { $table->increments('id'); $this->referencesUser($table); $this->references($table, 'angel_types', 'angeltype_id')->index('angeltype_id'); diff --git a/db/migrations/2022_12_06_000000_change_api_key_length.php b/db/migrations/2022_12_06_000000_change_api_key_length.php index 95724d56..d5e811de 100644 --- a/db/migrations/2022_12_06_000000_change_api_key_length.php +++ b/db/migrations/2022_12_06_000000_change_api_key_length.php @@ -12,9 +12,9 @@ class ChangeApiKeyLength extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->table('users', function (Blueprint $table) { + $this->schema->table('users', function (Blueprint $table): void { $table->string('api_key', 64)->change(); }); } @@ -22,9 +22,9 @@ class ChangeApiKeyLength extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { - $this->schema->table('users', function (Blueprint $table) { + $this->schema->table('users', function (Blueprint $table): void { $table->string('api_key', 32)->change(); }); } diff --git a/db/migrations/ChangesReferences.php b/db/migrations/ChangesReferences.php index 5acb2999..e696a890 100644 --- a/db/migrations/ChangesReferences.php +++ b/db/migrations/ChangesReferences.php @@ -13,18 +13,18 @@ trait ChangesReferences string $targetTable, string $targetColumn, string $type = 'unsignedInteger' - ) { + ): void { $references = $this->getReferencingTables($fromTable, $fromColumn); foreach ($references as $reference) { /** @var stdClass $reference */ - $this->schema->table($reference->table, function (Blueprint $table) use ($reference) { + $this->schema->table($reference->table, function (Blueprint $table) use ($reference): void { $table->dropForeign($reference->constraint); }); $this->schema->table( $reference->table, - function (Blueprint $table) use ($reference, $targetTable, $targetColumn, $type) { + function (Blueprint $table) use ($reference, $targetTable, $targetColumn, $type): void { $table->{$type}($reference->column)->change(); $table->foreign($reference->column) diff --git a/db/migrations/Reference.php b/db/migrations/Reference.php index 39d1f9bd..c00a41c6 100644 --- a/db/migrations/Reference.php +++ b/db/migrations/Reference.php @@ -8,17 +8,11 @@ use Illuminate\Support\Str; trait Reference { - /** - * @return ColumnDefinition - */ protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition { return $this->references($table, 'users', null, null, $setPrimary); } - /** - * @return ColumnDefinition - */ protected function references( Blueprint $table, string $targetTable, diff --git a/src/Application.php b/src/Application.php index 66d14310..8885047d 100644 --- a/src/Application.php +++ b/src/Application.php @@ -41,7 +41,7 @@ class Application extends Container $this->registerBaseBindings(); } - protected function registerBaseBindings() + protected function registerBaseBindings(): void { static::setInstance($this); Container::setInstance($this); @@ -54,10 +54,7 @@ class Application extends Container $this->bind(ContainerInterface::class, self::class); } - /** - * @return ServiceProvider - */ - public function register(string|ServiceProvider $provider) + public function register(string|ServiceProvider $provider): ServiceProvider { if (is_string($provider)) { $provider = $this->make($provider); @@ -79,7 +76,7 @@ class Application extends Container * * @param Config|null $config */ - public function bootstrap(Config $config = null) + public function bootstrap(Config $config = null): void { if ($this->isBootstrapped) { return; @@ -100,7 +97,7 @@ class Application extends Container $this->isBootstrapped = true; } - protected function registerPaths() + protected function registerPaths(): void { $appPath = $this->appPath; @@ -124,7 +121,7 @@ class Application extends Container * * @return static */ - public function setAppPath(string $appPath) + public function setAppPath(string $appPath): static { $appPath = realpath($appPath); $appPath = rtrim($appPath, DIRECTORY_SEPARATOR); @@ -136,18 +133,12 @@ class Application extends Container return $this; } - /** - * @return string|null - */ - public function path() + public function path(): ?string { return $this->appPath; } - /** - * @return bool - */ - public function isBooted() + public function isBooted(): bool { return $this->isBootstrapped; } @@ -155,7 +146,7 @@ class Application extends Container /** * @return MiddlewareInterface[]|string[] */ - public function getMiddleware() + public function getMiddleware(): array { return $this->middleware; } diff --git a/src/Config/Config.php b/src/Config/Config.php index 2e1e926d..a71c2811 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -16,7 +16,7 @@ class Config extends Fluent /** * @param string|array $key */ - public function get(mixed $key, mixed $default = null) + public function get(mixed $key, mixed $default = null): mixed { if (is_null($key)) { return $this->attributes; @@ -32,7 +32,7 @@ class Config extends Fluent /** * @param string|array $key */ - public function set(mixed $key, mixed $value = null) + public function set(mixed $key, mixed $value = null): void { if (is_array($key)) { foreach ($key as $configKey => $configValue) { @@ -47,9 +47,8 @@ class Config extends Fluent /** * @param string $key - * @return bool */ - public function has(mixed $key) + public function has(mixed $key): bool { return $this->offsetExists($key); } @@ -57,7 +56,7 @@ class Config extends Fluent /** * @param string $key */ - public function remove(mixed $key) + public function remove(mixed $key): void { $this->offsetUnset($key); } diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php index eec26ab0..a9f24e7a 100644 --- a/src/Config/ConfigServiceProvider.php +++ b/src/Config/ConfigServiceProvider.php @@ -23,7 +23,7 @@ class ConfigServiceProvider extends ServiceProvider $this->eventConfig = $eventConfig; } - public function register() + public function register(): void { $config = $this->app->make(Config::class); $this->app->instance(Config::class, $config); @@ -48,7 +48,7 @@ class ConfigServiceProvider extends ServiceProvider } } - public function boot() + public function boot(): void { if (!$this->eventConfig) { return; @@ -80,7 +80,6 @@ class ConfigServiceProvider extends ServiceProvider /** * Get the config path * - * @return string */ protected function getConfigPath(string $path = ''): string { diff --git a/src/Container/ServiceProvider.php b/src/Container/ServiceProvider.php index 1cce32f6..a9304e17 100644 --- a/src/Container/ServiceProvider.php +++ b/src/Container/ServiceProvider.php @@ -21,14 +21,14 @@ abstract class ServiceProvider /** * Register container bindings */ - public function register() + public function register(): void { } /** * Called after other services had been registered */ - public function boot() + public function boot(): void { } } diff --git a/src/Controllers/Admin/FaqController.php b/src/Controllers/Admin/FaqController.php index fb339049..d2a48b8b 100644 --- a/src/Controllers/Admin/FaqController.php +++ b/src/Controllers/Admin/FaqController.php @@ -44,10 +44,6 @@ class FaqController extends BaseController $this->response = $response; } - /** - * - * @return Response - */ public function edit(Request $request): Response { $faqId = $request->getAttribute('faq_id'); // optional @@ -57,10 +53,6 @@ class FaqController extends BaseController return $this->showEdit($faq); } - /** - * - * @return Response - */ public function save(Request $request): Response { $faqId = $request->getAttribute('faq_id'); // optional @@ -101,10 +93,6 @@ class FaqController extends BaseController return $this->redirect->to('/faq#faq-' . $faq->id); } - /** - * - * @return Response - */ protected function showEdit(?Faq $faq): Response { return $this->response->withView( diff --git a/src/Controllers/Admin/LogsController.php b/src/Controllers/Admin/LogsController.php index e9ebee0b..7ccf1af6 100644 --- a/src/Controllers/Admin/LogsController.php +++ b/src/Controllers/Admin/LogsController.php @@ -26,9 +26,6 @@ class LogsController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function index(Request $request): Response { $search = $request->input('search'); diff --git a/src/Controllers/Admin/NewsController.php b/src/Controllers/Admin/NewsController.php index b08071e2..9977a550 100644 --- a/src/Controllers/Admin/NewsController.php +++ b/src/Controllers/Admin/NewsController.php @@ -49,10 +49,6 @@ class NewsController extends BaseController $this->response = $response; } - /** - * - * @return Response - */ public function edit(Request $request): Response { $newsId = $request->getAttribute('news_id'); // optional @@ -63,10 +59,6 @@ class NewsController extends BaseController return $this->showEdit($news, $isMeeting); } - /** - * - * @return Response - */ protected function showEdit(?News $news, bool $isMeetingDefault = false): Response { return $this->response->withView( @@ -79,10 +71,6 @@ class NewsController extends BaseController ); } - /** - * - * @return Response - */ public function save(Request $request): Response { $newsId = $request->getAttribute('news_id'); // optional diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php index 3a790e38..a4736028 100644 --- a/src/Controllers/Admin/QuestionsController.php +++ b/src/Controllers/Admin/QuestionsController.php @@ -51,9 +51,6 @@ class QuestionsController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function index(): Response { $questions = $this->question @@ -67,10 +64,6 @@ class QuestionsController extends BaseController ); } - /** - * - * @return Response - */ public function delete(Request $request): Response { $data = $this->validate($request, [ @@ -87,10 +80,6 @@ class QuestionsController extends BaseController return $this->redirect->to('/admin/questions'); } - /** - * - * @return Response - */ public function edit(Request $request): Response { $questionId = (int)$request->getAttribute('question_id'); @@ -100,10 +89,6 @@ class QuestionsController extends BaseController return $this->showEdit($questions); } - /** - * - * @return Response - */ public function save(Request $request): Response { $questionId = (int)$request->getAttribute('question_id'); @@ -149,10 +134,6 @@ class QuestionsController extends BaseController return $this->redirect->to('/admin/questions'); } - /** - * - * @return Response - */ protected function showEdit(?Question $question): Response { return $this->response->withView( diff --git a/src/Controllers/Admin/UserShirtController.php b/src/Controllers/Admin/UserShirtController.php index 08f27505..27052a06 100644 --- a/src/Controllers/Admin/UserShirtController.php +++ b/src/Controllers/Admin/UserShirtController.php @@ -56,10 +56,6 @@ class UserShirtController extends BaseController $this->user = $user; } - /** - * - * @return Response - */ public function editShirt(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); @@ -72,10 +68,6 @@ class UserShirtController extends BaseController ); } - /** - * - * @return Response - */ public function saveShirt(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php index 6930eb5f..ff0bcfeb 100644 --- a/src/Controllers/Admin/UserWorkLogController.php +++ b/src/Controllers/Admin/UserWorkLogController.php @@ -63,9 +63,6 @@ class UserWorkLogController extends BaseController $this->user = $user; } - /** - * @return Response - */ public function editWorklog(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); @@ -85,9 +82,6 @@ class UserWorkLogController extends BaseController } } - /** - * @return Response - */ public function saveWorklog(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); @@ -123,9 +117,6 @@ class UserWorkLogController extends BaseController // TODO Once User_view.php gets removed, change this to withView + getNotifications } - /** - * @return Response - */ public function showDeleteWorklog(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); @@ -144,9 +135,6 @@ class UserWorkLogController extends BaseController ); } - /** - * @return Response - */ public function deleteWorklog(Request $request): Response { $userId = (int)$request->getAttribute('user_id'); @@ -184,9 +172,6 @@ class UserWorkLogController extends BaseController ); } - /** - * @return Carbon - */ private function getWorkDateSuggestion(): Carbon { $buildup_start = config('buildup_start'); diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php index eeff8578..9d49782e 100644 --- a/src/Controllers/ApiController.php +++ b/src/Controllers/ApiController.php @@ -14,10 +14,7 @@ class ApiController extends BaseController $this->response = $response; } - /** - * @return Response - */ - public function index() + public function index(): Response { return $this->response ->setStatusCode(501) diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php index de9ee20a..14695050 100644 --- a/src/Controllers/AuthController.php +++ b/src/Controllers/AuthController.php @@ -50,17 +50,11 @@ class AuthController extends BaseController $this->auth = $auth; } - /** - * @return Response - */ public function login(): Response { return $this->showLogin(); } - /** - * @return Response - */ protected function showLogin(): Response { return $this->response->withView( @@ -72,7 +66,6 @@ class AuthController extends BaseController /** * Posted login form * - * @return Response */ public function postLogin(Request $request): Response { @@ -92,10 +85,6 @@ class AuthController extends BaseController return $this->loginUser($user); } - /** - * - * @return Response - */ public function loginUser(User $user): Response { $previousPage = $this->session->get('previous_page'); @@ -110,9 +99,6 @@ class AuthController extends BaseController return $this->redirect->to($previousPage ?: $this->config->get('home_site')); } - /** - * @return Response - */ public function logout(): Response { $this->session->invalidate(); diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index 655ed759..a557b1a1 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -16,7 +16,7 @@ abstract class BaseController * * @return string[]|string[][] */ - public function getPermissions() + public function getPermissions(): array { return $this->permissions; } diff --git a/src/Controllers/ChecksArrivalsAndDepartures.php b/src/Controllers/ChecksArrivalsAndDepartures.php index 6c58792c..5acbbfce 100644 --- a/src/Controllers/ChecksArrivalsAndDepartures.php +++ b/src/Controllers/ChecksArrivalsAndDepartures.php @@ -7,9 +7,6 @@ use DateTime; trait ChecksArrivalsAndDepartures { - /** - * @return bool - */ protected function isArrivalDateValid(?string $arrival, ?string $departure): bool { $arrival_carbon = $this->toCarbon($arrival); @@ -26,9 +23,6 @@ trait ChecksArrivalsAndDepartures return !$this->isBeforeBuildup($arrival_carbon) && !$this->isAfterTeardown($arrival_carbon); } - /** - * @return bool - */ protected function isDepartureDateValid(?string $arrival, ?string $departure): bool { $arrival_carbon = $this->toCarbon($arrival); diff --git a/src/Controllers/CreditsController.php b/src/Controllers/CreditsController.php index b57673ef..9315f92c 100644 --- a/src/Controllers/CreditsController.php +++ b/src/Controllers/CreditsController.php @@ -24,10 +24,7 @@ class CreditsController extends BaseController $this->version = $version; } - /** - * @return Response - */ - public function index() + public function index(): Response { return $this->response->withView( 'pages/credits.twig', diff --git a/src/Controllers/DesignController.php b/src/Controllers/DesignController.php index 6030000e..2268b4cf 100644 --- a/src/Controllers/DesignController.php +++ b/src/Controllers/DesignController.php @@ -26,9 +26,8 @@ class DesignController extends BaseController /** * Show the design overview page * - * @return Response */ - public function index() + public function index(): Response { $demoUser = (new User())->forceFill([ 'id' => 42, diff --git a/src/Controllers/FaqController.php b/src/Controllers/FaqController.php index b97dd297..b66f269c 100644 --- a/src/Controllers/FaqController.php +++ b/src/Controllers/FaqController.php @@ -34,9 +34,6 @@ class FaqController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function index(): Response { $text = $this->config->get('faq_text'); diff --git a/src/Controllers/HasUserNotifications.php b/src/Controllers/HasUserNotifications.php index 2e8e2f00..5e067dde 100644 --- a/src/Controllers/HasUserNotifications.php +++ b/src/Controllers/HasUserNotifications.php @@ -7,7 +7,7 @@ use Illuminate\Support\Collection; trait HasUserNotifications { - protected function addNotification(string|array $value, string $type = 'messages') + protected function addNotification(string|array $value, string $type = 'messages'): void { session()->set( $type, diff --git a/src/Controllers/HealthController.php b/src/Controllers/HealthController.php index 9a0614b9..d730aba9 100644 --- a/src/Controllers/HealthController.php +++ b/src/Controllers/HealthController.php @@ -14,9 +14,6 @@ class HealthController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function index(): Response { return $this->response->withContent('Ok'); diff --git a/src/Controllers/HomeController.php b/src/Controllers/HomeController.php index 87693907..df2646ee 100644 --- a/src/Controllers/HomeController.php +++ b/src/Controllers/HomeController.php @@ -25,9 +25,6 @@ class HomeController extends BaseController $this->redirect = $redirect; } - /** - * @return Response - */ public function index(): Response { return $this->redirect->to($this->auth->user() ? $this->config->get('home_site') : 'login'); diff --git a/src/Controllers/MessagesController.php b/src/Controllers/MessagesController.php index 5252f3eb..3b416d3b 100644 --- a/src/Controllers/MessagesController.php +++ b/src/Controllers/MessagesController.php @@ -59,9 +59,6 @@ class MessagesController extends BaseController $this->user = $user; } - /** - * @return Response - */ public function index(): Response { return $this->listConversations(); @@ -127,11 +124,11 @@ class MessagesController extends BaseController $otherUser = $this->user->findOrFail($userId); $messages = $this->message - ->where(function ($query) use ($currentUser, $otherUser) { + ->where(function ($query) use ($currentUser, $otherUser): void { $query->whereUserId($currentUser->id) ->whereReceiverId($otherUser->id); }) - ->orWhere(function ($query) use ($currentUser, $otherUser) { + ->orWhere(function ($query) use ($currentUser, $otherUser): void { $query->whereUserId($otherUser->id) ->whereReceiverId($currentUser->id); }) @@ -235,16 +232,13 @@ class MessagesController extends BaseController // then getting the full message objects for each ID. return $this->message - ->joinSub($latestMessageIds, 'conversations', function ($join) { + ->joinSub($latestMessageIds, 'conversations', function ($join): void { $join->on('messages.id', '=', 'conversations.last_id'); }) ->orderBy('created_at', 'DESC') ->get(); } - /** - * @return QueryExpression - */ protected function raw(mixed $value): QueryExpression { return $this->db->getConnection()->raw($value); diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php index e0a11de8..9865ffd8 100644 --- a/src/Controllers/Metrics/Controller.php +++ b/src/Controllers/Metrics/Controller.php @@ -47,10 +47,7 @@ class Controller extends BaseController $this->version = $version; } - /** - * @return Response - */ - public function metrics() + public function metrics(): Response { $now = microtime(true); $this->checkAuth(); @@ -212,10 +209,7 @@ class Controller extends BaseController ->withContent($this->engine->get('/metrics', $data)); } - /** - * @return Response - */ - public function stats() + public function stats(): Response { $this->checkAuth(true); @@ -235,7 +229,7 @@ class Controller extends BaseController * Ensure that the if the request is authorized * */ - protected function checkAuth(bool $isJson = false) + protected function checkAuth(bool $isJson = false): void { $apiKey = $this->config->get('api_key'); if (empty($apiKey) || $this->request->get('api_key') == $apiKey) { diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php index 1c49213f..dc5c2111 100644 --- a/src/Controllers/Metrics/MetricsEngine.php +++ b/src/Controllers/Metrics/MetricsEngine.php @@ -14,7 +14,6 @@ class MetricsEngine implements EngineInterface * * @param mixed[] $data * - * @return string * * @example $data = ['foo' => [['labels' => ['foo'=>'bar'], 'value'=>42]], 'bar'=>123] */ @@ -121,7 +120,6 @@ class MetricsEngine implements EngineInterface /** * - * @return string * @see https://prometheus.io/docs/instrumenting/exposition_formats/ */ protected function formatData(string $name, mixed $row): string @@ -152,11 +150,7 @@ class MetricsEngine implements EngineInterface return '{' . implode(',', $labels) . '}'; } - /** - * - * @return mixed - */ - protected function renderValue(mixed $row) + protected function renderValue(mixed $row): mixed { if (is_array($row)) { $row = array_pop($row); @@ -165,11 +159,7 @@ class MetricsEngine implements EngineInterface return $this->formatValue($row); } - /** - * - * @return mixed - */ - protected function formatValue(mixed $value) + protected function formatValue(mixed $value): mixed { if (is_bool($value)) { return (int)$value; @@ -178,11 +168,7 @@ class MetricsEngine implements EngineInterface return $this->escape($value); } - /** - * - * @return mixed - */ - protected function escape(mixed $value) + protected function escape(mixed $value): mixed { $replace = [ '\\' => '\\\\', @@ -197,10 +183,6 @@ class MetricsEngine implements EngineInterface ); } - /** - * - * @return bool - */ public function canRender(string $path): bool { return $path == '/metrics'; diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php index f893ddde..a5aaea42 100644 --- a/src/Controllers/Metrics/Stats.php +++ b/src/Controllers/Metrics/Stats.php @@ -23,6 +23,7 @@ use Engelsystem\Models\User\State; use Engelsystem\Models\User\User; use Engelsystem\Models\Worklog; use Illuminate\Contracts\Database\Query\Builder as BuilderContract; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Database\Query\Expression as QueryExpression; use Illuminate\Support\Collection; @@ -41,7 +42,6 @@ class Stats * The number of not arrived users * * @param bool|null $working - * @return int */ public function arrivedUsers(bool $working = null): int { @@ -54,7 +54,7 @@ class Stats ->leftJoin('ShiftEntry', 'ShiftEntry.UID', '=', 'users_state.user_id') ->distinct(); - $query->where(function ($query) use ($working) { + $query->where(function ($query) use ($working): void { /** @var QueryBuilder $query */ if ($working) { $query @@ -77,33 +77,22 @@ class Stats /** * The number of not arrived users * - * @return int */ public function newUsers(): int { return State::whereArrived(false)->count(); } - /** - * @return int - */ public function forceActiveUsers(): int { return State::whereForceActive(true)->count(); } - /** - * @return int - */ public function usersPronouns(): int { return PersonalData::where('pronoun', '!=', '')->count(); } - /** - * - * @return int - */ public function email(string $type): int { switch ($type) { @@ -130,7 +119,6 @@ class Stats * The number of currently working users * * @param bool|null $freeloaded - * @return int * @codeCoverageIgnore */ public function currentlyWorkingUsers(bool $freeloaded = null): int @@ -148,17 +136,11 @@ class Stats return $query->count(); } - /** - * @return QueryBuilder - */ - protected function vouchersQuery() + protected function vouchersQuery(): Builder { return State::query(); } - /** - * @return int - */ public function vouchers(): int { return (int)$this->vouchersQuery()->sum('got_voucher'); @@ -185,17 +167,11 @@ class Stats return $return; } - /** - * @return int - */ public function tshirts(): int { return State::whereGotShirt(true)->count(); } - /** - * @return Collection - */ public function tshirtSizes(): Collection { return PersonalData::query() @@ -205,9 +181,6 @@ class Stats ->get(); } - /** - * @return Collection - */ public function languages(): Collection { return Settings::query() @@ -216,9 +189,6 @@ class Stats ->get(); } - /** - * @return Collection - */ public function themes(): Collection { return Settings::query() @@ -229,7 +199,6 @@ class Stats /** * @param string|null $vehicle - * @return int */ public function licenses(string $vehicle): int { @@ -254,7 +223,6 @@ class Stats * @param bool|null $freeloaded * * @codeCoverageIgnore - * @return QueryBuilder */ protected function workSecondsQuery(bool $done = null, bool $freeloaded = null): QueryBuilder { @@ -279,7 +247,6 @@ class Stats * @param bool|null $done * @param bool|null $freeloaded * - * @return int * @codeCoverageIgnore */ public function workSeconds(bool $done = null, bool $freeloaded = null): int @@ -340,7 +307,6 @@ class Stats } /** - * @return int * @codeCoverageIgnore */ public function worklogSeconds(): int @@ -366,9 +332,6 @@ class Stats ); } - /** - * @return int - */ public function rooms(): int { return Room::query() @@ -376,7 +339,6 @@ class Stats } /** - * @return int * @codeCoverageIgnore */ public function shifts(): int @@ -388,7 +350,6 @@ class Stats /** * @param bool|null $meeting - * @return int */ public function announcements(bool $meeting = null): int { @@ -397,9 +358,6 @@ class Stats return $query->count(); } - /** - * @return int - */ public function comments(): int { return NewsComment::query() @@ -408,7 +366,6 @@ class Stats /** * @param bool|null $answered - * @return int */ public function questions(bool $answered = null): int { @@ -424,25 +381,16 @@ class Stats return $query->count(); } - /** - * @return int - */ public function faq(): int { return Faq::query()->count(); } - /** - * @return int - */ public function messages(): int { return Message::query()->count(); } - /** - * @return int - */ public function sessions(): int { return $this @@ -450,9 +398,6 @@ class Stats ->count(); } - /** - * @return Collection - */ public function oauth(): Collection { return OAuth::query() @@ -461,9 +406,6 @@ class Stats ->get(); } - /** - * @return float - */ public function databaseRead(): float { $start = microtime(true); @@ -473,9 +415,6 @@ class Stats return microtime(true) - $start; } - /** - * @return float - */ public function databaseWrite(): float { $config = (new EventConfig())->findOrNew('last_metrics'); @@ -492,7 +431,6 @@ class Stats /** * @param string|null $level - * @return int */ public function logEntries(string $level = null): int { @@ -501,17 +439,11 @@ class Stats return $query->count(); } - /** - * @return int - */ public function passwordResets(): int { return PasswordReset::query()->count(); } - /** - * @return QueryBuilder - */ protected function getQuery(string $table): QueryBuilder { return $this->db @@ -519,9 +451,6 @@ class Stats ->table($table); } - /** - * @return QueryExpression - */ protected function raw(mixed $value): QueryExpression { return $this->db->getConnection()->raw($value); diff --git a/src/Controllers/NewsController.php b/src/Controllers/NewsController.php index 450e6c18..ee1b5553 100644 --- a/src/Controllers/NewsController.php +++ b/src/Controllers/NewsController.php @@ -68,25 +68,16 @@ class NewsController extends BaseController $this->request = $request; } - /** - * @return Response - */ - public function index() + public function index(): Response { return $this->showOverview(); } - /** - * @return Response - */ public function meetings(): Response { return $this->showOverview(true); } - /** - * @return Response - */ public function show(Request $request): Response { $newsId = (int)$request->getAttribute('news_id'); @@ -99,9 +90,6 @@ class NewsController extends BaseController return $this->renderView('pages/news/news.twig', ['news' => $news]); } - /** - * @return Response - */ public function comment(Request $request): Response { $newsId = (int)$request->getAttribute('news_id'); @@ -131,10 +119,6 @@ class NewsController extends BaseController return $this->redirect->back(); } - /** - * - * @return Response - */ public function deleteComment(Request $request): Response { $commentId = (int)$request->getAttribute('comment_id'); @@ -166,9 +150,6 @@ class NewsController extends BaseController return $this->redirect->to('/news/' . $comment->news->id); } - /** - * @return Response - */ protected function showOverview(bool $onlyMeetings = false): Response { $query = $this->news; @@ -203,7 +184,6 @@ class NewsController extends BaseController /** * @param array $data - * @return Response */ protected function renderView(string $page, array $data): Response { diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index 16a83299..dfc52f60 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -69,10 +69,6 @@ class OAuthController extends BaseController $this->url = $url; } - /** - * - * @return Response - */ public function index(Request $request): Response { $providerName = $request->getAttribute('provider'); @@ -201,10 +197,6 @@ class OAuthController extends BaseController return $response; } - /** - * - * @return Response - */ public function connect(Request $request): Response { $providerName = $request->getAttribute('provider'); @@ -216,10 +208,6 @@ class OAuthController extends BaseController return $this->index($request); } - /** - * - * @return Response - */ public function disconnect(Request $request): Response { $providerName = $request->getAttribute('provider'); @@ -235,10 +223,6 @@ class OAuthController extends BaseController return $this->redirector->back(); } - /** - * - * @return AbstractProvider - */ protected function getProvider(string $name): AbstractProvider { $this->requireProvider($name); @@ -257,10 +241,7 @@ class OAuthController extends BaseController ); } - /** - * @return mixed - */ - protected function getId(string $providerName, ResourceOwner $resourceOwner) + protected function getId(string $providerName, ResourceOwner $resourceOwner): mixed { $config = $this->config->get('oauth')[$providerName]; if (empty($config['nested_info'])) { @@ -278,10 +259,6 @@ class OAuthController extends BaseController } } - /** - * - * @return bool - */ protected function isValidProvider(string $name): bool { $config = $this->config->get('oauth'); @@ -339,7 +316,6 @@ class OAuthController extends BaseController /** * @param array $config * - * @return Response */ protected function redirectRegister( string $providerName, diff --git a/src/Controllers/PasswordResetController.php b/src/Controllers/PasswordResetController.php index 02e5bcee..6c21add0 100644 --- a/src/Controllers/PasswordResetController.php +++ b/src/Controllers/PasswordResetController.php @@ -47,17 +47,11 @@ class PasswordResetController extends BaseController $this->session = $session; } - /** - * @return Response - */ public function reset(): Response { return $this->showView('pages/password/reset'); } - /** - * @return Response - */ public function postReset(Request $request): Response { $data = $this->validate($request, [ @@ -88,9 +82,6 @@ class PasswordResetController extends BaseController return $this->showView('pages/password/reset-success', ['type' => 'email']); } - /** - * @return Response - */ public function resetPassword(Request $request): Response { $this->requireToken($request); @@ -101,9 +92,6 @@ class PasswordResetController extends BaseController ); } - /** - * @return Response - */ public function postResetPassword(Request $request): Response { $reset = $this->requireToken($request); @@ -127,7 +115,6 @@ class PasswordResetController extends BaseController /** * @param array $data - * @return Response */ protected function showView(string $view = 'pages/password/reset', array $data = []): Response { @@ -137,9 +124,6 @@ class PasswordResetController extends BaseController ); } - /** - * @return PasswordReset - */ protected function requireToken(Request $request): PasswordReset { $token = $request->getAttribute('token'); diff --git a/src/Controllers/QuestionsController.php b/src/Controllers/QuestionsController.php index 1f7714db..555dc1bf 100644 --- a/src/Controllers/QuestionsController.php +++ b/src/Controllers/QuestionsController.php @@ -48,9 +48,6 @@ class QuestionsController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function index(): Response { $questions = $this->question @@ -65,9 +62,6 @@ class QuestionsController extends BaseController ); } - /** - * @return Response - */ public function add(): Response { return $this->response->withView( @@ -76,10 +70,6 @@ class QuestionsController extends BaseController ); } - /** - * - * @return Response - */ public function delete(Request $request): Response { $data = $this->validate( @@ -103,10 +93,6 @@ class QuestionsController extends BaseController return $this->redirect->to('/questions'); } - /** - * - * @return Response - */ public function save(Request $request): Response { $data = $this->validate( diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index 28d9bcba..fd44e13b 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -49,9 +49,6 @@ class SettingsController extends BaseController $this->response = $response; } - /** - * @return Response - */ public function profile(): Response { $user = $this->auth->user(); @@ -65,9 +62,6 @@ class SettingsController extends BaseController ); } - /** - * @return Response - */ public function saveProfile(Request $request): Response { $user = $this->auth->user(); @@ -128,9 +122,6 @@ class SettingsController extends BaseController return $this->redirect->to('/settings/profile'); } - /** - * @return Response - */ public function password(): Response { return $this->response->withView( @@ -142,9 +133,6 @@ class SettingsController extends BaseController ); } - /** - * @return Response - */ public function savePassword(Request $request): Response { $user = $this->auth->user(); @@ -170,9 +158,6 @@ class SettingsController extends BaseController return $this->redirect->to('/settings/password'); } - /** - * @return Response - */ public function theme(): Response { $themes = array_map(function ($theme) { @@ -191,9 +176,6 @@ class SettingsController extends BaseController ); } - /** - * @return Response - */ public function saveTheme(Request $request): Response { $user = $this->auth->user(); @@ -212,9 +194,6 @@ class SettingsController extends BaseController return $this->redirect->to('/settings/theme'); } - /** - * @return Response - */ public function language(): Response { $languages = config('locales'); @@ -231,9 +210,6 @@ class SettingsController extends BaseController ); } - /** - * @return Response - */ public function saveLanguage(Request $request): Response { $user = $this->auth->user(); @@ -254,9 +230,6 @@ class SettingsController extends BaseController return $this->redirect->to('/settings/language'); } - /** - * @return Response - */ public function oauth(): Response { $providers = $this->config->get('oauth'); @@ -292,9 +265,6 @@ class SettingsController extends BaseController return $menu; } - /** - * @return bool - */ protected function checkOauthHidden(): bool { foreach (config('oauth') as $config) { diff --git a/src/Database/Database.php b/src/Database/Database.php index cc6a31cd..ca1d5ded 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -21,7 +21,7 @@ class Database * @param array $bindings * @return object[] */ - public function select(string $query, array $bindings = []) + public function select(string $query, array $bindings = []): array { return $this->connection->select($query, $bindings); } @@ -30,9 +30,8 @@ class Database * Run a select query and return only the first result or null if no result is found. * * @param array $bindings - * @return object|null */ - public function selectOne(string $query, array $bindings = []) + public function selectOne(string $query, array $bindings = []): ?object { return $this->connection->selectOne($query, $bindings); } @@ -41,9 +40,8 @@ class Database * Run an insert query * * @param array $bindings - * @return bool */ - public function insert(string $query, array $bindings = []) + public function insert(string $query, array $bindings = []): bool { return $this->connection->insert($query, $bindings); } @@ -52,9 +50,8 @@ class Database * Run an update query * * @param array $bindings - * @return int */ - public function update(string $query, array $bindings = []) + public function update(string $query, array $bindings = []): int { return $this->connection->update($query, $bindings); } @@ -63,9 +60,8 @@ class Database * Run a delete query * * @param array $bindings - * @return int */ - public function delete(string $query, array $bindings = []) + public function delete(string $query, array $bindings = []): int { return $this->connection->delete($query, $bindings); } @@ -73,17 +69,13 @@ class Database /** * Get the PDO instance * - * @return PDO */ - public function getPdo() + public function getPdo(): PDO { return $this->connection->getPdo(); } - /** - * @return DatabaseConnection - */ - public function getConnection() + public function getConnection(): DatabaseConnection { return $this->connection; } diff --git a/src/Database/DatabaseServiceProvider.php b/src/Database/DatabaseServiceProvider.php index 60ed9386..bd923f19 100644 --- a/src/Database/DatabaseServiceProvider.php +++ b/src/Database/DatabaseServiceProvider.php @@ -12,7 +12,7 @@ use Throwable; class DatabaseServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $config = $this->app->get('config'); $capsule = $this->app->make(CapsuleManager::class); @@ -60,7 +60,7 @@ class DatabaseServiceProvider extends ServiceProvider * * @throws Exception */ - protected function exitOnError(Throwable $exception) + protected function exitOnError(Throwable $exception): void { throw new Exception('Error: Unable to connect to database', 0, $exception); } diff --git a/src/Database/Db.php b/src/Database/Db.php index 1bdc84ee..240ef48a 100644 --- a/src/Database/Db.php +++ b/src/Database/Db.php @@ -16,7 +16,7 @@ class Db * Set the database connection manager * */ - public static function setDbManager(CapsuleManager $dbManager) + public static function setDbManager(CapsuleManager $dbManager): void { self::$dbManager = $dbManager; } @@ -27,7 +27,7 @@ class Db * @param array $bindings * @return array[] */ - public static function select(string $query, array $bindings = []) + public static function select(string $query, array $bindings = []): array { $return = self::connection()->select($query, $bindings); @@ -45,7 +45,7 @@ class Db * @param array $bindings * @return array|null */ - public static function selectOne(string $query, array $bindings = []) + public static function selectOne(string $query, array $bindings = []): ?array { $result = self::connection()->selectOne($query, $bindings); @@ -62,9 +62,8 @@ class Db * Run an insert query * * @param array $bindings - * @return bool */ - public static function insert(string $query, array $bindings = []) + public static function insert(string $query, array $bindings = []): bool { return self::connection()->insert($query, $bindings); } @@ -73,9 +72,8 @@ class Db * Run an update query * * @param array $bindings - * @return int */ - public static function update(string $query, array $bindings = []) + public static function update(string $query, array $bindings = []): int { return self::connection()->update($query, $bindings); } @@ -84,17 +82,13 @@ class Db * Run a delete query * * @param array $bindings - * @return int */ - public static function delete(string $query, array $bindings = []) + public static function delete(string $query, array $bindings = []): int { return self::connection()->delete($query, $bindings); } - /** - * @return DatabaseConnection - */ - public static function connection() + public static function connection(): DatabaseConnection { return self::$dbManager->getConnection(); } @@ -102,9 +96,8 @@ class Db /** * Get the PDO instance * - * @return PDO */ - public static function getPdo() + public static function getPdo(): PDO { return self::connection()->getPdo(); } diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php index 51d8fb00..b70ad3cc 100644 --- a/src/Database/Migration/Migrate.php +++ b/src/Database/Migration/Migrate.php @@ -39,7 +39,7 @@ class Migrate { $this->app = $app; $this->schema = $schema; - $this->output = function () { + $this->output = function (): void { }; } @@ -48,8 +48,12 @@ class Migrate * * @param string $type (up|down) */ - public function run(string $path, string $type = self::UP, bool $oneStep = false, bool $forceMigration = false) - { + public function run( + string $path, + string $type = self::UP, + bool $oneStep = false, + bool $forceMigration = false + ): void { $this->initMigration(); $this->lockTable($forceMigration); @@ -98,13 +102,13 @@ class Migrate /** * Setup migration tables */ - public function initMigration() + public function initMigration(): void { if ($this->schema->hasTable($this->table)) { return; } - $this->schema->create($this->table, function (Blueprint $table) { + $this->schema->create($this->table, function (Blueprint $table): void { $table->increments('id'); $table->string('migration'); }); @@ -113,9 +117,8 @@ class Migrate /** * Merge file migrations with already migrated tables * - * @return Collection */ - protected function mergeMigrations(Collection $migrations, Collection $migrated) + protected function mergeMigrations(Collection $migrations, Collection $migrated): Collection { $return = $migrated; $return->transform(function ($migration) use ($migrations) { @@ -129,7 +132,7 @@ class Migrate return $migration; }); - $migrations->each(function ($migration) use ($return) { + $migrations->each(function ($migration) use ($return): void { if ($return->contains('migration', $migration['migration'])) { return; } @@ -143,9 +146,8 @@ class Migrate /** * Get all migrated migrations * - * @return Collection */ - protected function getMigrated() + protected function getMigrated(): Collection { return $this->getTableQuery() ->orderBy('id') @@ -158,7 +160,7 @@ class Migrate * * @param string $type (up|down) */ - protected function migrate(string $file, string $migration, string $type = self::UP) + protected function migrate(string $file, string $migration, string $type = self::UP): void { require_once $file; @@ -176,7 +178,7 @@ class Migrate * * @param string $type (up|down) */ - protected function setMigrated(string $migration, string $type = self::UP) + protected function setMigrated(string $migration, string $type = self::UP): void { $table = $this->getTableQuery(); @@ -194,9 +196,9 @@ class Migrate * * @throws Throwable */ - protected function lockTable(bool $forceMigration = false) + protected function lockTable(bool $forceMigration = false): void { - $this->schema->getConnection()->transaction(function () use ($forceMigration) { + $this->schema->getConnection()->transaction(function () use ($forceMigration): void { $lock = $this->getTableQuery() ->where('migration', 'lock') ->lockForUpdate() @@ -214,7 +216,7 @@ class Migrate /** * Unlock a previously locked table */ - protected function unlockTable() + protected function unlockTable(): void { $this->getTableQuery() ->where('migration', 'lock') @@ -225,9 +227,8 @@ class Migrate * Get a list of migration files * * - * @return Collection */ - protected function getMigrations(string $dir) + protected function getMigrations(string $dir): Collection { $files = $this->getMigrationFiles($dir); @@ -251,7 +252,7 @@ class Migrate * * @return array */ - protected function getMigrationFiles(string $dir) + protected function getMigrationFiles(string $dir): array { return glob($dir . '/*_*.php'); } @@ -259,9 +260,8 @@ class Migrate /** * Init a table query * - * @return Builder */ - protected function getTableQuery() + protected function getTableQuery(): Builder { return $this->schema->getConnection()->table($this->table); } @@ -270,7 +270,7 @@ class Migrate * Set the output function * */ - public function setOutput(callable $output) + public function setOutput(callable $output): void { $this->output = $output; } diff --git a/src/Database/Migration/MigrationServiceProvider.php b/src/Database/Migration/MigrationServiceProvider.php index 310b2114..3ba86658 100644 --- a/src/Database/Migration/MigrationServiceProvider.php +++ b/src/Database/Migration/MigrationServiceProvider.php @@ -8,7 +8,7 @@ use Illuminate\Database\Schema\Builder as SchemaBuilder; class MigrationServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var Database $database */ $database = $this->app->get(Database::class); diff --git a/src/Events/EventDispatcher.php b/src/Events/EventDispatcher.php index 8db55a6e..e18f2a43 100644 --- a/src/Events/EventDispatcher.php +++ b/src/Events/EventDispatcher.php @@ -22,11 +22,7 @@ class EventDispatcher unset($this->listeners[$event]); } - /** - * - * @return array|mixed|null - */ - public function fire(string|object $event, mixed $payload = [], bool $halt = false) + public function fire(string|object $event, mixed $payload = [], bool $halt = false): mixed { return $this->dispatch($event, $payload, $halt); } @@ -34,9 +30,8 @@ class EventDispatcher /** * @param bool $halt Stop on first non-null return * - * @return array|null|mixed */ - public function dispatch(string|object $event, mixed $payload = [], bool $halt = false) + public function dispatch(string|object $event, mixed $payload = [], bool $halt = false): mixed { if (is_object($event)) { $payload = $event; diff --git a/src/Events/EventsServiceProvider.php b/src/Events/EventsServiceProvider.php index 9eb05dc1..b324a101 100644 --- a/src/Events/EventsServiceProvider.php +++ b/src/Events/EventsServiceProvider.php @@ -7,7 +7,7 @@ use Engelsystem\Container\ServiceProvider; class EventsServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $dispatcher = $this->app->make(EventDispatcher::class); @@ -17,7 +17,7 @@ class EventsServiceProvider extends ServiceProvider $this->registerEvents($dispatcher); } - protected function registerEvents(EventDispatcher $dispatcher) + protected function registerEvents(EventDispatcher $dispatcher): void { /** @var Config $config */ $config = $this->app->get('config'); diff --git a/src/Events/Listener/News.php b/src/Events/Listener/News.php index e5590f15..f4177f3c 100644 --- a/src/Events/Listener/News.php +++ b/src/Events/Listener/News.php @@ -31,7 +31,7 @@ class News $this->settings = $settings; } - public function created(NewsModel $news) + public function created(NewsModel $news): void { /** @var UserSettings[]|Collection $recipients */ $recipients = $this->settings @@ -44,7 +44,7 @@ class News } } - protected function sendMail(NewsModel $news, User $user, string $subject, string $template) + protected function sendMail(NewsModel $news, User $user, string $subject, string $template): void { try { $this->mailer->sendViewTranslated( diff --git a/src/Events/Listener/OAuth2.php b/src/Events/Listener/OAuth2.php index 06d94fcd..2a773a27 100644 --- a/src/Events/Listener/OAuth2.php +++ b/src/Events/Listener/OAuth2.php @@ -64,7 +64,7 @@ class OAuth2 return $teams; } - protected function syncTeams(string $providerName, User $user, array $ssoTeam) + protected function syncTeams(string $providerName, User $user, array $ssoTeam): void { $currentUserAngeltypes = $user->userAngelTypes; $angelType = AngelType::find($ssoTeam['id']); diff --git a/src/Exceptions/ExceptionsServiceProvider.php b/src/Exceptions/ExceptionsServiceProvider.php index 6cf6f014..86179e42 100644 --- a/src/Exceptions/ExceptionsServiceProvider.php +++ b/src/Exceptions/ExceptionsServiceProvider.php @@ -12,7 +12,7 @@ use Whoops\Run as WhoopsRunner; class ExceptionsServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $errorHandler = $this->app->make(Handler::class); $this->addProductionHandler($errorHandler); @@ -22,7 +22,7 @@ class ExceptionsServiceProvider extends ServiceProvider $errorHandler->register(); } - public function boot() + public function boot(): void { /** @var Handler $handler */ $handler = $this->app->get('error.handler'); @@ -32,7 +32,7 @@ class ExceptionsServiceProvider extends ServiceProvider $this->addLogger($handler); } - protected function addProductionHandler(Handler $errorHandler) + protected function addProductionHandler(Handler $errorHandler): void { $handler = $this->app->make(Legacy::class); $this->app->instance('error.handler.production', $handler); @@ -40,7 +40,7 @@ class ExceptionsServiceProvider extends ServiceProvider $this->app->bind(HandlerInterface::class, 'error.handler.production'); } - protected function addDevelopmentHandler(Handler $errorHandler) + protected function addDevelopmentHandler(Handler $errorHandler): void { $handler = $this->app->make(LegacyDevelopment::class); @@ -52,7 +52,7 @@ class ExceptionsServiceProvider extends ServiceProvider $errorHandler->setHandler(Handler::ENV_DEVELOPMENT, $handler); } - protected function addLogger(Handler $handler) + protected function addLogger(Handler $handler): void { foreach ($handler->getHandler() as $h) { if (!method_exists($h, 'setLogger')) { diff --git a/src/Exceptions/Handler.php b/src/Exceptions/Handler.php index 323bddb6..c5598ec9 100644 --- a/src/Exceptions/Handler.php +++ b/src/Exceptions/Handler.php @@ -38,22 +38,19 @@ class Handler /** * Activate the error handler */ - public function register() + public function register(): void { set_error_handler([$this, 'errorHandler']); set_exception_handler([$this, 'exceptionHandler']); } - public function errorHandler(int $number, string $message, string $file, int $line) + public function errorHandler(int $number, string $message, string $file, int $line): void { $exception = new ErrorException($message, 0, $number, $file, $line); $this->exceptionHandler($exception); } - /** - * @return string - */ - public function exceptionHandler(Throwable $e, bool $return = false) + public function exceptionHandler(Throwable $e, bool $return = false): string { if (!$this->request instanceof Request) { $this->request = new Request(); @@ -83,21 +80,18 @@ class Handler * * @codeCoverageIgnore */ - protected function terminateApplicationImmediately(string $message = '') + protected function terminateApplicationImmediately(string $message = ''): void { echo $message; die(1); } - /** - * @return string - */ - public function getEnvironment() + public function getEnvironment(): string { return $this->environment; } - public function setEnvironment(string $environment) + public function setEnvironment(string $environment): void { $this->environment = $environment; } @@ -105,7 +99,7 @@ class Handler /** * @return HandlerInterface|HandlerInterface[] */ - public function getHandler(string $environment = null) + public function getHandler(string $environment = null): HandlerInterface|array { if (!is_null($environment)) { return $this->handler[$environment]; @@ -114,20 +108,17 @@ class Handler return $this->handler; } - public function setHandler(string $environment, HandlerInterface $handler) + public function setHandler(string $environment, HandlerInterface $handler): void { $this->handler[$environment] = $handler; } - /** - * @return Request - */ - public function getRequest() + public function getRequest(): Request { return $this->request; } - public function setRequest(Request $request) + public function setRequest(Request $request): void { $this->request = $request; } diff --git a/src/Exceptions/Handlers/HandlerInterface.php b/src/Exceptions/Handlers/HandlerInterface.php index d2e80510..81f97749 100644 --- a/src/Exceptions/Handlers/HandlerInterface.php +++ b/src/Exceptions/Handlers/HandlerInterface.php @@ -7,7 +7,7 @@ use Throwable; interface HandlerInterface { - public function render(Request $request, Throwable $e); + public function render(Request $request, Throwable $e): void; - public function report(Throwable $e); + public function report(Throwable $e): void; } diff --git a/src/Exceptions/Handlers/Legacy.php b/src/Exceptions/Handlers/Legacy.php index b42ce437..24894a0e 100644 --- a/src/Exceptions/Handlers/Legacy.php +++ b/src/Exceptions/Handlers/Legacy.php @@ -11,12 +11,12 @@ class Legacy implements HandlerInterface /** @var LoggerInterface */ protected $log; - public function render(Request $request, Throwable $e) + public function render(Request $request, Throwable $e): void { echo 'An unexpected error occurred. A team of untrained monkeys has been dispatched to fix it.'; } - public function report(Throwable $e) + public function report(Throwable $e): void { $previous = $e->getPrevious(); error_log(sprintf( @@ -39,15 +39,12 @@ class Legacy implements HandlerInterface } } - public function setLogger(LoggerInterface $logger) + public function setLogger(LoggerInterface $logger): void { $this->log = $logger; } - /** - * @return string - */ - protected function stripBasePath(string $path) + protected function stripBasePath(string $path): string { $basePath = realpath(__DIR__ . '/../../..') . '/'; return str_replace($basePath, '', $path); diff --git a/src/Exceptions/Handlers/LegacyDevelopment.php b/src/Exceptions/Handlers/LegacyDevelopment.php index 2d87d913..1d11aabe 100644 --- a/src/Exceptions/Handlers/LegacyDevelopment.php +++ b/src/Exceptions/Handlers/LegacyDevelopment.php @@ -7,7 +7,7 @@ use Throwable; class LegacyDevelopment extends Legacy { - public function render(Request $request, Throwable $e) + public function render(Request $request, Throwable $e): void { $file = $this->stripBasePath($e->getFile()); @@ -36,7 +36,7 @@ class LegacyDevelopment extends Legacy * @param array $stackTrace * @return array */ - protected function formatStackTrace(array $stackTrace) + protected function formatStackTrace(array $stackTrace): array { $return = []; $stackTrace = array_reverse($stackTrace); diff --git a/src/Exceptions/Handlers/NullHandler.php b/src/Exceptions/Handlers/NullHandler.php index bcfdcb39..285f5a16 100644 --- a/src/Exceptions/Handlers/NullHandler.php +++ b/src/Exceptions/Handlers/NullHandler.php @@ -7,7 +7,7 @@ use Throwable; class NullHandler extends Legacy { - public function render(Request $request, Throwable $e) + public function render(Request $request, Throwable $e): void { return; } diff --git a/src/Exceptions/Handlers/Whoops.php b/src/Exceptions/Handlers/Whoops.php index 26013d80..c23a87f8 100644 --- a/src/Exceptions/Handlers/Whoops.php +++ b/src/Exceptions/Handlers/Whoops.php @@ -25,7 +25,7 @@ class Whoops extends Legacy implements HandlerInterface $this->app = $app; } - public function render(Request $request, Throwable $e) + public function render(Request $request, Throwable $e): void { $whoops = $this->app->make(WhoopsRunner::class); $handler = $this->getPrettyPageHandler($e); @@ -41,10 +41,7 @@ class Whoops extends Legacy implements HandlerInterface echo $whoops->handleException($e); } - /** - * @return PrettyPageHandler - */ - protected function getPrettyPageHandler(Throwable $e) + protected function getPrettyPageHandler(Throwable $e): PrettyPageHandler { /** @var PrettyPageHandler $handler */ $handler = $this->app->make(PrettyPageHandler::class); @@ -64,10 +61,7 @@ class Whoops extends Legacy implements HandlerInterface return $handler; } - /** - * @return JsonResponseHandler - */ - protected function getJsonResponseHandler() + protected function getJsonResponseHandler(): JsonResponseHandler { $handler = $this->app->make(JsonResponseHandler::class); $handler->setJsonApi(true); @@ -81,7 +75,7 @@ class Whoops extends Legacy implements HandlerInterface * * @return array */ - protected function getData() + protected function getData(): array { $data = []; $user = null; diff --git a/src/Helpers/Assets.php b/src/Helpers/Assets.php index d3c54ba7..07085b05 100644 --- a/src/Helpers/Assets.php +++ b/src/Helpers/Assets.php @@ -18,9 +18,6 @@ class Assets $this->assetsPath = $assetsPath; } - /** - * @return string - */ public function getAssetPath(string $asset): string { $manifest = $this->assetsPath . DIRECTORY_SEPARATOR . $this->manifestFile; diff --git a/src/Helpers/AssetsServiceProvider.php b/src/Helpers/AssetsServiceProvider.php index 0998007e..75489edd 100644 --- a/src/Helpers/AssetsServiceProvider.php +++ b/src/Helpers/AssetsServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class AssetsServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->app->when(Assets::class) ->needs('$assetsPath') diff --git a/src/Helpers/Authenticator.php b/src/Helpers/Authenticator.php index bb512251..1f443482 100644 --- a/src/Helpers/Authenticator.php +++ b/src/Helpers/Authenticator.php @@ -45,7 +45,6 @@ class Authenticator /** * Load the user from session * - * @return User|null */ public function user(): ?User { @@ -73,7 +72,6 @@ class Authenticator /** * Get the user by his api key * - * @return User|null */ public function apiUser(string $parameter = 'api_key'): ?User { @@ -102,7 +100,6 @@ class Authenticator /** * @param string[]|string $abilities - * @return bool */ public function can(array|string $abilities): bool { @@ -136,9 +133,6 @@ class Authenticator return true; } - /** - * @return User|null - */ public function authenticate(string $login, string $password): ?User { /** @var User $user */ @@ -158,9 +152,6 @@ class Authenticator return $user; } - /** - * @return bool - */ public function verifyPassword(User $user, string $password): bool { if (!password_verify($password, $user->password)) { @@ -174,47 +165,38 @@ class Authenticator return true; } - public function setPassword(User $user, string $password) + public function setPassword(User $user, string $password): void { $user->password = password_hash($password, $this->passwordAlgorithm); $user->save(); } - /** - * @return int|string|null - */ - public function getPasswordAlgorithm() + public function getPasswordAlgorithm(): int|string|null { return $this->passwordAlgorithm; } - public function setPasswordAlgorithm(int|string|null $passwordAlgorithm) + public function setPasswordAlgorithm(int|string|null $passwordAlgorithm): void { $this->passwordAlgorithm = $passwordAlgorithm; } - /** - * @return int - */ public function getDefaultRole(): int { return $this->defaultRole; } - public function setDefaultRole(int $defaultRole) + public function setDefaultRole(int $defaultRole): void { $this->defaultRole = $defaultRole; } - /** - * @return int - */ public function getGuestRole(): int { return $this->guestRole; } - public function setGuestRole(int $guestRole) + public function setGuestRole(int $guestRole): void { $this->guestRole = $guestRole; } diff --git a/src/Helpers/AuthenticatorServiceProvider.php b/src/Helpers/AuthenticatorServiceProvider.php index c3f58fff..e5135599 100644 --- a/src/Helpers/AuthenticatorServiceProvider.php +++ b/src/Helpers/AuthenticatorServiceProvider.php @@ -7,7 +7,7 @@ use Engelsystem\Container\ServiceProvider; class AuthenticatorServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var Config $config */ $config = $this->app->get('config'); diff --git a/src/Helpers/ConfigureEnvironmentServiceProvider.php b/src/Helpers/ConfigureEnvironmentServiceProvider.php index cc79a25b..04d8bd64 100644 --- a/src/Helpers/ConfigureEnvironmentServiceProvider.php +++ b/src/Helpers/ConfigureEnvironmentServiceProvider.php @@ -10,7 +10,7 @@ use Engelsystem\Exceptions\Handlers\HandlerInterface; class ConfigureEnvironmentServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var Config $config */ $config = $this->app->get('config'); @@ -29,7 +29,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider /** * @codeCoverageIgnore */ - protected function setTimeZone(CarbonTimeZone $timeZone) + protected function setTimeZone(CarbonTimeZone $timeZone): void { ini_set('date.timezone', (string)$timeZone); date_default_timezone_set($timeZone); @@ -38,7 +38,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider /** * @codeCoverageIgnore */ - protected function displayErrors(bool $displayErrors) + protected function displayErrors(bool $displayErrors): void { ini_set('display_errors', $displayErrors); } @@ -46,7 +46,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider /** * @codeCoverageIgnore */ - protected function errorReporting(int $errorReporting) + protected function errorReporting(int $errorReporting): void { error_reporting($errorReporting); } @@ -54,7 +54,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider /** * Setup the development error handler */ - protected function setupDevErrorHandler() + protected function setupDevErrorHandler(): void { /** @var Handler $errorHandler */ $errorHandler = $this->app->get('error.handler'); diff --git a/src/Helpers/DumpServerServiceProvider.php b/src/Helpers/DumpServerServiceProvider.php index 2580a963..19ec0ddd 100644 --- a/src/Helpers/DumpServerServiceProvider.php +++ b/src/Helpers/DumpServerServiceProvider.php @@ -46,7 +46,7 @@ class DumpServerServiceProvider extends ServiceProvider VarDumper::setHandler( // @codeCoverageIgnoreStart - static function ($var) use ($cloner, $dumper) { + static function ($var) use ($cloner, $dumper): void { $dumper->dump($cloner->cloneVar($var)); } // @codeCoverageIgnoreEnd diff --git a/src/Helpers/Schedule/CalculatesTime.php b/src/Helpers/Schedule/CalculatesTime.php index 497b7cc6..7c4275c3 100644 --- a/src/Helpers/Schedule/CalculatesTime.php +++ b/src/Helpers/Schedule/CalculatesTime.php @@ -6,9 +6,6 @@ namespace Engelsystem\Helpers\Schedule; trait CalculatesTime { - /** - * @return int - */ protected function secondsFromTime(string $time): int { $seconds = 0; diff --git a/src/Helpers/Schedule/Conference.php b/src/Helpers/Schedule/Conference.php index d8519cf8..a438c5f6 100644 --- a/src/Helpers/Schedule/Conference.php +++ b/src/Helpers/Schedule/Conference.php @@ -51,57 +51,36 @@ class Conference $this->baseUrl = $baseUrl; } - /** - * @return string - */ public function getTitle(): string { return $this->title; } - /** - * @return string - */ public function getAcronym(): string { return $this->acronym; } - /** - * @return string|null - */ public function getStart(): ?string { return $this->start; } - /** - * @return string|null - */ public function getEnd(): ?string { return $this->end; } - /** - * @return int|null - */ public function getDays(): ?int { return $this->days; } - /** - * @return string|null - */ public function getTimeslotDuration(): ?string { return $this->timeslotDuration; } - /** - * @return int|null - */ public function getTimeslotDurationSeconds(): ?int { $duration = $this->getTimeslotDuration(); @@ -112,9 +91,6 @@ class Conference return $this->secondsFromTime($duration); } - /** - * @return string|null - */ public function getBaseUrl(): ?string { return $this->baseUrl; diff --git a/src/Helpers/Schedule/Day.php b/src/Helpers/Schedule/Day.php index 708652c2..99c26be8 100644 --- a/src/Helpers/Schedule/Day.php +++ b/src/Helpers/Schedule/Day.php @@ -42,33 +42,21 @@ class Day $this->room = $rooms; } - /** - * @return string - */ public function getDate(): string { return $this->date; } - /** - * @return Carbon - */ public function getStart(): Carbon { return $this->start; } - /** - * @return Carbon - */ public function getEnd(): Carbon { return $this->end; } - /** - * @return int - */ public function getIndex(): int { return $this->index; diff --git a/src/Helpers/Schedule/Event.php b/src/Helpers/Schedule/Event.php index cb417e1c..2fb545d6 100644 --- a/src/Helpers/Schedule/Event.php +++ b/src/Helpers/Schedule/Event.php @@ -134,33 +134,21 @@ class Event ->addSeconds($this->getDurationSeconds()); } - /** - * @return string - */ public function getGuid(): string { return $this->guid; } - /** - * @return int - */ public function getId(): int { return $this->id; } - /** - * @return Room - */ public function getRoom(): Room { return $this->room; } - /** - * @return string - */ public function getTitle(): string { return $this->title; @@ -171,81 +159,51 @@ class Event $this->title = $title; } - /** - * @return string - */ public function getSubtitle(): string { return $this->subtitle; } - /** - * @return string - */ public function getType(): string { return $this->type; } - /** - * @return Carbon - */ public function getDate(): Carbon { return $this->date; } - /** - * @return string - */ public function getStart(): string { return $this->start; } - /** - * @return string - */ public function getDuration(): string { return $this->duration; } - /** - * @return int - */ public function getDurationSeconds(): int { return $this->secondsFromTime($this->duration); } - /** - * @return string - */ public function getAbstract(): string { return $this->abstract; } - /** - * @return string - */ public function getSlug(): string { return $this->slug; } - /** - * @return string - */ public function getTrack(): string { return $this->track; } - /** - * @return string|null - */ public function getLogo(): ?string { return $this->logo; @@ -259,25 +217,16 @@ class Event return $this->persons; } - /** - * @return string|null - */ public function getLanguage(): ?string { return $this->language; } - /** - * @return string|null - */ public function getDescription(): ?string { return $this->description; } - /** - * @return string|null - */ public function getRecording(): ?string { return $this->recording; @@ -299,25 +248,16 @@ class Event return $this->attachments; } - /** - * @return string|null - */ public function getUrl(): ?string { return $this->url; } - /** - * @return string|null - */ public function getVideoDownloadUrl(): ?string { return $this->videoDownloadUrl; } - /** - * @return Carbon - */ public function getEndDate(): Carbon { return $this->endDate; diff --git a/src/Helpers/Schedule/Room.php b/src/Helpers/Schedule/Room.php index b54ab03a..1c6e0b11 100644 --- a/src/Helpers/Schedule/Room.php +++ b/src/Helpers/Schedule/Room.php @@ -25,9 +25,6 @@ class Room $this->event = $events; } - /** - * @return string - */ public function getName(): string { return $this->name; diff --git a/src/Helpers/Schedule/Schedule.php b/src/Helpers/Schedule/Schedule.php index 0e81fbfe..e5d4f26a 100644 --- a/src/Helpers/Schedule/Schedule.php +++ b/src/Helpers/Schedule/Schedule.php @@ -30,17 +30,11 @@ class Schedule $this->day = $days; } - /** - * @return string - */ public function getVersion(): string { return $this->version; } - /** - * @return Conference - */ public function getConference(): Conference { return $this->conference; @@ -71,9 +65,6 @@ class Schedule } - /** - * @return Carbon|null - */ public function getStartDateTime(): ?Carbon { $start = null; @@ -89,9 +80,6 @@ class Schedule return $start; } - /** - * @return Carbon|null - */ public function getEndDateTime(): ?Carbon { $end = null; diff --git a/src/Helpers/Schedule/XmlParser.php b/src/Helpers/Schedule/XmlParser.php index c130e3c5..bf52fe3a 100644 --- a/src/Helpers/Schedule/XmlParser.php +++ b/src/Helpers/Schedule/XmlParser.php @@ -15,9 +15,6 @@ class XmlParser /** @var Schedule */ protected $schedule; - /** - * @return bool - */ public function load(string $xml): bool { $this->scheduleXML = simplexml_load_string($xml); @@ -126,9 +123,6 @@ class XmlParser return $events; } - /** - * @return string - */ protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string { $element = ($xml ?: $this->scheduleXML)->xpath($path); @@ -158,9 +152,6 @@ class XmlParser return $items; } - /** - * @return Schedule - */ public function getSchedule(): Schedule { return $this->schedule; diff --git a/src/Helpers/Shifts.php b/src/Helpers/Shifts.php index f203c989..df9134a9 100644 --- a/src/Helpers/Shifts.php +++ b/src/Helpers/Shifts.php @@ -10,7 +10,6 @@ class Shifts /** * Check if a time range is a night shift * - * @return bool */ public static function isNightShift(Carbon $start, Carbon $end): bool { @@ -25,7 +24,6 @@ class Shifts /** * Calculate a shifts night multiplier * - * @return float */ public static function getNightShiftMultiplier(Carbon $start, Carbon $end): float { diff --git a/src/Helpers/Translation/GettextTranslator.php b/src/Helpers/Translation/GettextTranslator.php index bd228be3..40240b3e 100644 --- a/src/Helpers/Translation/GettextTranslator.php +++ b/src/Helpers/Translation/GettextTranslator.php @@ -7,7 +7,6 @@ use Gettext\Translator; class GettextTranslator extends Translator { /** - * @return string * @throws TranslationNotFound */ protected function translate(?string $domain, ?string $context, string $original): string @@ -18,7 +17,6 @@ class GettextTranslator extends Translator } /** - * @return string * @throws TranslationNotFound */ protected function translatePlural( @@ -36,7 +34,7 @@ class GettextTranslator extends Translator /** * @throws TranslationNotFound */ - protected function assertHasTranslation(?string $domain, ?string $context, string $original) + protected function assertHasTranslation(?string $domain, ?string $context, string $original): void { if ($this->getTranslation($domain, $context, $original)) { return; diff --git a/src/Helpers/Translation/TranslationServiceProvider.php b/src/Helpers/Translation/TranslationServiceProvider.php index de8ca72a..eb43df14 100644 --- a/src/Helpers/Translation/TranslationServiceProvider.php +++ b/src/Helpers/Translation/TranslationServiceProvider.php @@ -68,9 +68,6 @@ class TranslationServiceProvider extends ServiceProvider setlocale(LC_NUMERIC, 'C'); } - /** - * @return GettextTranslator - */ public function getTranslator(string $locale): GettextTranslator { if (!isset($this->translators[$locale])) { @@ -98,9 +95,6 @@ class TranslationServiceProvider extends ServiceProvider return $this->translators[$locale]; } - /** - * @return string - */ protected function getFile(string $locale, string $name = 'default'): string { $filepath = $file = $this->app->get('path.lang') . '/' . $locale . '/' . $name; diff --git a/src/Helpers/Translation/Translator.php b/src/Helpers/Translation/Translator.php index d8793f20..776a5f1b 100644 --- a/src/Helpers/Translation/Translator.php +++ b/src/Helpers/Translation/Translator.php @@ -43,7 +43,6 @@ class Translator * Get the translation for a given key * * @param array $replace - * @return string */ public function translate(string $key, array $replace = []): string { @@ -54,7 +53,6 @@ class Translator * Get the translation for a given key * * @param array $replace - * @return string */ public function translatePlural(string $key, string $pluralKey, int $number, array $replace = []): string { @@ -64,9 +62,8 @@ class Translator /** * @param array $parameters * @param array $replace - * @return mixed|string */ - protected function translateText(string $type, array $parameters, array $replace = []) + protected function translateText(string $type, array $parameters, array $replace = []): mixed { $translated = $parameters[0]; @@ -88,9 +85,8 @@ class Translator * Replace placeholders * * @param array $replace - * @return mixed|string */ - protected function replaceText(string $key, array $replace = []) + protected function replaceText(string $key, array $replace = []): mixed { if (empty($replace)) { return $key; @@ -99,15 +95,12 @@ class Translator return call_user_func_array('sprintf', array_merge([$key], array_values($replace))); } - /** - * @return string - */ public function getLocale(): string { return $this->locale; } - public function setLocale(string $locale) + public function setLocale(string $locale): void { $this->locale = $locale; @@ -124,9 +117,6 @@ class Translator return $this->locales; } - /** - * @return bool - */ public function hasLocale(string $locale): bool { return isset($this->locales[$locale]); @@ -135,7 +125,7 @@ class Translator /** * @param string[] $locales */ - public function setLocales(array $locales) + public function setLocales(array $locales): void { $this->locales = $locales; } diff --git a/src/Helpers/UuidServiceProvider.php b/src/Helpers/UuidServiceProvider.php index dea1dea8..5bdb0708 100644 --- a/src/Helpers/UuidServiceProvider.php +++ b/src/Helpers/UuidServiceProvider.php @@ -10,7 +10,7 @@ class UuidServiceProvider extends ServiceProvider /** * Register the UUID generator to the Str class */ - public function register() + public function register(): void { Str::createUuidsUsing([$this, 'uuid']); } diff --git a/src/Helpers/Version.php b/src/Helpers/Version.php index 73ab42f4..11a668aa 100644 --- a/src/Helpers/Version.php +++ b/src/Helpers/Version.php @@ -21,10 +21,7 @@ class Version $this->config = $config; } - /** - * @return string - */ - public function getVersion() + public function getVersion(): string { $file = $this->storage . DIRECTORY_SEPARATOR . $this->versionFile; diff --git a/src/Helpers/VersionServiceProvider.php b/src/Helpers/VersionServiceProvider.php index 41e10158..10bd3aa0 100644 --- a/src/Helpers/VersionServiceProvider.php +++ b/src/Helpers/VersionServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class VersionServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->app->when(Version::class) ->needs('$storage') diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php index 0beb6df9..53500df3 100644 --- a/src/Http/Exceptions/HttpException.php +++ b/src/Http/Exceptions/HttpException.php @@ -38,9 +38,6 @@ class HttpException extends RuntimeException return $this->headers; } - /** - * @return int - */ public function getStatusCode(): int { return $this->statusCode; diff --git a/src/Http/Exceptions/ValidationException.php b/src/Http/Exceptions/ValidationException.php index 0bd47f23..cecfd23b 100644 --- a/src/Http/Exceptions/ValidationException.php +++ b/src/Http/Exceptions/ValidationException.php @@ -24,9 +24,6 @@ class ValidationException extends RuntimeException parent::__construct($message, $code, $previous); } - /** - * @return Validator - */ public function getValidator(): Validator { return $this->validator; diff --git a/src/Http/HttpClientServiceProvider.php b/src/Http/HttpClientServiceProvider.php index 113af713..b3e93eaf 100644 --- a/src/Http/HttpClientServiceProvider.php +++ b/src/Http/HttpClientServiceProvider.php @@ -7,7 +7,7 @@ use GuzzleHttp\Client as GuzzleClient; class HttpClientServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->app->when(GuzzleClient::class) ->needs('$config') diff --git a/src/Http/MessageTrait.php b/src/Http/MessageTrait.php index aa8d1602..1d6bef4c 100644 --- a/src/Http/MessageTrait.php +++ b/src/Http/MessageTrait.php @@ -36,7 +36,7 @@ trait MessageTrait * @param string $version HTTP protocol version * @return static */ - public function withProtocolVersion(mixed $version) + public function withProtocolVersion(mixed $version): static { $new = clone $this; if (method_exists($new, 'setProtocolVersion')) { @@ -74,7 +74,7 @@ trait MessageTrait * key MUST be a header name, and each value MUST be an array of strings * for that header. */ - public function getHeaders() + public function getHeaders(): array { if (method_exists($this->headers, 'allPreserveCase')) { return $this->headers->allPreserveCase(); @@ -91,7 +91,7 @@ trait MessageTrait * name using a case-insensitive string comparison. Returns false if * no matching header name is found in the message. */ - public function hasHeader(mixed $name) + public function hasHeader(mixed $name): bool { return $this->headers->has($name); } @@ -110,7 +110,7 @@ trait MessageTrait * header. If the header does not appear in the message, this method MUST * return an empty array. */ - public function getHeader(mixed $name) + public function getHeader(mixed $name): array { return $this->headers->all($name); } @@ -134,7 +134,7 @@ trait MessageTrait * concatenated together using a comma. If the header does not appear in * the message, this method MUST return an empty string. */ - public function getHeaderLine(mixed $name) + public function getHeaderLine(mixed $name): string { return implode(',', $this->getHeader($name)); } @@ -154,7 +154,7 @@ trait MessageTrait * @return static * @throws \InvalidArgumentException for invalid header names or values. */ - public function withHeader(mixed $name, mixed $value) + public function withHeader(mixed $name, mixed $value): static { $new = clone $this; $new->headers->set($name, $value); @@ -178,7 +178,7 @@ trait MessageTrait * @return static * @throws \InvalidArgumentException for invalid header names or values. */ - public function withAddedHeader(mixed $name, mixed $value) + public function withAddedHeader(mixed $name, mixed $value): static { $new = clone $this; $new->headers->set($name, $value, false); @@ -198,7 +198,7 @@ trait MessageTrait * @param string $name Case-insensitive header field name to remove. * @return static */ - public function withoutHeader(mixed $name) + public function withoutHeader(mixed $name): static { $new = clone $this; $new->headers->remove($name); @@ -211,7 +211,7 @@ trait MessageTrait * * @return StreamInterface Returns the body as a stream. */ - public function getBody() + public function getBody(): StreamInterface { $stream = Stream::create($this->getContent()); $stream->rewind(); @@ -232,7 +232,7 @@ trait MessageTrait * @return static * @throws \InvalidArgumentException When the body is not valid. */ - public function withBody(StreamInterface $body) + public function withBody(StreamInterface $body): static { $new = clone $this; diff --git a/src/Http/Psr7ServiceProvider.php b/src/Http/Psr7ServiceProvider.php index d58ee6e9..aa484c9f 100644 --- a/src/Http/Psr7ServiceProvider.php +++ b/src/Http/Psr7ServiceProvider.php @@ -15,7 +15,7 @@ use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; class Psr7ServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $psr17Factory = Psr17Factory::class; diff --git a/src/Http/RedirectServiceProvider.php b/src/Http/RedirectServiceProvider.php index 70238d91..1751e432 100644 --- a/src/Http/RedirectServiceProvider.php +++ b/src/Http/RedirectServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class RedirectServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->app->bind('redirect', Redirector::class); } diff --git a/src/Http/Redirector.php b/src/Http/Redirector.php index e0435dbc..841c081b 100644 --- a/src/Http/Redirector.php +++ b/src/Http/Redirector.php @@ -24,7 +24,6 @@ class Redirector * Redirects to a path, generating a full URL * * @param array $headers - * @return Response */ public function to(string $path, int $status = 302, array $headers = []): Response { @@ -33,16 +32,12 @@ class Redirector /** * @param array $headers - * @return Response */ public function back(int $status = 302, array $headers = []): Response { return $this->to($this->getPreviousUrl(), $status, $headers); } - /** - * @return string - */ protected function getPreviousUrl(): string { if ($header = $this->request->getHeader('referer')) { diff --git a/src/Http/Request.php b/src/Http/Request.php index c74056fe..5c435bcf 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -16,9 +16,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Get POST input * - * @return mixed */ - public function postData(string $key, mixed $default = null) + public function postData(string $key, mixed $default = null): mixed { return $this->request->get($key, $default); } @@ -26,9 +25,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Get input data * - * @return mixed */ - public function input(string $key, mixed $default = null) + public function input(string $key, mixed $default = null): mixed { return $this->get($key, $default); } @@ -36,9 +34,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Checks if the input exists * - * @return bool */ - public function has(string $key) + public function has(string $key): bool { $value = $this->input($key); @@ -48,9 +45,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Checks if the POST data exists * - * @return bool */ - public function hasPostData(string $key) + public function hasPostData(string $key): bool { $value = $this->postData($key); @@ -60,9 +56,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Get the requested path * - * @return string */ - public function path() + public function path(): string { $pattern = trim($this->getPathInfo(), '/'); @@ -72,9 +67,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface /** * Return the current URL * - * @return string */ - public function url() + public function url(): string { return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); } @@ -94,9 +88,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface * If no URI is available, and no request-target has been specifically * provided, this method MUST return the string "/". * - * @return string */ - public function getRequestTarget() + public function getRequestTarget(): string { $query = $this->getQueryString(); return '/' . $this->path() . (!empty($query) ? '?' . $query : ''); @@ -118,7 +111,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * request-target forms allowed in request messages) * @return static */ - public function withRequestTarget(mixed $requestTarget) + public function withRequestTarget(mixed $requestTarget): static { return $this->create($requestTarget); } @@ -138,7 +131,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return static * @throws \InvalidArgumentException for invalid HTTP methods. */ - public function withMethod(mixed $method) + public function withMethod(mixed $method): static { $new = clone $this; $new->setMethod($method); @@ -176,7 +169,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @param bool $preserveHost Preserve the original state of the Host header. * @return static */ - public function withUri(UriInterface $uri, mixed $preserveHost = false) + public function withUri(UriInterface $uri, mixed $preserveHost = false): static { $new = $this->create($uri); if ($preserveHost) { @@ -195,7 +188,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * * @return array */ - public function getServerParams() + public function getServerParams(): array { return $this->server->all(); } @@ -210,7 +203,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * * @return array */ - public function getCookieParams() + public function getCookieParams(): array { return $this->cookies->all(); } @@ -232,7 +225,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @param array $cookies Array of key/value pairs representing cookies. * @return static */ - public function withCookieParams(array $cookies) + public function withCookieParams(array $cookies): static { $new = clone $this; $new->cookies = clone $this->cookies; @@ -253,7 +246,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * * @return array */ - public function getQueryParams() + public function getQueryParams(): array { return $this->query->all(); } @@ -280,7 +273,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * $_GET. * @return static */ - public function withQueryParams(array $query) + public function withQueryParams(array $query): static { $new = clone $this; $new->query = clone $this->query; @@ -301,7 +294,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return array An array tree of UploadedFileInterface instances; an empty * array MUST be returned if no data is present. */ - public function getUploadedFiles() + public function getUploadedFiles(): array { $files = []; /** @var SymfonyFile $file */ @@ -329,7 +322,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return static * @throws \InvalidArgumentException if an invalid structure is provided. */ - public function withUploadedFiles(array $uploadedFiles) + public function withUploadedFiles(array $uploadedFiles): static { $new = clone $this; $new->files = clone $this->files; @@ -369,7 +362,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return null|array|object The deserialized body parameters, if any. * These will typically be an array or object. */ - public function getParsedBody() + public function getParsedBody(): array|object|null { return $this->request->all(); } @@ -402,7 +395,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @throws \InvalidArgumentException if an unsupported argument type is * provided. */ - public function withParsedBody(mixed $data) + public function withParsedBody(mixed $data): static { $new = clone $this; $new->request = clone $this->request; @@ -423,7 +416,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * * @return array Attributes derived from the request. */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes->all(); } @@ -440,10 +433,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface * * @param string $name The attribute name. * @param mixed $default Default value to return if the attribute does not exist. - * @return mixed * @see getAttributes() */ - public function getAttribute(mixed $name, mixed $default = null) + public function getAttribute(mixed $name, mixed $default = null): mixed { return $this->attributes->get($name, $default); } @@ -463,7 +455,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return static * @see getAttributes() */ - public function withAttribute(mixed $name, mixed $value) + public function withAttribute(mixed $name, mixed $value): static { $new = clone $this; $new->attributes = clone $this->attributes; @@ -487,7 +479,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface * @return static * @see getAttributes() */ - public function withoutAttribute(mixed $name) + public function withoutAttribute(mixed $name): static { $new = clone $this; $new->attributes = clone $this->attributes; diff --git a/src/Http/RequestServiceProvider.php b/src/Http/RequestServiceProvider.php index 1b72c960..fa6ce179 100644 --- a/src/Http/RequestServiceProvider.php +++ b/src/Http/RequestServiceProvider.php @@ -12,7 +12,7 @@ class RequestServiceProvider extends ServiceProvider /** @var array */ protected array $appUrl; - public function register() + public function register(): void { /** @var Config $config */ $config = $this->app->get('config'); @@ -44,7 +44,6 @@ class RequestServiceProvider extends ServiceProvider * @param array $files Uploaded files * @param array $server Server env * @param mixed $content Request content - * @return Request */ public function createRequestWithoutPrefix( array $query = [], @@ -88,7 +87,7 @@ class RequestServiceProvider extends ServiceProvider Request $request, array $proxies, int $trustedHeadersSet = Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_TRAEFIK - ) { + ): void { $request->setTrustedProxies($proxies, $trustedHeadersSet); } } diff --git a/src/Http/Response.php b/src/Http/Response.php index 774799c4..3ca0e7cc 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -56,7 +56,7 @@ class Response extends SymfonyResponse implements ResponseInterface * @return static * @throws InvalidArgumentException For invalid status code arguments. */ - public function withStatus(mixed $code, mixed $reasonPhrase = '') + public function withStatus(mixed $code, mixed $reasonPhrase = ''): static { $new = clone $this; $new->setStatusCode($code, !empty($reasonPhrase) ? $reasonPhrase : null); @@ -77,7 +77,7 @@ class Response extends SymfonyResponse implements ResponseInterface * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml * @return string Reason phrase; must return an empty string if none present. */ - public function getReasonPhrase() + public function getReasonPhrase(): string { return $this->statusText; } @@ -92,7 +92,7 @@ class Response extends SymfonyResponse implements ResponseInterface * @param mixed $content Content that can be cast to string * @return static */ - public function withContent(mixed $content) + public function withContent(mixed $content): static { $new = clone $this; $new->setContent($content); @@ -108,9 +108,8 @@ class Response extends SymfonyResponse implements ResponseInterface * * @param array $data * @param string[]|string[][] $headers - * @return Response */ - public function withView(string $view, array $data = [], int $status = 200, array $headers = []) + public function withView(string $view, array $data = [], int $status = 200, array $headers = []): Response { if (!$this->renderer instanceof Renderer) { throw new InvalidArgumentException('Renderer not defined'); @@ -134,9 +133,8 @@ class Response extends SymfonyResponse implements ResponseInterface * an instance with the updated status and headers * * @param array $headers - * @return Response */ - public function redirectTo(string $path, int $status = 302, array $headers = []) + public function redirectTo(string $path, int $status = 302, array $headers = []): Response { $response = $this->withStatus($status); $response = $response->withHeader('location', $path); @@ -152,7 +150,7 @@ class Response extends SymfonyResponse implements ResponseInterface * Set the renderer to use * */ - public function setRenderer(Renderer $renderer) + public function setRenderer(Renderer $renderer): void { $this->renderer = $renderer; } @@ -160,9 +158,8 @@ class Response extends SymfonyResponse implements ResponseInterface /** * Sets a session attribute (which is mutable) * - * @return Response */ - public function with(string $key, mixed $value) + public function with(string $key, mixed $value): Response { if (!$this->session instanceof SessionInterface) { throw new InvalidArgumentException('Session not defined'); @@ -182,9 +179,8 @@ class Response extends SymfonyResponse implements ResponseInterface * Sets form data to the mutable session * * @param array $input - * @return Response */ - public function withInput(array $input) + public function withInput(array $input): Response { if (!$this->session instanceof SessionInterface) { throw new InvalidArgumentException('Session not defined'); diff --git a/src/Http/ResponseServiceProvider.php b/src/Http/ResponseServiceProvider.php index c1489f06..479a5273 100644 --- a/src/Http/ResponseServiceProvider.php +++ b/src/Http/ResponseServiceProvider.php @@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Response as SymfonyResponse; class ResponseServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $response = $this->app->make(Response::class); $this->app->instance(Response::class, $response); diff --git a/src/Http/SessionServiceProvider.php b/src/Http/SessionServiceProvider.php index 97e8c9b6..cdd77643 100644 --- a/src/Http/SessionServiceProvider.php +++ b/src/Http/SessionServiceProvider.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; class SessionServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $sessionStorage = $this->getSessionStorage(); $this->app->instance('session.storage', $sessionStorage); @@ -39,9 +39,8 @@ class SessionServiceProvider extends ServiceProvider /** * Returns the session storage * - * @return SessionStorageInterface */ - protected function getSessionStorage() + protected function getSessionStorage(): SessionStorageInterface { if ($this->isCli()) { return $this->app->make(MockArraySessionStorage::class); @@ -71,9 +70,8 @@ class SessionServiceProvider extends ServiceProvider /** * Test if is called from cli * - * @return bool */ - protected function isCli() + protected function isCli(): bool { return PHP_SAPI == 'cli' || PHP_SAPI == 'phpdbg'; } diff --git a/src/Http/UrlGenerator.php b/src/Http/UrlGenerator.php index 5b11d122..bec79524 100644 --- a/src/Http/UrlGenerator.php +++ b/src/Http/UrlGenerator.php @@ -34,7 +34,6 @@ class UrlGenerator implements UrlGeneratorInterface /** * Check if the URL is valid * - * @return bool */ public function isValidUrl(string $path): bool { @@ -45,7 +44,6 @@ class UrlGenerator implements UrlGeneratorInterface * Prepend the auto detected or configured app base path and domain * * @param $path - * @return string */ protected function generateUrl(string $path): string { diff --git a/src/Http/UrlGeneratorInterface.php b/src/Http/UrlGeneratorInterface.php index 926251fc..016b21cc 100644 --- a/src/Http/UrlGeneratorInterface.php +++ b/src/Http/UrlGeneratorInterface.php @@ -9,7 +9,6 @@ interface UrlGeneratorInterface { /** * @param array $parameters - * @return string */ public function to(string $path, array $parameters = []): string; } diff --git a/src/Http/UrlGeneratorServiceProvider.php b/src/Http/UrlGeneratorServiceProvider.php index 774e3e35..abe7bad9 100644 --- a/src/Http/UrlGeneratorServiceProvider.php +++ b/src/Http/UrlGeneratorServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class UrlGeneratorServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $urlGenerator = $this->app->make(UrlGenerator::class); $this->app->instance(UrlGenerator::class, $urlGenerator); diff --git a/src/Http/Validation/Rules/Checked.php b/src/Http/Validation/Rules/Checked.php index c6b5e3b3..2c10ba63 100644 --- a/src/Http/Validation/Rules/Checked.php +++ b/src/Http/Validation/Rules/Checked.php @@ -6,7 +6,7 @@ use Respect\Validation\Rules\AbstractRule; class Checked extends AbstractRule { - public function validate(mixed $input) + public function validate(mixed $input): bool { return in_array($input, ['yes', 'on', 1, '1', 'true', true], true); } diff --git a/src/Http/Validation/Rules/NotIn.php b/src/Http/Validation/Rules/NotIn.php index 4cdd4d97..98d48dde 100644 --- a/src/Http/Validation/Rules/NotIn.php +++ b/src/Http/Validation/Rules/NotIn.php @@ -4,10 +4,7 @@ namespace Engelsystem\Http\Validation\Rules; class NotIn extends In { - /** - * @return bool - */ - public function validate(mixed $input) + public function validate(mixed $input): bool { return !parent::validate($input); } diff --git a/src/Http/Validation/Rules/StringInputLength.php b/src/Http/Validation/Rules/StringInputLength.php index 9d01c50c..c067d3b7 100644 --- a/src/Http/Validation/Rules/StringInputLength.php +++ b/src/Http/Validation/Rules/StringInputLength.php @@ -11,7 +11,6 @@ trait StringInputLength /** * Use the input length of a string * - * @return bool */ public function validate(mixed $input): bool { @@ -26,9 +25,6 @@ trait StringInputLength return parent::validate($input); } - /** - * @return bool - */ protected function isDateTime(mixed $input): bool { try { diff --git a/src/Http/Validation/ValidatesRequest.php b/src/Http/Validation/ValidatesRequest.php index 5caf00ad..a390fc64 100644 --- a/src/Http/Validation/ValidatesRequest.php +++ b/src/Http/Validation/ValidatesRequest.php @@ -14,7 +14,7 @@ trait ValidatesRequest * @param array $rules * @return array */ - protected function validate(Request $request, array $rules) + protected function validate(Request $request, array $rules): array { $isValid = $this->validator->validate( (array)$request->getParsedBody(), @@ -28,7 +28,7 @@ trait ValidatesRequest return $this->validator->getData(); } - public function setValidator(Validator $validator) + public function setValidator(Validator $validator): void { $this->validator = $validator; } diff --git a/src/Http/Validation/ValidationServiceProvider.php b/src/Http/Validation/ValidationServiceProvider.php index 14530ae6..17e63e96 100644 --- a/src/Http/Validation/ValidationServiceProvider.php +++ b/src/Http/Validation/ValidationServiceProvider.php @@ -8,13 +8,13 @@ use Engelsystem\Controllers\BaseController; class ValidationServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $validator = $this->app->make(Validator::class); $this->app->instance(Validator::class, $validator); $this->app->instance('validator', $validator); - $this->app->afterResolving(function ($object, Application $app) { + $this->app->afterResolving(function ($object, Application $app): void { if (!$object instanceof BaseController) { return; } diff --git a/src/Http/Validation/Validator.php b/src/Http/Validation/Validator.php index e686df88..b64268db 100644 --- a/src/Http/Validation/Validator.php +++ b/src/Http/Validation/Validator.php @@ -29,9 +29,8 @@ class Validator /** * @param array $data * @param array $rules - * @return bool */ - public function validate(array $data, array $rules) + public function validate(array $data, array $rules): bool { $this->errors = []; $this->data = []; @@ -85,18 +84,12 @@ class Validator return empty($this->errors); } - /** - * @return string - */ - protected function map(string $rule) + protected function map(string $rule): string { return $this->mapping[$rule] ?? $rule; } - /** - * @return string - */ - protected function mapBack(string $rule) + protected function mapBack(string $rule): string { $mapping = array_flip($this->mapping); diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index a44699ed..9d486c37 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -55,7 +55,6 @@ class Logger extends AbstractLogger * Interpolates context values into the message placeholders. * * @param array $context - * @return string */ protected function interpolate(string $message, array $context = []): string { @@ -72,9 +71,6 @@ class Logger extends AbstractLogger return $message; } - /** - * @return string - */ protected function formatException(Throwable $e): string { return sprintf( @@ -87,9 +83,6 @@ class Logger extends AbstractLogger ); } - /** - * @return bool - */ protected function checkLevel(string $level): bool { return in_array($level, $this->allowedLevels); diff --git a/src/Logger/LoggerServiceProvider.php b/src/Logger/LoggerServiceProvider.php index a3b7ad03..65219ed5 100644 --- a/src/Logger/LoggerServiceProvider.php +++ b/src/Logger/LoggerServiceProvider.php @@ -8,7 +8,7 @@ use Psr\Log\LoggerInterface; class LoggerServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $logger = $this->app->make(UserAwareLogger::class); $this->app->instance('logger', $logger); @@ -18,7 +18,7 @@ class LoggerServiceProvider extends ServiceProvider $this->app->bind(UserAwareLogger::class, 'logger'); } - public function boot() + public function boot(): void { /** @var UserAwareLogger $logger */ $logger = $this->app->get(UserAwareLogger::class); diff --git a/src/Mail/EngelsystemMailer.php b/src/Mail/EngelsystemMailer.php index 57228e6f..936abf40 100644 --- a/src/Mail/EngelsystemMailer.php +++ b/src/Mail/EngelsystemMailer.php @@ -91,15 +91,12 @@ class EngelsystemMailer extends Mailer parent::send($to, $subject, $body); } - /** - * @return string - */ public function getSubjectPrefix(): string { return $this->subjectPrefix; } - public function setSubjectPrefix(string $subjectPrefix) + public function setSubjectPrefix(string $subjectPrefix): void { $this->subjectPrefix = $subjectPrefix; } diff --git a/src/Mail/Mailer.php b/src/Mail/Mailer.php index 24591360..d4addac1 100644 --- a/src/Mail/Mailer.php +++ b/src/Mail/Mailer.php @@ -37,28 +37,22 @@ class Mailer $this->mailer->send($message); } - /** - * @return string - */ public function getFromAddress(): string { return $this->fromAddress; } - public function setFromAddress(string $fromAddress) + public function setFromAddress(string $fromAddress): void { $this->fromAddress = $fromAddress; } - /** - * @return string - */ public function getFromName(): string { return $this->fromName; } - public function setFromName(string $fromName) + public function setFromName(string $fromName): void { $this->fromName = $fromName; } diff --git a/src/Mail/MailerServiceProvider.php b/src/Mail/MailerServiceProvider.php index ea0f945f..deb07a2f 100644 --- a/src/Mail/MailerServiceProvider.php +++ b/src/Mail/MailerServiceProvider.php @@ -15,7 +15,7 @@ use Symfony\Component\Mailer\Mailer as SymfonyMailer; class MailerServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var Config $config */ $config = $this->app->get('config'); @@ -46,9 +46,8 @@ class MailerServiceProvider extends ServiceProvider /** * @param array $config - * @return TransportInterface */ - protected function getTransport(?string $transport, array $config) + protected function getTransport(?string $transport, array $config): TransportInterface { switch ($transport) { case 'log': @@ -65,9 +64,8 @@ class MailerServiceProvider extends ServiceProvider /** * @param array $config - * @return SmtpTransport */ - protected function getSmtpTransport(array $config) + protected function getSmtpTransport(array $config): SmtpTransport { /** @var EsmtpTransport $transport */ $transport = $this->app->make(EsmtpTransport::class, [ diff --git a/src/Mail/Transport/LogTransport.php b/src/Mail/Transport/LogTransport.php index 0231f5e5..6b14c4a8 100644 --- a/src/Mail/Transport/LogTransport.php +++ b/src/Mail/Transport/LogTransport.php @@ -39,9 +39,6 @@ class LogTransport extends AbstractTransport ); } - /** - * @return string - */ public function __toString(): string { return 'log://'; diff --git a/src/Middleware/AddHeaders.php b/src/Middleware/AddHeaders.php index 597832e9..41f4d8d7 100644 --- a/src/Middleware/AddHeaders.php +++ b/src/Middleware/AddHeaders.php @@ -21,7 +21,6 @@ class AddHeaders implements MiddlewareInterface /** * Process an incoming server request and setting the locale if required * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { diff --git a/src/Middleware/CallableHandler.php b/src/Middleware/CallableHandler.php index 54da0073..97183d9f 100644 --- a/src/Middleware/CallableHandler.php +++ b/src/Middleware/CallableHandler.php @@ -31,7 +31,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface * Process an incoming server request and return a response, optionally delegating * response creation to a handler. * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { @@ -41,7 +40,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface /** * Handle the request and return a response. * - * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { @@ -52,7 +50,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface * Execute the callable and return a response * * @param array $arguments - * @return ResponseInterface */ protected function execute(array $arguments = []): ResponseInterface { @@ -71,10 +68,7 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface return $response->withContent($return); } - /** - * @return callable - */ - public function getCallable() + public function getCallable(): callable { return $this->callable; } diff --git a/src/Middleware/Dispatcher.php b/src/Middleware/Dispatcher.php index afa5834b..803e8c59 100644 --- a/src/Middleware/Dispatcher.php +++ b/src/Middleware/Dispatcher.php @@ -39,7 +39,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface * * Could be used to group middleware * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, @@ -55,7 +54,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface * * It calls all configured middleware and handles their response * - * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { @@ -77,7 +75,7 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface return $middleware->process($request, $this); } - public function setContainer(Application $container) + public function setContainer(Application $container): void { $this->container = $container; } diff --git a/src/Middleware/ErrorHandler.php b/src/Middleware/ErrorHandler.php index f274dd84..ed1791ec 100644 --- a/src/Middleware/ErrorHandler.php +++ b/src/Middleware/ErrorHandler.php @@ -48,7 +48,6 @@ class ErrorHandler implements MiddlewareInterface * * Should be added at the beginning * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, @@ -100,7 +99,6 @@ class ErrorHandler implements MiddlewareInterface /** * Select a view based on the given status code * - * @return string */ protected function selectView(int $statusCode): string { @@ -120,10 +118,9 @@ class ErrorHandler implements MiddlewareInterface * Create a new response * * @param array $headers - * @return Response * @codeCoverageIgnore */ - protected function createResponse(string $content = '', int $status = 200, array $headers = []) + protected function createResponse(string $content = '', int $status = 200, array $headers = []): ResponseInterface { return response($content, $status, $headers); } @@ -131,9 +128,8 @@ class ErrorHandler implements MiddlewareInterface /** * Create a redirect back response * - * @return Response */ - protected function redirectBack() + protected function redirectBack(): Response { return back(); } diff --git a/src/Middleware/ExceptionHandler.php b/src/Middleware/ExceptionHandler.php index a4e19a1d..ad49d497 100644 --- a/src/Middleware/ExceptionHandler.php +++ b/src/Middleware/ExceptionHandler.php @@ -25,7 +25,6 @@ class ExceptionHandler implements MiddlewareInterface * * Should be added at the beginning * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index 322adf28..ad33a53a 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -5,7 +5,6 @@ namespace Engelsystem\Middleware; use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Translation\Translator; use Engelsystem\Http\Request; -use Engelsystem\Http\Response; use Psr\Container\ContainerInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -46,7 +45,6 @@ class LegacyMiddleware implements MiddlewareInterface * * Should be used before a 404 is send * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, @@ -86,7 +84,7 @@ class LegacyMiddleware implements MiddlewareInterface * @return array ['title', 'content'] * @codeCoverageIgnore */ - protected function loadPage(string $page) + protected function loadPage(string $page): array { switch ($page) { case 'ical': @@ -175,10 +173,9 @@ class LegacyMiddleware implements MiddlewareInterface /** * Render the template * - * @return Response * @codeCoverageIgnore */ - protected function renderPage(string $page, string $title, string $content) + protected function renderPage(string $page, string $title, string $content): ResponseInterface { if (!empty($page) && is_int($page)) { return response($content, (int)$page); diff --git a/src/Middleware/RequestHandler.php b/src/Middleware/RequestHandler.php index ec96491c..d43cbdcc 100644 --- a/src/Middleware/RequestHandler.php +++ b/src/Middleware/RequestHandler.php @@ -28,7 +28,6 @@ class RequestHandler implements MiddlewareInterface * Process an incoming server request and return a response, optionally delegating * response creation to a handler. * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { @@ -58,10 +57,10 @@ class RequestHandler implements MiddlewareInterface /** * Resolve the given class * - * @return MiddlewareInterface|RequestHandlerInterface */ - protected function resolveRequestHandler(string|callable|MiddlewareInterface|RequestHandlerInterface $handler) - { + protected function resolveRequestHandler( + string|callable|MiddlewareInterface|RequestHandlerInterface $handler + ): MiddlewareInterface|RequestHandlerInterface { if (is_string($handler) && mb_strpos($handler, '@') !== false) { list($class, $method) = explode('@', $handler, 2); if (!class_exists($class) && !$this->container->has($class)) { @@ -88,7 +87,6 @@ class RequestHandler implements MiddlewareInterface /** * Check required page permissions * - * @return bool */ protected function checkPermissions(BaseController $controller, string $method): bool { diff --git a/src/Middleware/RequestHandlerServiceProvider.php b/src/Middleware/RequestHandlerServiceProvider.php index c6488118..46227308 100644 --- a/src/Middleware/RequestHandlerServiceProvider.php +++ b/src/Middleware/RequestHandlerServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class RequestHandlerServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var RequestHandler $requestHandler */ $requestHandler = $this->app->make(RequestHandler::class); diff --git a/src/Middleware/ResolvesMiddlewareTrait.php b/src/Middleware/ResolvesMiddlewareTrait.php index a2a103e4..6e8849cc 100644 --- a/src/Middleware/ResolvesMiddlewareTrait.php +++ b/src/Middleware/ResolvesMiddlewareTrait.php @@ -12,10 +12,10 @@ trait ResolvesMiddlewareTrait /** * Resolve the middleware with the container * - * @return MiddlewareInterface|RequestHandlerInterface */ - protected function resolveMiddleware(string|callable|MiddlewareInterface|RequestHandlerInterface $middleware) - { + protected function resolveMiddleware( + string|callable|MiddlewareInterface|RequestHandlerInterface $middleware + ): MiddlewareInterface|RequestHandlerInterface { if ($this->isMiddleware($middleware)) { return $middleware; } @@ -45,9 +45,8 @@ trait ResolvesMiddlewareTrait /** * Checks if the given object is a middleware or middleware or request handler * - * @return bool */ - protected function isMiddleware(mixed $middleware) + protected function isMiddleware(mixed $middleware): bool { return ($middleware instanceof MiddlewareInterface || $middleware instanceof RequestHandlerInterface); } diff --git a/src/Middleware/RouteDispatcher.php b/src/Middleware/RouteDispatcher.php index 637a42d2..1076e987 100644 --- a/src/Middleware/RouteDispatcher.php +++ b/src/Middleware/RouteDispatcher.php @@ -39,7 +39,6 @@ class RouteDispatcher implements MiddlewareInterface * Process an incoming server request and return a response, optionally delegating * response creation to a handler. * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { diff --git a/src/Middleware/RouteDispatcherServiceProvider.php b/src/Middleware/RouteDispatcherServiceProvider.php index 89e1294c..51d0ed67 100644 --- a/src/Middleware/RouteDispatcherServiceProvider.php +++ b/src/Middleware/RouteDispatcherServiceProvider.php @@ -12,7 +12,7 @@ use function FastRoute\cachedDispatcher as FRCashedDispatcher; class RouteDispatcherServiceProvider extends ServiceProvider { - public function register() + public function register(): void { /** @var Config $config */ $config = $this->app->get('config'); @@ -44,10 +44,9 @@ class RouteDispatcherServiceProvider extends ServiceProvider * Includes the routes.php file * * @param array $options - * @return FastRouteDispatcher * @codeCoverageIgnore */ - protected function generateRouting(array $options = []) + protected function generateRouting(array $options = []): FastRouteDispatcher { $routesFile = config_path('routes.php'); $routesCacheFile = $this->app->get('path.cache.routes'); @@ -59,7 +58,7 @@ class RouteDispatcherServiceProvider extends ServiceProvider unlink($routesCacheFile); } - return FRCashedDispatcher(function (RouteCollector $route) { + return FRCashedDispatcher(function (RouteCollector $route): void { require config_path('routes.php'); }, $options); } diff --git a/src/Middleware/SendResponseHandler.php b/src/Middleware/SendResponseHandler.php index 0fe3a04b..940c649b 100644 --- a/src/Middleware/SendResponseHandler.php +++ b/src/Middleware/SendResponseHandler.php @@ -14,7 +14,6 @@ class SendResponseHandler implements MiddlewareInterface * * This should be the first middleware * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, @@ -44,10 +43,9 @@ class SendResponseHandler implements MiddlewareInterface /** * Checks if headers have been sent * - * @return bool * @codeCoverageIgnore */ - protected function headersSent() + protected function headersSent(): bool { return headers_sent(); } @@ -57,7 +55,7 @@ class SendResponseHandler implements MiddlewareInterface * * @codeCoverageIgnore */ - protected function sendHeader(string $content, bool $replace = true, int $code = null) + protected function sendHeader(string $content, bool $replace = true, int $code = null): void { if (is_null($code)) { header($content, $replace); diff --git a/src/Middleware/SessionHandler.php b/src/Middleware/SessionHandler.php index 77fca0b4..4b4a0dcc 100644 --- a/src/Middleware/SessionHandler.php +++ b/src/Middleware/SessionHandler.php @@ -26,9 +26,6 @@ class SessionHandler implements MiddlewareInterface $this->session = $session; } - /** - * @return ResponseInterface - */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $requestPath = $request->getAttribute('route-request-path'); @@ -48,10 +45,9 @@ class SessionHandler implements MiddlewareInterface } /** - * @return bool * @codeCoverageIgnore */ - protected function destroyNative() + protected function destroyNative(): bool { return session_destroy(); } diff --git a/src/Middleware/SessionHandlerServiceProvider.php b/src/Middleware/SessionHandlerServiceProvider.php index e389ec30..2fa141f4 100644 --- a/src/Middleware/SessionHandlerServiceProvider.php +++ b/src/Middleware/SessionHandlerServiceProvider.php @@ -6,7 +6,7 @@ use Engelsystem\Container\ServiceProvider; class SessionHandlerServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->app ->when(SessionHandler::class) diff --git a/src/Middleware/SetLocale.php b/src/Middleware/SetLocale.php index f9d957ef..e8040735 100644 --- a/src/Middleware/SetLocale.php +++ b/src/Middleware/SetLocale.php @@ -31,7 +31,6 @@ class SetLocale implements MiddlewareInterface /** * Process an incoming server request and setting the locale if required * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { diff --git a/src/Middleware/VerifyCsrfToken.php b/src/Middleware/VerifyCsrfToken.php index 3aed2208..bc36182b 100644 --- a/src/Middleware/VerifyCsrfToken.php +++ b/src/Middleware/VerifyCsrfToken.php @@ -22,7 +22,6 @@ class VerifyCsrfToken implements MiddlewareInterface /** * Verify csrf tokens * - * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { @@ -36,9 +35,6 @@ class VerifyCsrfToken implements MiddlewareInterface throw new HttpAuthExpired('Authentication Token Mismatch'); } - /** - * @return bool - */ protected function isReading(ServerRequestInterface $request): bool { return in_array( @@ -47,9 +43,6 @@ class VerifyCsrfToken implements MiddlewareInterface ); } - /** - * @return bool - */ protected function tokensMatch(ServerRequestInterface $request): bool { $token = null; diff --git a/src/Models/EventConfig.php b/src/Models/EventConfig.php index bf154b6c..34c0e4a7 100644 --- a/src/Models/EventConfig.php +++ b/src/Models/EventConfig.php @@ -45,9 +45,8 @@ class EventConfig extends BaseModel /** * Value accessor * - * @return mixed */ - public function getValueAttribute(mixed $value) + public function getValueAttribute(mixed $value): mixed { $value = $value ? $this->fromJson($value) : null; @@ -69,7 +68,7 @@ class EventConfig extends BaseModel * * @return static */ - public function setValueAttribute(mixed $value) + public function setValueAttribute(mixed $value): static { if (!empty($value)) { switch ($this->getValueCast($this->name)) { @@ -93,9 +92,8 @@ class EventConfig extends BaseModel /** * Check if the value has to be casted * - * @return string|null */ - protected function getValueCast(string $value) + protected function getValueCast(string $value): ?string { return isset($this->valueCasts[$value]) ? $this->valueCasts[$value] : null; } diff --git a/src/Models/Group.php b/src/Models/Group.php index bc237dff..2c901469 100644 --- a/src/Models/Group.php +++ b/src/Models/Group.php @@ -29,17 +29,11 @@ class Group extends BaseModel 'name', ]; - /** - * @return BelongsToMany - */ public function privileges(): BelongsToMany { return $this->belongsToMany(Privilege::class, 'group_privileges'); } - /** - * @return BelongsToMany - */ public function users(): BelongsToMany { return $this->belongsToMany(User::class, 'users_groups'); diff --git a/src/Models/LogEntry.php b/src/Models/LogEntry.php index 304200bd..789c0b13 100644 --- a/src/Models/LogEntry.php +++ b/src/Models/LogEntry.php @@ -40,7 +40,7 @@ class LogEntry extends BaseModel /** * @return Builder[]|Collection|SupportCollection|LogEntry[] */ - public static function filter(string $keyword = null) + public static function filter(string $keyword = null): array|Collection|SupportCollection { $query = self::query() ->select() diff --git a/src/Models/Message.php b/src/Models/Message.php index 3e433c22..d7947e9f 100644 --- a/src/Models/Message.php +++ b/src/Models/Message.php @@ -58,17 +58,11 @@ class Message extends BaseModel 'read' => false, ]; - /** - * @return BelongsTo - */ public function sender(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } - /** - * @return BelongsTo - */ public function receiver(): BelongsTo { return $this->belongsTo(User::class, 'receiver_id'); diff --git a/src/Models/News.php b/src/Models/News.php index fa35c28e..b76680fc 100644 --- a/src/Models/News.php +++ b/src/Models/News.php @@ -62,18 +62,12 @@ class News extends BaseModel 'user_id', ]; - /** - * @return HasMany - */ public function comments(): HasMany { return $this->hasMany(NewsComment::class) ->orderBy('created_at'); } - /** - * @return string - */ public function text(bool $showMore = true): string { if ($showMore || !Str::contains($this->text, 'more')) { diff --git a/src/Models/NewsComment.php b/src/Models/NewsComment.php index e0ccedb4..5634c745 100644 --- a/src/Models/NewsComment.php +++ b/src/Models/NewsComment.php @@ -47,9 +47,6 @@ class NewsComment extends BaseModel 'user_id', ]; - /** - * @return BelongsTo - */ public function news(): BelongsTo { return $this->belongsTo(News::class); diff --git a/src/Models/Privilege.php b/src/Models/Privilege.php index 500e043a..5189acba 100644 --- a/src/Models/Privilege.php +++ b/src/Models/Privilege.php @@ -30,9 +30,6 @@ class Privilege extends BaseModel 'description', ]; - /** - * @return BelongsToMany - */ public function groups(): BelongsToMany { return $this->belongsToMany(Group::class, 'group_privileges'); diff --git a/src/Models/Question.php b/src/Models/Question.php index 51be1cc6..15513947 100644 --- a/src/Models/Question.php +++ b/src/Models/Question.php @@ -56,17 +56,11 @@ class Question extends BaseModel 'answerer_id' => 'integer', ]; - /** - * @return BelongsTo - */ public function answerer(): BelongsTo { return $this->belongsTo(User::class, 'answerer_id'); } - /** - * @return Builder - */ public static function unanswered(): Builder { return static::whereAnswererId(null); diff --git a/src/Models/Shifts/Schedule.php b/src/Models/Shifts/Schedule.php index 0fd5cd39..88d956cb 100644 --- a/src/Models/Shifts/Schedule.php +++ b/src/Models/Shifts/Schedule.php @@ -55,17 +55,11 @@ class Schedule extends BaseModel 'minutes_after', ]; - /** - * @return HasMany - */ public function scheduleShifts(): HasMany { return $this->hasMany(ScheduleShift::class); } - /** - * @return BelongsTo - */ public function shiftType(): BelongsTo { return $this->belongsTo(ShiftType::class, 'shift_type', 'id'); diff --git a/src/Models/Shifts/ScheduleShift.php b/src/Models/Shifts/ScheduleShift.php index 8bfd726b..4bd131e3 100644 --- a/src/Models/Shifts/ScheduleShift.php +++ b/src/Models/Shifts/ScheduleShift.php @@ -34,10 +34,7 @@ class ScheduleShift extends BaseModel 'schedule_id' => 'integer', ]; - /** - * @return BelongsTo - */ - public function schedule() + public function schedule(): BelongsTo { return $this->belongsTo(Schedule::class); } diff --git a/src/Models/Shifts/ShiftType.php b/src/Models/Shifts/ShiftType.php index a80abf6c..ffe5fd9c 100644 --- a/src/Models/Shifts/ShiftType.php +++ b/src/Models/Shifts/ShiftType.php @@ -31,9 +31,6 @@ class ShiftType extends BaseModel 'description', ]; - /** - * @return HasMany - */ public function schedules(): HasMany { return $this->hasMany(Schedule::class, 'shift_type'); diff --git a/src/Models/User/License.php b/src/Models/User/License.php index bb8166c2..a5e0e535 100644 --- a/src/Models/User/License.php +++ b/src/Models/User/License.php @@ -61,7 +61,6 @@ class License extends HasUserModel /** * If the user wants to drive at the event * - * @return bool */ public function wantsToDrive(): bool { diff --git a/src/Models/User/User.php b/src/Models/User/User.php index fcab6984..0cecf0cf 100644 --- a/src/Models/User/User.php +++ b/src/Models/User/User.php @@ -90,42 +90,30 @@ class User extends BaseModel 'last_login_at', ]; - /** - * @return HasOne - */ - public function contact() + public function contact(): HasOne { return $this ->hasOne(Contact::class) ->withDefault(); } - /** - * @return BelongsToMany - */ public function groups(): BelongsToMany { return $this->belongsToMany(Group::class, 'users_groups'); } - /** - * @return HasOne - */ - public function license() + public function license(): HasOne { return $this ->hasOne(License::class) ->withDefault(); } - /** - * @return Builder - */ public function privileges(): Builder { /** @var Builder $builder */ $builder = Privilege::query() - ->whereIn('id', function ($query) { + ->whereIn('id', function ($query): void { /** @var QueryBuilder $query */ $query->select('privilege_id') ->from('group_privileges') @@ -137,47 +125,32 @@ class User extends BaseModel return $builder; } - /** - * @return SupportCollection - */ public function getPrivilegesAttribute(): SupportCollection { return $this->privileges()->get(); } - /** - * @return HasOne - */ - public function personalData() + public function personalData(): HasOne { return $this ->hasOne(PersonalData::class) ->withDefault(); } - /** - * @return HasOne - */ - public function settings() + public function settings(): HasOne { return $this ->hasOne(Settings::class) ->withDefault(); } - /** - * @return HasOne - */ - public function state() + public function state(): HasOne { return $this ->hasOne(State::class) ->withDefault(); } - /** - * @return BelongsToMany - */ public function userAngelTypes(): BelongsToMany { return $this @@ -186,9 +159,6 @@ class User extends BaseModel ->withPivot(UserAngelType::getPivotAttributes()); } - /** - * @return bool - */ public function isAngelTypeSupporter(AngelType $angelType): bool { return $this->userAngelTypes() @@ -197,67 +167,43 @@ class User extends BaseModel ->exists(); } - /** - * @return HasMany - */ public function news(): HasMany { return $this->hasMany(News::class); } - /** - * @return HasMany - */ public function newsComments(): HasMany { return $this->hasMany(NewsComment::class); } - /** - * @return HasMany - */ public function oauth(): HasMany { return $this->hasMany(OAuth::class); } - /** - * @return HasMany - */ public function worklogs(): HasMany { return $this->hasMany(Worklog::class); } - /** - * @return HasMany - */ public function worklogsCreated(): HasMany { return $this->hasMany(Worklog::class, 'creator_id'); } - /** - * @return HasMany - */ public function questionsAsked(): HasMany { return $this->hasMany(Question::class, 'user_id') ->where('user_id', $this->id); } - /** - * @return HasMany - */ public function questionsAnswered(): HasMany { return $this->hasMany(Question::class, 'answerer_id') ->where('answerer_id', $this->id); } - /** - * @return HasMany - */ public function messagesSent(): HasMany { return $this->hasMany(Message::class, 'user_id') @@ -279,7 +225,6 @@ class User extends BaseModel /** * Returns a HasMany relation for all messages sent or received by the user. * - * @return HasMany */ public function messages(): HasMany { diff --git a/src/Models/User/UsesUserModel.php b/src/Models/User/UsesUserModel.php index e0f3678f..912fffbf 100644 --- a/src/Models/User/UsesUserModel.php +++ b/src/Models/User/UsesUserModel.php @@ -17,10 +17,7 @@ trait UsesUserModel // protected $fillable = ['user_id']; // protected $casts = ['user_id' => 'integer]; - /** - * @return BelongsTo - */ - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/src/Models/Worklog.php b/src/Models/Worklog.php index 3d9cf12a..92d57ab9 100644 --- a/src/Models/Worklog.php +++ b/src/Models/Worklog.php @@ -55,9 +55,6 @@ class Worklog extends BaseModel 'worked_at', ]; - /** - * @return BelongsTo - */ public function creator(): BelongsTo { return $this->belongsTo(User::class, 'creator_id'); diff --git a/src/Renderer/EngineInterface.php b/src/Renderer/EngineInterface.php index a231afbe..746b23f3 100644 --- a/src/Renderer/EngineInterface.php +++ b/src/Renderer/EngineInterface.php @@ -8,13 +8,9 @@ interface EngineInterface * Render a template * * @param mixed[] $data - * @return string */ public function get(string $path, array $data = []): string; - /** - * @return bool - */ public function canRender(string $path): bool; /** diff --git a/src/Renderer/HtmlEngine.php b/src/Renderer/HtmlEngine.php index f443bdb0..1bc0cce3 100644 --- a/src/Renderer/HtmlEngine.php +++ b/src/Renderer/HtmlEngine.php @@ -8,7 +8,6 @@ class HtmlEngine extends Engine * Render a template * * @param mixed[] $data - * @return string */ public function get(string $path, array $data = []): string { @@ -24,9 +23,6 @@ class HtmlEngine extends Engine return $template; } - /** - * @return bool - */ public function canRender(string $path): bool { return mb_strpos($path, '.htm') !== false && file_exists($path); diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php index 57562dc6..2234e69e 100644 --- a/src/Renderer/Renderer.php +++ b/src/Renderer/Renderer.php @@ -15,7 +15,6 @@ class Renderer * Render a template * * @param mixed[] $data - * @return string */ public function render(string $template, array $data = []): string { diff --git a/src/Renderer/RendererServiceProvider.php b/src/Renderer/RendererServiceProvider.php index 2e41837b..6fbafdf2 100644 --- a/src/Renderer/RendererServiceProvider.php +++ b/src/Renderer/RendererServiceProvider.php @@ -6,13 +6,13 @@ use Engelsystem\Container\ServiceProvider; class RendererServiceProvider extends ServiceProvider { - public function register() + public function register(): void { $this->registerRenderer(); $this->registerHtmlEngine(); } - public function boot() + public function boot(): void { $renderer = $this->app->get('renderer'); @@ -21,14 +21,14 @@ class RendererServiceProvider extends ServiceProvider } } - protected function registerRenderer() + protected function registerRenderer(): void { $renderer = $this->app->make(Renderer::class); $this->app->instance(Renderer::class, $renderer); $this->app->instance('renderer', $renderer); } - protected function registerHtmlEngine() + protected function registerHtmlEngine(): void { $htmlEngine = $this->app->make(HtmlEngine::class); $this->app->instance(HtmlEngine::class, $htmlEngine); diff --git a/src/Renderer/Twig/Extensions/Assets.php b/src/Renderer/Twig/Extensions/Assets.php index 9615ea50..f5d573b9 100644 --- a/src/Renderer/Twig/Extensions/Assets.php +++ b/src/Renderer/Twig/Extensions/Assets.php @@ -32,9 +32,6 @@ class Assets extends TwigExtension ]; } - /** - * @return string - */ public function getAsset(string $path): string { $path = ltrim($path, '/'); diff --git a/src/Renderer/Twig/Extensions/Authentication.php b/src/Renderer/Twig/Extensions/Authentication.php index 195e1d6b..1b181fa9 100644 --- a/src/Renderer/Twig/Extensions/Authentication.php +++ b/src/Renderer/Twig/Extensions/Authentication.php @@ -28,17 +28,11 @@ class Authentication extends TwigExtension ]; } - /** - * @return bool - */ public function isAuthenticated(): bool { return (bool)$this->auth->user(); } - /** - * @return bool - */ public function isGuest(): bool { return !$this->isAuthenticated(); diff --git a/src/Renderer/Twig/Extensions/Csrf.php b/src/Renderer/Twig/Extensions/Csrf.php index 83d8f8f5..22d8aa74 100644 --- a/src/Renderer/Twig/Extensions/Csrf.php +++ b/src/Renderer/Twig/Extensions/Csrf.php @@ -27,17 +27,11 @@ class Csrf extends TwigExtension ]; } - /** - * @return string - */ public function getCsrfField(): string { return sprintf('', $this->getCsrfToken()); } - /** - * @return string - */ public function getCsrfToken(): string { return $this->session->get('_token'); diff --git a/src/Renderer/Twig/Extensions/Develop.php b/src/Renderer/Twig/Extensions/Develop.php index 9740b0eb..7f5e0696 100644 --- a/src/Renderer/Twig/Extensions/Develop.php +++ b/src/Renderer/Twig/Extensions/Develop.php @@ -35,9 +35,6 @@ class Develop extends TwigExtension ]; } - /** - * @return string - */ public function dump(mixed ...$vars): string { ob_start(); @@ -49,9 +46,6 @@ class Develop extends TwigExtension return ob_get_clean(); } - /** - * @return string - */ public function dd(mixed ...$vars): string { $this->flushBuffers(); @@ -63,7 +57,7 @@ class Develop extends TwigExtension return ''; } - public function setDumper(VarDumper $dumper) + public function setDumper(VarDumper $dumper): void { $this->dumper = $dumper; } @@ -71,7 +65,7 @@ class Develop extends TwigExtension /** * @codeCoverageIgnore */ - protected function exit() + protected function exit(): void { exit(1); } @@ -79,7 +73,7 @@ class Develop extends TwigExtension /** * @codeCoverageIgnore */ - protected function flushBuffers() + protected function flushBuffers(): void { ob_end_flush(); } diff --git a/src/Renderer/Twig/Extensions/Legacy.php b/src/Renderer/Twig/Extensions/Legacy.php index 84ff035a..ecf8eb8f 100644 --- a/src/Renderer/Twig/Extensions/Legacy.php +++ b/src/Renderer/Twig/Extensions/Legacy.php @@ -32,9 +32,6 @@ class Legacy extends TwigExtension ]; } - /** - * @return string - */ public function getPage(): string { if ($this->request->has('p')) { diff --git a/src/Renderer/Twig/Extensions/Markdown.php b/src/Renderer/Twig/Extensions/Markdown.php index 45094ed2..6a3d661c 100644 --- a/src/Renderer/Twig/Extensions/Markdown.php +++ b/src/Renderer/Twig/Extensions/Markdown.php @@ -29,10 +29,6 @@ class Markdown extends TwigExtension ]; } - /** - * - * @return string - */ public function render(string $text, bool $escapeHtml = true): string { return $this->renderer->setSafeMode($escapeHtml)->text($text); diff --git a/src/Renderer/Twig/Extensions/Url.php b/src/Renderer/Twig/Extensions/Url.php index c8050e0b..d2267df0 100644 --- a/src/Renderer/Twig/Extensions/Url.php +++ b/src/Renderer/Twig/Extensions/Url.php @@ -28,7 +28,6 @@ class Url extends TwigExtension /** * @param array $parameters - * @return string */ public function getUrl(string $path, array $parameters = []): string { diff --git a/src/Renderer/TwigEngine.php b/src/Renderer/TwigEngine.php index 69c96858..b93e07ec 100644 --- a/src/Renderer/TwigEngine.php +++ b/src/Renderer/TwigEngine.php @@ -21,7 +21,6 @@ class TwigEngine extends Engine * Render a twig template * * @param array $data - * @return string * @throws LoaderError|RuntimeError|SyntaxError */ public function get(string $path, array $data = []): string @@ -31,9 +30,6 @@ class TwigEngine extends Engine return $this->twig->render($path, $data); } - /** - * @return bool - */ public function canRender(string $path): bool { return $this->twig->getLoader()->exists($path); diff --git a/src/Renderer/TwigLoader.php b/src/Renderer/TwigLoader.php index 30fbdf59..2818b640 100644 --- a/src/Renderer/TwigLoader.php +++ b/src/Renderer/TwigLoader.php @@ -8,7 +8,6 @@ use Twig\Loader\FilesystemLoader as FilesystemLoader; class TwigLoader extends FilesystemLoader { /** - * @return string|null * @throws ErrorLoader */ public function findTemplate(string $name, bool $throw = true): ?string diff --git a/src/Renderer/TwigServiceProvider.php b/src/Renderer/TwigServiceProvider.php index 32331947..0431d905 100644 --- a/src/Renderer/TwigServiceProvider.php +++ b/src/Renderer/TwigServiceProvider.php @@ -39,7 +39,7 @@ class TwigServiceProvider extends ServiceProvider 'url' => Url::class, ]; - public function register() + public function register(): void { $this->registerTwigEngine(); @@ -48,7 +48,7 @@ class TwigServiceProvider extends ServiceProvider } } - public function boot() + public function boot(): void { /** @var Twig $renderer */ $renderer = $this->app->get('twig.environment'); @@ -64,7 +64,7 @@ class TwigServiceProvider extends ServiceProvider } } - protected function registerTwigEngine() + protected function registerTwigEngine(): void { $viewsPath = $this->app->get('path.views'); /** @var EngelsystemConfig $config */ @@ -102,7 +102,7 @@ class TwigServiceProvider extends ServiceProvider $this->app->tag('renderer.twigEngine', ['renderer.engine']); } - protected function registerTwigExtensions(string $class, string $alias) + protected function registerTwigExtensions(string $class, string $alias): void { $alias = 'twig.extension.' . $alias; diff --git a/src/helpers.php b/src/helpers.php index 6f1b3cab..14e633fa 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -15,9 +15,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; /** * Get the global app instance * - * @return mixed|Application */ -function app(string $id = null) +function app(string $id = null): mixed { if (is_null($id)) { return Application::getInstance(); @@ -26,17 +25,11 @@ function app(string $id = null) return Application::getInstance()->get($id); } -/** - * @return Authenticator - */ function auth(): Authenticator { return app('authenticator'); } -/** - * @return string - */ function base_path(string $path = ''): string { return app('path') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); @@ -44,7 +37,6 @@ function base_path(string $path = ''): string /** * @param array $headers - * @return Response */ function back(int $status = 302, array $headers = []): Response { @@ -57,9 +49,8 @@ function back(int $status = 302, array $headers = []): Response /** * Get or set config values * - * @return mixed|Config */ -function config(string|array $key = null, mixed $default = null) +function config(string|array $key = null, mixed $default = null): mixed { /** @var Config $config */ $config = app('config'); @@ -76,20 +67,15 @@ function config(string|array $key = null, mixed $default = null) return $config->get($key, $default); } -/** - * @return string - */ function config_path(string $path = ''): string { return app('path.config') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); } /** - * @param array $payload - * - * @return EventDispatcher + * @param array $payload */ -function event(string|object|null $event = null, array $payload = []) +function event(string|object|null $event = null, array $payload = []): array|EventDispatcher { /** @var EventDispatcher $dispatcher */ $dispatcher = app('events.dispatcher'); @@ -103,7 +89,6 @@ function event(string|object|null $event = null, array $payload = []) /** * @param array $headers - * @return Response */ function redirect(string $path, int $status = 302, array $headers = []): Response { @@ -113,10 +98,7 @@ function redirect(string $path, int $status = 302, array $headers = []): Respons return $redirect->to($path, $status, $headers); } -/** - * @return Request|mixed - */ -function request(string $key = null, mixed $default = null) +function request(string $key = null, mixed $default = null): mixed { /** @var Request $request */ $request = app('request'); @@ -130,7 +112,6 @@ function request(string $key = null, mixed $default = null) /** * @param array $headers - * @return Response */ function response(mixed $content = '', int $status = 200, array $headers = []): Response { @@ -147,10 +128,7 @@ function response(mixed $content = '', int $status = 200, array $headers = []): return $response; } -/** - * @return SessionInterface|mixed - */ -function session(string $key = null, mixed $default = null) +function session(string $key = null, mixed $default = null): mixed { /** @var SessionInterface $session */ $session = app('session'); @@ -166,9 +144,8 @@ function session(string $key = null, mixed $default = null) * Translate the given message * * @param array $replace - * @return string|Translator */ -function trans(string $key = null, array $replace = []) +function trans(string $key = null, array $replace = []): string|Translator { /** @var Translator $translator */ $translator = app('translator'); @@ -184,7 +161,6 @@ function trans(string $key = null, array $replace = []) * Translate the given message * * @param array $replace - * @return string */ function __(string $key, array $replace = []): string { @@ -198,7 +174,6 @@ function __(string $key, array $replace = []): string * Translate the given message * * @param array $replace - * @return string */ function _e(string $key, string $keyPlural, int $number, array $replace = []): string { @@ -210,9 +185,8 @@ function _e(string $key, string $keyPlural, int $number, array $replace = []): s /** * @param array $parameters - * @return UrlGeneratorInterface|string */ -function url(string $path = null, array $parameters = []) +function url(string $path = null, array $parameters = []): UrlGeneratorInterface|string { /** @var UrlGeneratorInterface $urlGenerator */ $urlGenerator = app('http.urlGenerator'); @@ -226,9 +200,8 @@ function url(string $path = null, array $parameters = []) /** * @param mixed[] $data - * @return Renderer|string */ -function view(string $template = null, array $data = []) +function view(string $template = null, array $data = []): Renderer|string { /** @var Renderer $renderer */ $renderer = app('renderer'); diff --git a/tests/Feature/Controllers/Metrics/ControllerTest.php b/tests/Feature/Controllers/Metrics/ControllerTest.php index 18ad7555..f7baad2c 100644 --- a/tests/Feature/Controllers/Metrics/ControllerTest.php +++ b/tests/Feature/Controllers/Metrics/ControllerTest.php @@ -10,7 +10,7 @@ class ControllerTest extends ApplicationFeatureTest /** * @covers \Engelsystem\Controllers\Metrics\Controller::metrics */ - public function testMetrics() + public function testMetrics(): void { config([ 'api_key' => null, diff --git a/tests/Feature/Database/DatabaseServiceProviderTest.php b/tests/Feature/Database/DatabaseServiceProviderTest.php index aa4dbc7b..c39de4e8 100644 --- a/tests/Feature/Database/DatabaseServiceProviderTest.php +++ b/tests/Feature/Database/DatabaseServiceProviderTest.php @@ -11,7 +11,7 @@ class DatabaseServiceProviderTest extends DatabaseTest /** * @covers \Engelsystem\Database\DatabaseServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { $this->app->instance('config', new Config([ 'database' => $this->getDbConfig(), diff --git a/tests/Feature/Database/DatabaseTest.php b/tests/Feature/Database/DatabaseTest.php index 0116e526..6c44d739 100644 --- a/tests/Feature/Database/DatabaseTest.php +++ b/tests/Feature/Database/DatabaseTest.php @@ -11,7 +11,7 @@ abstract class DatabaseTest extends TestCase * * @return string[] */ - protected function getDbConfig() + protected function getDbConfig(): array { $configValues = require __DIR__ . '/../../../config/config.default.php'; $configFile = __DIR__ . '/../../../config/config.php'; diff --git a/tests/Feature/Logger/LoggerTest.php b/tests/Feature/Logger/LoggerTest.php index 0c32e894..7f812655 100644 --- a/tests/Feature/Logger/LoggerTest.php +++ b/tests/Feature/Logger/LoggerTest.php @@ -15,9 +15,8 @@ class LoggerTest extends ApplicationFeatureTest { /** * @covers \Engelsystem\Logger\Logger::__construct - * @return LoggerInterface */ - public function getLogger() + public function getLogger(): LoggerInterface { $logEntry = new LogEntry(); return new Logger($logEntry); @@ -26,7 +25,7 @@ class LoggerTest extends ApplicationFeatureTest /** * @covers \Engelsystem\Logger\Logger::__construct */ - public function testImplements() + public function testImplements(): void { $this->assertInstanceOf(LoggerInterface::class, $this->getLogger()); } @@ -34,7 +33,7 @@ class LoggerTest extends ApplicationFeatureTest /** * @return string[][] */ - public function provideLogLevels() + public function provideLogLevels(): array { return [ [LogLevel::ALERT], @@ -52,7 +51,7 @@ class LoggerTest extends ApplicationFeatureTest * @covers \Engelsystem\Logger\Logger::log * @dataProvider provideLogLevels */ - public function testAllLevels(string $level) + public function testAllLevels(string $level): void { LogEntry::query()->truncate(); $logger = $this->getLogger(); @@ -67,7 +66,7 @@ class LoggerTest extends ApplicationFeatureTest /** * @covers \Engelsystem\Logger\Logger::log */ - public function testContextReplacement() + public function testContextReplacement(): void { LogEntry::query()->truncate(); $logger = $this->getLogger(); @@ -82,7 +81,7 @@ class LoggerTest extends ApplicationFeatureTest /** * @return mixed[][] */ - public function provideContextReplaceValues() + public function provideContextReplaceValues(): array { return [ ['Data and {context}', [], 'Data and {context}'], @@ -99,7 +98,7 @@ class LoggerTest extends ApplicationFeatureTest * * @param string[] $context */ - public function testContextReplaceValues(string $message, array $context, string $expected) + public function testContextReplaceValues(string $message, array $context, string $expected): void { $logger = $this->getLogger(); $logger->log(LogLevel::INFO, $message, $context); @@ -111,7 +110,7 @@ class LoggerTest extends ApplicationFeatureTest /** * @covers \Engelsystem\Logger\Logger::log */ - public function testContextToString() + public function testContextToString(): void { LogEntry::query()->truncate(); $logger = $this->getLogger(); @@ -134,7 +133,7 @@ class LoggerTest extends ApplicationFeatureTest * @covers \Engelsystem\Logger\Logger::checkLevel * @covers \Engelsystem\Logger\Logger::log */ - public function testThrowExceptionOnInvalidLevel() + public function testThrowExceptionOnInvalidLevel(): void { $logger = $this->getLogger(); @@ -146,7 +145,7 @@ class LoggerTest extends ApplicationFeatureTest * @covers \Engelsystem\Logger\Logger::formatException * @covers \Engelsystem\Logger\Logger::log */ - public function testWithException() + public function testWithException(): void { $logger = $this->getLogger(); @@ -162,10 +161,7 @@ class LoggerTest extends ApplicationFeatureTest $this->assertStringContainsString(__FUNCTION__, $entry['message']); } - /** - * @return array - */ - protected function getLastEntry() + protected function getLastEntry(): LogEntry { return LogEntry::all()->last(); } diff --git a/tests/Feature/Model/LogEntryTest.php b/tests/Feature/Model/LogEntryTest.php index f6ba962b..e004984e 100644 --- a/tests/Feature/Model/LogEntryTest.php +++ b/tests/Feature/Model/LogEntryTest.php @@ -11,7 +11,7 @@ class LogEntryTest extends ApplicationFeatureTest /** * @covers \Engelsystem\Models\LogEntry::filter */ - public function testFilter() + public function testFilter(): void { foreach ( [ diff --git a/tests/Unit/ApplicationTest.php b/tests/Unit/ApplicationTest.php index 0d6db0ab..1f49f869 100644 --- a/tests/Unit/ApplicationTest.php +++ b/tests/Unit/ApplicationTest.php @@ -18,7 +18,7 @@ class ApplicationTest extends TestCase * @covers \Engelsystem\Application::__construct * @covers \Engelsystem\Application::registerBaseBindings */ - public function testConstructor() + public function testConstructor(): void { $app = new Application('.'); @@ -38,7 +38,7 @@ class ApplicationTest extends TestCase * @covers \Engelsystem\Application::registerPaths * @covers \Engelsystem\Application::setAppPath */ - public function testAppPath() + public function testAppPath(): void { $app = new Application(); @@ -68,7 +68,7 @@ class ApplicationTest extends TestCase /** * @covers \Engelsystem\Application::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); @@ -91,7 +91,7 @@ class ApplicationTest extends TestCase /** * @covers \Engelsystem\Application::register */ - public function testRegisterBoot() + public function testRegisterBoot(): void { $app = new Application(); $app->bootstrap(); @@ -108,7 +108,7 @@ class ApplicationTest extends TestCase /** * @covers \Engelsystem\Application::register */ - public function testRegisterClassName() + public function testRegisterClassName(): void { $app = new Application(); @@ -130,7 +130,7 @@ class ApplicationTest extends TestCase * @covers \Engelsystem\Application::getMiddleware * @covers \Engelsystem\Application::isBooted */ - public function testBootstrap() + public function testBootstrap(): void { /** @var Application|MockObject $app */ $app = $this->getMockBuilder(Application::class) @@ -170,9 +170,8 @@ class ApplicationTest extends TestCase /** * @param array $methods - * @return ServiceProvider|MockObject */ - protected function mockServiceProvider(Application $app, array $methods = []) + protected function mockServiceProvider(Application $app, array $methods = []): ServiceProvider|MockObject { return $this->getMockBuilder(ServiceProvider::class) ->setConstructorArgs([$app]) diff --git a/tests/Unit/Config/ConfigServiceProviderTest.php b/tests/Unit/Config/ConfigServiceProviderTest.php index 43efcd01..c423f6f1 100644 --- a/tests/Unit/Config/ConfigServiceProviderTest.php +++ b/tests/Unit/Config/ConfigServiceProviderTest.php @@ -21,7 +21,7 @@ class ConfigServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Config\ConfigServiceProvider::getConfigPath * @covers \Engelsystem\Config\ConfigServiceProvider::register */ - public function testRegister() + public function testRegister(): void { /** @var Application|MockObject $app */ /** @var Config|MockObject $config */ @@ -50,7 +50,7 @@ class ConfigServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Config\ConfigServiceProvider::register */ - public function testRegisterException() + public function testRegisterException(): void { /** @var Application|MockObject $app */ /** @var Config|MockObject $config */ @@ -69,7 +69,7 @@ class ConfigServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Config\ConfigServiceProvider::__construct * @covers \Engelsystem\Config\ConfigServiceProvider::boot */ - public function testBoot() + public function testBoot(): void { $app = $this->getApp(['get']); @@ -131,7 +131,7 @@ class ConfigServiceProviderTest extends ServiceProviderTest /** * @return Application[]|Config[] */ - protected function getConfiguredApp(string $configPath) + protected function getConfiguredApp(string $configPath): array { /** @var Config|MockObject $config */ $config = $this->getMockBuilder(Config::class) diff --git a/tests/Unit/Config/ConfigTest.php b/tests/Unit/Config/ConfigTest.php index 043599fd..81918794 100644 --- a/tests/Unit/Config/ConfigTest.php +++ b/tests/Unit/Config/ConfigTest.php @@ -10,7 +10,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::get */ - public function testGet() + public function testGet(): void { $config = new Config(); @@ -26,7 +26,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::set */ - public function testSet() + public function testSet(): void { $config = new Config(); @@ -44,7 +44,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::has */ - public function testHas() + public function testHas(): void { $config = new Config(); @@ -57,7 +57,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::remove */ - public function testRemove() + public function testRemove(): void { $config = new Config(); $config->set(['foo' => 'bar', 'test' => '123']); @@ -69,7 +69,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::__get */ - public function testMagicGet() + public function testMagicGet(): void { $config = new Config(); @@ -80,7 +80,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::__set */ - public function testMagicSet() + public function testMagicSet(): void { $config = new Config(); @@ -91,7 +91,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::__isset */ - public function testMagicIsset() + public function testMagicIsset(): void { $config = new Config(); @@ -104,7 +104,7 @@ class ConfigTest extends TestCase /** * @covers \Engelsystem\Config\Config::__unset */ - public function testMagicUnset() + public function testMagicUnset(): void { $config = new Config(); $config->set(['foo' => 'bar', 'test' => '123']); diff --git a/tests/Unit/Config/RoutesFileTest.php b/tests/Unit/Config/RoutesFileTest.php index a1cb3117..dbeb0d9c 100644 --- a/tests/Unit/Config/RoutesFileTest.php +++ b/tests/Unit/Config/RoutesFileTest.php @@ -11,7 +11,7 @@ class RoutesFileTest extends TestCase /** * @doesNotPerformAssertions */ - public function testLoadRoutes() + public function testLoadRoutes(): void { /** @var RouteCollector|MockObject $route */ $route = $this->getMockBuilder(RouteCollector::class) @@ -23,7 +23,7 @@ class RoutesFileTest extends TestCase /** @see RouteCollector::addRoute */ $route->expects($this->any()) ->method('addRoute') - ->willReturnCallback(function ($httpMethod, $route, $handler) { + ->willReturnCallback(function ($httpMethod, $route, $handler): void { /** * @param string|string[] $httpMethod * @param string $route diff --git a/tests/Unit/Container/ServiceProviderTest.php b/tests/Unit/Container/ServiceProviderTest.php index 14b631c0..78745ad2 100644 --- a/tests/Unit/Container/ServiceProviderTest.php +++ b/tests/Unit/Container/ServiceProviderTest.php @@ -13,7 +13,7 @@ class ServiceProviderTest extends ServiceProviderTestCase * @covers \Engelsystem\Container\ServiceProvider::register * @covers \Engelsystem\Container\ServiceProvider::boot */ - public function testRegister() + public function testRegister(): void { $app = $this->getApp(); diff --git a/tests/Unit/Controllers/Admin/FaqControllerTest.php b/tests/Unit/Controllers/Admin/FaqControllerTest.php index 8351da9c..a0c1d4bd 100644 --- a/tests/Unit/Controllers/Admin/FaqControllerTest.php +++ b/tests/Unit/Controllers/Admin/FaqControllerTest.php @@ -23,7 +23,7 @@ class FaqControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\FaqController::edit * @covers \Engelsystem\Controllers\Admin\FaqController::showEdit */ - public function testEdit() + public function testEdit(): void { $this->request->attributes->set('faq_id', 1); $this->response->expects($this->once()) @@ -48,7 +48,7 @@ class FaqControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\FaqController::save */ - public function testSaveCreateInvalid() + public function testSaveCreateInvalid(): void { /** @var FaqController $controller */ $this->expectException(ValidationException::class); @@ -61,7 +61,7 @@ class FaqControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\FaqController::save */ - public function testSaveCreateEdit() + public function testSaveCreateEdit(): void { $this->request->attributes->set('faq_id', 2); $body = $this->data; @@ -93,7 +93,7 @@ class FaqControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\FaqController::save */ - public function testSavePreview() + public function testSavePreview(): void { $this->request->attributes->set('faq_id', 1); $this->request = $this->request->withParsedBody([ @@ -130,7 +130,7 @@ class FaqControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\FaqController::save */ - public function testSaveDelete() + public function testSaveDelete(): void { $this->request->attributes->set('faq_id', 1); $this->request = $this->request->withParsedBody([ diff --git a/tests/Unit/Controllers/Admin/LogsControllerTest.php b/tests/Unit/Controllers/Admin/LogsControllerTest.php index 2f6676b9..544ba688 100644 --- a/tests/Unit/Controllers/Admin/LogsControllerTest.php +++ b/tests/Unit/Controllers/Admin/LogsControllerTest.php @@ -19,7 +19,7 @@ class LogsControllerTest extends TestCase * @covers \Engelsystem\Controllers\Admin\LogsController::index * @covers \Engelsystem\Controllers\Admin\LogsController::__construct */ - public function testIndex() + public function testIndex(): void { $log = new LogEntry(); $alert = $log->create(['level' => LogLevel::ALERT, 'message' => 'Alert test']); diff --git a/tests/Unit/Controllers/Admin/NewsControllerTest.php b/tests/Unit/Controllers/Admin/NewsControllerTest.php index 0fcedbef..3243005f 100644 --- a/tests/Unit/Controllers/Admin/NewsControllerTest.php +++ b/tests/Unit/Controllers/Admin/NewsControllerTest.php @@ -33,7 +33,7 @@ class NewsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\NewsController::edit * @covers \Engelsystem\Controllers\Admin\NewsController::showEdit */ - public function testEdit() + public function testEdit(): void { $this->request->attributes->set('news_id', 1); $this->response->expects($this->once()) @@ -58,7 +58,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\NewsController::edit */ - public function testEditIsMeeting() + public function testEditIsMeeting(): void { $isMeeting = false; $this->response->expects($this->exactly(3)) @@ -90,7 +90,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\NewsController::save */ - public function testSaveCreateInvalid() + public function testSaveCreateInvalid(): void { /** @var NewsController $controller */ $controller = $this->app->make(NewsController::class); @@ -123,7 +123,7 @@ class NewsControllerTest extends ControllerTest string $text, bool $isMeeting, int $id = null - ) { + ): void { $this->request->attributes->set('news_id', $id); $id = $id ?: 2; $body = [ @@ -162,7 +162,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\NewsController::save */ - public function testSavePreview() + public function testSavePreview(): void { $this->request->attributes->set('news_id', 1); $this->request = $this->request->withParsedBody([ @@ -205,7 +205,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\NewsController::save */ - public function testSaveDelete() + public function testSaveDelete(): void { $this->request->attributes->set('news_id', 1); $this->request = $this->request->withParsedBody([ @@ -235,7 +235,7 @@ class NewsControllerTest extends ControllerTest /** * Creates a new user */ - protected function addUser() + protected function addUser(): void { $user = User::factory(['id' => 42])->create(); @@ -255,6 +255,9 @@ class NewsControllerTest extends ControllerTest $this->app->instance(Authenticator::class, $this->auth); $eventDispatcher = $this->createMock(EventDispatcher::class); + $eventDispatcher->expects(self::any()) + ->method('dispatch') + ->willReturnSelf(); $this->app->instance('events.dispatcher', $eventDispatcher); (new News([ diff --git a/tests/Unit/Controllers/Admin/QuestionsControllerTest.php b/tests/Unit/Controllers/Admin/QuestionsControllerTest.php index 4f0fff68..9da14780 100644 --- a/tests/Unit/Controllers/Admin/QuestionsControllerTest.php +++ b/tests/Unit/Controllers/Admin/QuestionsControllerTest.php @@ -27,7 +27,7 @@ class QuestionsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\QuestionsController::index * @covers \Engelsystem\Controllers\Admin\QuestionsController::__construct */ - public function testIndex() + public function testIndex(): void { $this->response->expects($this->once()) ->method('withView') @@ -50,7 +50,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::delete */ - public function testDeleteInvalidRequest() + public function testDeleteInvalidRequest(): void { /** @var QuestionsController $controller */ $controller = $this->app->get(QuestionsController::class); @@ -63,7 +63,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::delete */ - public function testDeleteNotFound() + public function testDeleteNotFound(): void { $this->request = $this->request->withParsedBody(['id' => 42, 'delete' => '1']); @@ -78,7 +78,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::delete */ - public function testDelete() + public function testDelete(): void { $this->request = $this->request->withParsedBody(['id' => 1, 'delete' => '1']); $this->setExpects($this->response, 'redirectTo', ['http://localhost/admin/questions'], $this->response); @@ -98,7 +98,7 @@ class QuestionsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\QuestionsController::edit * @covers \Engelsystem\Controllers\Admin\QuestionsController::showEdit */ - public function testEdit() + public function testEdit(): void { $this->request->attributes->set('question_id', 1); $this->response->expects($this->once()) @@ -124,7 +124,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::save */ - public function testSaveCreateInvalid() + public function testSaveCreateInvalid(): void { $this->expectException(ValidationException::class); @@ -137,7 +137,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::save */ - public function testSaveCreateEdit() + public function testSaveCreateEdit(): void { $this->request->attributes->set('question_id', 2); $body = [ @@ -168,7 +168,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::save */ - public function testSavePreview() + public function testSavePreview(): void { $this->request->attributes->set('question_id', 1); $this->request = $this->request->withParsedBody([ @@ -205,7 +205,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\QuestionsController::save */ - public function testSaveDelete() + public function testSaveDelete(): void { $this->request->attributes->set('question_id', 1); $this->request = $this->request->withParsedBody([ diff --git a/tests/Unit/Controllers/Admin/UserShirtControllerTest.php b/tests/Unit/Controllers/Admin/UserShirtControllerTest.php index 4f23804a..0217e14a 100644 --- a/tests/Unit/Controllers/Admin/UserShirtControllerTest.php +++ b/tests/Unit/Controllers/Admin/UserShirtControllerTest.php @@ -22,7 +22,7 @@ class UserShirtControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\UserShirtController::editShirt * @covers \Engelsystem\Controllers\Admin\UserShirtController::__construct */ - public function testIndex() + public function testIndex(): void { $request = $this->request->withAttribute('user_id', 1); /** @var Authenticator|MockObject $auth */ @@ -42,7 +42,7 @@ class UserShirtControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserShirtController::editShirt */ - public function testIndexUserNotFound() + public function testIndexUserNotFound(): void { /** @var Authenticator|MockObject $auth */ $auth = $this->createMock(Authenticator::class); @@ -59,7 +59,7 @@ class UserShirtControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserShirtController::saveShirt */ - public function testSaveShirt() + public function testSaveShirt(): void { $request = $this->request ->withAttribute('user_id', 1) @@ -147,7 +147,7 @@ class UserShirtControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserShirtController::saveShirt */ - public function testSaveShirtUserNotFound() + public function testSaveShirtUserNotFound(): void { /** @var Authenticator|MockObject $auth */ $auth = $this->createMock(Authenticator::class); diff --git a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php index 038346a3..02187e18 100644 --- a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php +++ b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php @@ -33,7 +33,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog */ - public function testShowAddWorklogWithUnknownUserIdThrows() + public function testShowAddWorklogWithUnknownUserIdThrows(): void { $request = $this->request->withAttribute('user_id', 1234); $this->expectException(ModelNotFoundException::class); @@ -45,7 +45,7 @@ class UserWorkLogControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::__construct * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::showEditWorklog */ - public function testShowAddWorklog() + public function testShowAddWorklog(): void { $request = $this->request->withAttribute('user_id', $this->user->id); $this->response->expects($this->once()) @@ -72,7 +72,7 @@ class UserWorkLogControllerTest extends ControllerTest Carbon|null $buildup_start, Carbon|null $event_start, Carbon $suggested_work_date - ) { + ): void { $request = $this->request->withAttribute('user_id', $this->user->id); config(['buildup_start' => $buildup_start]); config(['event_start' => $event_start]); @@ -88,7 +88,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog */ - public function testShowEditWorklogWithWorkLogNotAssociatedToUserThrows() + public function testShowEditWorklogWithWorkLogNotAssociatedToUserThrows(): void { /** @var User $user2 */ $user2 = User::factory()->create(); @@ -105,7 +105,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog */ - public function testShowEditWorklog() + public function testShowEditWorklog(): void { /** @var Worklog $worklog */ $worklog = Worklog::factory([ @@ -134,7 +134,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::saveWorklog */ - public function testSaveWorklogWithUnkownUserIdThrows() + public function testSaveWorklogWithUnkownUserIdThrows(): void { $request = $this->request->withAttribute('user_id', 1234)->withParsedBody([]); $this->expectException(ModelNotFoundException::class); @@ -146,7 +146,7 @@ class UserWorkLogControllerTest extends ControllerTest * * @dataProvider invalidSaveWorkLogParams */ - public function testSaveWorklogWithInvalidParamsThrows(array $body) + public function testSaveWorklogWithInvalidParamsThrows(array $body): void { $request = $this->request->withAttribute('user_id', $this->user->id)->withParsedBody($body); $this->expectException(ValidationException::class); @@ -156,7 +156,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::saveWorklog */ - public function testSaveNewWorklog() + public function testSaveNewWorklog(): void { $work_date = Carbon::today(); $work_hours = 3.14; @@ -183,7 +183,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::saveWorklog */ - public function testOverwriteWorklogWithUnknownWorkLogIdThrows() + public function testOverwriteWorklogWithUnknownWorkLogIdThrows(): void { $body = ['work_date' => Carbon::today(), 'work_hours' => 3.14, 'comment' => 'a comment']; $request = $this->request @@ -197,7 +197,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::saveWorklog */ - public function testOverwriteWorklogWithWorkLogNotAssociatedToUserThrows() + public function testOverwriteWorklogWithWorkLogNotAssociatedToUserThrows(): void { /** @var User $user2 */ $user2 = User::factory()->create(); @@ -216,7 +216,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::saveWorklog */ - public function testOverwriteWorklog() + public function testOverwriteWorklog(): void { /** @var Worklog $worklog */ $worklog = Worklog::factory(['user_id' => $this->user->id])->create(); @@ -247,7 +247,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::showDeleteWorklog */ - public function testShowDeleteWorklogWithWorkLogNotAssociatedToUserThrows() + public function testShowDeleteWorklogWithWorkLogNotAssociatedToUserThrows(): void { /** @var User $user2 */ $user2 = User::factory()->create(); @@ -264,7 +264,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::showDeleteWorklog */ - public function testShowDeleteWorklog() + public function testShowDeleteWorklog(): void { /** @var Worklog $worklog */ $worklog = Worklog::factory(['user_id' => $this->user->id])->create(); @@ -284,7 +284,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::deleteWorklog */ - public function testDeleteWorklogWithUnknownWorkLogIdThrows() + public function testDeleteWorklogWithUnknownWorkLogIdThrows(): void { $request = $this->request ->withAttribute('user_id', $this->user->id) @@ -296,7 +296,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::deleteWorklog */ - public function testDeleteWorklogWithWorkLogNotAssociatedToUserThrows() + public function testDeleteWorklogWithWorkLogNotAssociatedToUserThrows(): void { /** @var User $user2 */ $user2 = User::factory()->create(); @@ -313,7 +313,7 @@ class UserWorkLogControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::deleteWorklog */ - public function testDeleteWorklog() + public function testDeleteWorklog(): void { /** @var Worklog $worklog */ $worklog = Worklog::factory(['user_id' => $this->user->id])->create(); diff --git a/tests/Unit/Controllers/ApiControllerTest.php b/tests/Unit/Controllers/ApiControllerTest.php index 7e437e12..15f2da7b 100644 --- a/tests/Unit/Controllers/ApiControllerTest.php +++ b/tests/Unit/Controllers/ApiControllerTest.php @@ -12,7 +12,7 @@ class ApiControllerTest extends TestCase * @covers \Engelsystem\Controllers\ApiController::__construct * @covers \Engelsystem\Controllers\ApiController::index */ - public function testIndex() + public function testIndex(): void { $controller = new ApiController(new Response()); diff --git a/tests/Unit/Controllers/AuthControllerTest.php b/tests/Unit/Controllers/AuthControllerTest.php index e3e53169..ada1a336 100644 --- a/tests/Unit/Controllers/AuthControllerTest.php +++ b/tests/Unit/Controllers/AuthControllerTest.php @@ -30,7 +30,7 @@ class AuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\AuthController::login * @covers \Engelsystem\Controllers\AuthController::showLogin */ - public function testLogin() + public function testLogin(): void { /** @var Response|MockObject $response */ $response = $this->createMock(Response::class); @@ -57,7 +57,7 @@ class AuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\AuthController::postLogin */ - public function testPostLogin() + public function testPostLogin(): void { $this->initDatabase(); @@ -127,7 +127,7 @@ class AuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\AuthController::loginUser */ - public function testLoginUser() + public function testLoginUser(): void { $this->initDatabase(); @@ -161,7 +161,7 @@ class AuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\AuthController::logout */ - public function testLogout() + public function testLogout(): void { /** @var Response $response */ /** @var SessionInterface|MockObject $session */ @@ -184,9 +184,6 @@ class AuthControllerTest extends TestCase $this->assertEquals($response, $return); } - /** - * @return User - */ protected function createUser(): User { return User::factory(['id' => 42]) @@ -197,7 +194,7 @@ class AuthControllerTest extends TestCase /** * @return array */ - protected function getMocks() + protected function getMocks(): array { $response = new Response(); /** @var SessionInterface|MockObject $session */ diff --git a/tests/Unit/Controllers/BaseControllerTest.php b/tests/Unit/Controllers/BaseControllerTest.php index 2adc9dc7..7e3da4d8 100644 --- a/tests/Unit/Controllers/BaseControllerTest.php +++ b/tests/Unit/Controllers/BaseControllerTest.php @@ -10,7 +10,7 @@ class BaseControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\BaseController::getPermissions */ - public function testGetPermissions() + public function testGetPermissions(): void { $controller = new ControllerImplementation(); diff --git a/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php b/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php index c74fe053..c90c0d17 100644 --- a/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php +++ b/tests/Unit/Controllers/ChecksArrivalsAndDeparturesTest.php @@ -63,7 +63,7 @@ class ChecksArrivalsAndDeparturesTest extends TestCase ?string $teardown, ?string $arrival, ?string $departure - ) { + ): void { config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]); config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]); @@ -83,7 +83,7 @@ class ChecksArrivalsAndDeparturesTest extends TestCase ?string $teardown, ?string $arrival, ?string $departure - ) { + ): void { config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]); config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]); @@ -103,7 +103,7 @@ class ChecksArrivalsAndDeparturesTest extends TestCase ?string $teardown, ?string $arrival, ?string $departure - ) { + ): void { config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]); config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]); @@ -123,7 +123,7 @@ class ChecksArrivalsAndDeparturesTest extends TestCase ?string $teardown, ?string $arrival, ?string $departure - ) { + ): void { config(['buildup_start' => is_null($buildup) ? null : new Carbon($buildup)]); config(['teardown_end' => is_null($teardown) ? null : new Carbon($teardown)]); diff --git a/tests/Unit/Controllers/ControllerTest.php b/tests/Unit/Controllers/ControllerTest.php index 89f23234..ddce9530 100644 --- a/tests/Unit/Controllers/ControllerTest.php +++ b/tests/Unit/Controllers/ControllerTest.php @@ -38,7 +38,7 @@ abstract class ControllerTest extends TestCase /** * @param string|null $type */ - protected function assertHasNotification(string $value, string $type = 'messages') + protected function assertHasNotification(string $value, string $type = 'messages'): void { $messages = $this->session->get($type, []); $this->assertTrue(in_array($value, $messages)); diff --git a/tests/Unit/Controllers/CreditsControllerTest.php b/tests/Unit/Controllers/CreditsControllerTest.php index 303bf60e..70bd5a3f 100644 --- a/tests/Unit/Controllers/CreditsControllerTest.php +++ b/tests/Unit/Controllers/CreditsControllerTest.php @@ -15,7 +15,7 @@ class CreditsControllerTest extends TestCase * @covers \Engelsystem\Controllers\CreditsController::__construct * @covers \Engelsystem\Controllers\CreditsController::index */ - public function testIndex() + public function testIndex(): void { /** @var Response|MockObject $response */ $response = $this->createMock(Response::class); diff --git a/tests/Unit/Controllers/DesignControllerTest.php b/tests/Unit/Controllers/DesignControllerTest.php index 3d14ea16..d8db153a 100644 --- a/tests/Unit/Controllers/DesignControllerTest.php +++ b/tests/Unit/Controllers/DesignControllerTest.php @@ -21,7 +21,7 @@ class DesignControllerTest extends TestCase * @covers \Engelsystem\Controllers\DesignController::__construct * @covers \Engelsystem\Controllers\DesignController::index */ - public function testIndex() + public function testIndex(): void { /** @var Response|MockObject $response */ $response = $this->createMock(Response::class); diff --git a/tests/Unit/Controllers/FaqControllerTest.php b/tests/Unit/Controllers/FaqControllerTest.php index 7b4f728d..44cfddc0 100644 --- a/tests/Unit/Controllers/FaqControllerTest.php +++ b/tests/Unit/Controllers/FaqControllerTest.php @@ -20,7 +20,7 @@ class FaqControllerTest extends TestCase * @covers \Engelsystem\Controllers\FaqController::__construct * @covers \Engelsystem\Controllers\FaqController::index */ - public function testIndex() + public function testIndex(): void { $this->initDatabase(); (new Faq(['question' => 'Xyz', 'text' => 'Abc']))->save(); diff --git a/tests/Unit/Controllers/HasUserNotificationsTest.php b/tests/Unit/Controllers/HasUserNotificationsTest.php index 9f9e9d25..1a6affdb 100644 --- a/tests/Unit/Controllers/HasUserNotificationsTest.php +++ b/tests/Unit/Controllers/HasUserNotificationsTest.php @@ -14,7 +14,7 @@ class HasUserNotificationsTest extends TestCase * @covers \Engelsystem\Controllers\HasUserNotifications::getNotifications * @covers \Engelsystem\Controllers\HasUserNotifications::addNotification */ - public function testNotifications() + public function testNotifications(): void { $session = new Session(new MockArraySessionStorage()); $this->app->instance('session', $session); diff --git a/tests/Unit/Controllers/HealthControllerTest.php b/tests/Unit/Controllers/HealthControllerTest.php index a3788b48..dc5e8771 100644 --- a/tests/Unit/Controllers/HealthControllerTest.php +++ b/tests/Unit/Controllers/HealthControllerTest.php @@ -13,7 +13,7 @@ class HealthControllerTest extends TestCase * @covers \Engelsystem\Controllers\HealthController::__construct * @covers \Engelsystem\Controllers\HealthController::index */ - public function testIndex() + public function testIndex(): void { /** @var Response|MockObject $response */ $response = $this->createMock(Response::class); diff --git a/tests/Unit/Controllers/HomeControllerTest.php b/tests/Unit/Controllers/HomeControllerTest.php index 53778205..c42b282a 100644 --- a/tests/Unit/Controllers/HomeControllerTest.php +++ b/tests/Unit/Controllers/HomeControllerTest.php @@ -17,7 +17,7 @@ class HomeControllerTest extends TestCase * @covers \Engelsystem\Controllers\HomeController::__construct * @covers \Engelsystem\Controllers\HomeController::index */ - public function testIndex() + public function testIndex(): void { $config = new Config(['home_site' => '/foo']); /** @var Authenticator|MockObject $auth */ diff --git a/tests/Unit/Controllers/MessagesControllerTest.php b/tests/Unit/Controllers/MessagesControllerTest.php index 210962e8..4e36e8a4 100644 --- a/tests/Unit/Controllers/MessagesControllerTest.php +++ b/tests/Unit/Controllers/MessagesControllerTest.php @@ -48,7 +48,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexUnderNormalConditionsReturnsCorrectViewAndData() + public function testIndexUnderNormalConditionsReturnsCorrectViewAndData(): void { $this->response->expects($this->once()) ->method('withView') @@ -72,7 +72,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexUsersExistReturnsUsersWithMeAtFirstPosition() + public function testIndexUsersExistReturnsUsersWithMeAtFirstPosition(): void { User::factory(['name' => '0'])->create(); // alphabetically before me ("a"), but still listed after me @@ -100,7 +100,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexWithNoConversationReturnsEmptyConversationList() + public function testIndexWithNoConversationReturnsEmptyConversationList(): void { $this->response->expects($this->once()) ->method('withView') @@ -120,7 +120,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexWithConversationConversationContainsCorrectData() + public function testIndexWithConversationConversationContainsCorrectData(): void { // save messages in wrong order to ensure latest message considers creation date, not id. $this->createMessage($this->userA, $this->userB, 'a>b', $this->now); @@ -161,7 +161,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexWithConversationsOnlyContainsConversationsWithMe() + public function testIndexWithConversationsOnlyContainsConversationsWithMe(): void { $userC = User::factory(['name' => 'c'])->create(); @@ -194,7 +194,7 @@ class MessagesControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\MessagesController::numberOfUnreadMessagesPerConversation * @covers \Engelsystem\Controllers\MessagesController::raw */ - public function testIndexWithConversationsConversationsOrderedByDate() + public function testIndexWithConversationsConversationsOrderedByDate(): void { $userC = User::factory(['name' => 'c'])->create(); $userD = User::factory(['name' => 'd'])->create(); @@ -222,7 +222,7 @@ class MessagesControllerTest extends ControllerTest * @testdox redirectToConversation: withNoUserIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::redirectToConversation */ - public function testRedirectToConversationWithNoUserIdGivenThrowsException() + public function testRedirectToConversationWithNoUserIdGivenThrowsException(): void { $this->expectException(ValidationException::class); $this->controller->redirectToConversation($this->request); @@ -232,7 +232,7 @@ class MessagesControllerTest extends ControllerTest * @testdox redirectToConversation: withUserIdGiven -> redirect * @covers \Engelsystem\Controllers\MessagesController::redirectToConversation */ - public function testRedirectToConversationWithUserIdGivenRedirect() + public function testRedirectToConversationWithUserIdGivenRedirect(): void { $this->request = $this->request->withParsedBody(['user_id' => '1']); $this->response->expects($this->once()) @@ -247,7 +247,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withNoUserIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithNoUserIdGivenThrowsException() + public function testMessagesOfConversationWithNoUserIdGivenThrowsException(): void { $this->expectException(ModelNotFoundException::class); $this->controller->messagesOfConversation($this->request); @@ -257,7 +257,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withUnknownUserIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithUnknownUserIdGivenThrowsException() + public function testMessagesOfConversationWithUnknownUserIdGivenThrowsException(): void { $this->request->attributes->set('user_id', '1234'); $this->expectException(ModelNotFoundException::class); @@ -268,7 +268,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: underNormalConditions -> returnsCorrectViewAndData * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationUnderNormalConditionsReturnsCorrectViewAndData() + public function testMessagesOfConversationUnderNormalConditionsReturnsCorrectViewAndData(): void { $this->request->attributes->set('user_id', $this->userB->id); @@ -290,7 +290,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withNoMessages -> returnsEmptyMessageList * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithNoMessagesReturnsEmptyMessageList() + public function testMessagesOfConversationWithNoMessagesReturnsEmptyMessageList(): void { $this->request->attributes->set('user_id', $this->userB->id); @@ -308,7 +308,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withMessages -> messagesOnlyWithThatUserOrderedByDate * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithMessagesMessagesOnlyWithThatUserOrderedByDate() + public function testMessagesOfConversationWithMessagesMessagesOnlyWithThatUserOrderedByDate(): void { $this->request->attributes->set('user_id', $this->userB->id); @@ -342,7 +342,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withUnreadMessages -> messagesToMeWillStillBeReturnedAsUnread * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithUnreadMessagesMessagesToMeWillStillBeReturnedAsUnread() + public function testMessagesOfConversationWithUnreadMessagesMessagesToMeWillStillBeReturnedAsUnread(): void { $this->request->attributes->set('user_id', $this->userB->id); $this->createMessage($this->userB, $this->userA, 'b>a', $this->now); @@ -360,7 +360,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withUnreadMessages -> messagesToMeWillBeMarkedAsRead * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithUnreadMessagesMessagesToMeWillBeMarkedAsRead() + public function testMessagesOfConversationWithUnreadMessagesMessagesToMeWillBeMarkedAsRead(): void { $this->request->attributes->set('user_id', $this->userB->id); $this->response->expects($this->once()) @@ -378,7 +378,7 @@ class MessagesControllerTest extends ControllerTest * @testdox messagesOfConversation: withMyUserIdGiven -> returnsMessagesFromMeToMe * @covers \Engelsystem\Controllers\MessagesController::messagesOfConversation */ - public function testMessagesOfConversationWithMyUserIdGivenReturnsMessagesFromMeToMe() + public function testMessagesOfConversationWithMyUserIdGivenReturnsMessagesFromMeToMe(): void { $this->request->attributes->set('user_id', $this->userA->id); // myself @@ -403,7 +403,7 @@ class MessagesControllerTest extends ControllerTest * @testdox send: withNoTextGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::send */ - public function testSendWithNoTextGivenThrowsException() + public function testSendWithNoTextGivenThrowsException(): void { $this->expectException(ValidationException::class); $this->controller->send($this->request); @@ -413,7 +413,7 @@ class MessagesControllerTest extends ControllerTest * @testdox send: withNoUserIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::send */ - public function testSendWithNoUserIdGivenThrowsException() + public function testSendWithNoUserIdGivenThrowsException(): void { $this->request = $this->request->withParsedBody(['text' => 'a']); $this->expectException(ModelNotFoundException::class); @@ -424,7 +424,7 @@ class MessagesControllerTest extends ControllerTest * @testdox send: withUnknownUserIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::send */ - public function testSendWithUnknownUserIdGivenThrowsException() + public function testSendWithUnknownUserIdGivenThrowsException(): void { $this->request = $this->request->withParsedBody(['text' => 'a']); $this->request->attributes->set('user_id', '1234'); @@ -436,7 +436,7 @@ class MessagesControllerTest extends ControllerTest * @testdox send: withUserAndTextGiven -> savesMessage * @covers \Engelsystem\Controllers\MessagesController::send */ - public function testSendWithUserAndTextGivenSavesMessage() + public function testSendWithUserAndTextGivenSavesMessage(): void { $this->request = $this->request->withParsedBody(['text' => 'a']); $this->request->attributes->set('user_id', $this->userB->id); @@ -458,7 +458,7 @@ class MessagesControllerTest extends ControllerTest * @testdox send: withMyUserIdGiven -> savesMessageAlreadyMarkedAsRead * @covers \Engelsystem\Controllers\MessagesController::send */ - public function testSendWithMyUserIdGivenSavesMessageAlreadyMarkedAsRead() + public function testSendWithMyUserIdGivenSavesMessageAlreadyMarkedAsRead(): void { $this->request = $this->request->withParsedBody(['text' => 'a']); $this->request->attributes->set('user_id', $this->userA->id); @@ -480,7 +480,7 @@ class MessagesControllerTest extends ControllerTest * @testdox delete: withNoMsgIdGiven -> throwsException * @covers \Engelsystem\Controllers\MessagesController::delete */ - public function testDeleteWithNoMsgIdGivenThrowsException() + public function testDeleteWithNoMsgIdGivenThrowsException(): void { $this->expectException(ModelNotFoundException::class); $this->controller->delete($this->request); @@ -490,7 +490,7 @@ class MessagesControllerTest extends ControllerTest * @testdox delete: tryingToDeleteSomeonesMessage -> throwsException * @covers \Engelsystem\Controllers\MessagesController::delete */ - public function testDeleteTryingToDeleteSomeonesMessageThrowsException() + public function testDeleteTryingToDeleteSomeonesMessageThrowsException(): void { $msg = $this->createMessage($this->userB, $this->userA, 'a>b', $this->now); $this->request->attributes->set('msg_id', $msg->id); @@ -503,7 +503,7 @@ class MessagesControllerTest extends ControllerTest * @testdox delete: tryingToDeleteMyMessage -> deletesItAndRedirect * @covers \Engelsystem\Controllers\MessagesController::delete */ - public function testDeleteTryingToDeleteMyMessageDeletesItAndRedirect() + public function testDeleteTryingToDeleteMyMessageDeletesItAndRedirect(): void { $msg = $this->createMessage($this->userA, $this->userB, 'a>b', $this->now); $this->request->attributes->set('msg_id', $msg->id); @@ -543,7 +543,7 @@ class MessagesControllerTest extends ControllerTest $this->controller->setValidator(new Validator()); } - protected function assertArrayOrCollection(mixed $obj) + protected function assertArrayOrCollection(mixed $obj): void { $this->assertTrue(gettype($obj) == 'array' || $obj instanceof Collection); } diff --git a/tests/Unit/Controllers/Metrics/ControllerTest.php b/tests/Unit/Controllers/Metrics/ControllerTest.php index 8f7b45c7..6f28be92 100644 --- a/tests/Unit/Controllers/Metrics/ControllerTest.php +++ b/tests/Unit/Controllers/Metrics/ControllerTest.php @@ -26,7 +26,7 @@ class ControllerTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Controller::metrics * @covers \Engelsystem\Controllers\Metrics\Controller::formatStats */ - public function testMetrics() + public function testMetrics(): void { /** @var Response|MockObject $response */ /** @var Request|MockObject $request */ @@ -173,7 +173,7 @@ class ControllerTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Controller::checkAuth * @covers \Engelsystem\Controllers\Metrics\Controller::stats */ - public function testStats() + public function testStats(): void { /** @var Response|MockObject $response */ /** @var Request|MockObject $request */ @@ -219,7 +219,7 @@ class ControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Controller::checkAuth */ - public function testCheckAuth() + public function testCheckAuth(): void { /** @var Response|MockObject $response */ /** @var Request|MockObject $request */ diff --git a/tests/Unit/Controllers/Metrics/MetricsEngineTest.php b/tests/Unit/Controllers/Metrics/MetricsEngineTest.php index 185b76f7..f7a0147c 100644 --- a/tests/Unit/Controllers/Metrics/MetricsEngineTest.php +++ b/tests/Unit/Controllers/Metrics/MetricsEngineTest.php @@ -15,7 +15,7 @@ class MetricsEngineTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderLabels * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderValue */ - public function testGet() + public function testGet(): void { $engine = new MetricsEngine(); @@ -60,7 +60,7 @@ class MetricsEngineTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatHistogram * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::get */ - public function testGetHistogram() + public function testGetHistogram(): void { $engine = new MetricsEngine(); @@ -141,7 +141,7 @@ EOD, /** * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::canRender */ - public function testCanRender() + public function testCanRender(): void { $engine = new MetricsEngine(); @@ -153,7 +153,7 @@ EOD, /** * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::share */ - public function testShare() + public function testShare(): void { $engine = new MetricsEngine(); diff --git a/tests/Unit/Controllers/Metrics/StatsTest.php b/tests/Unit/Controllers/Metrics/StatsTest.php index f25c3d5e..9d0b2bd3 100644 --- a/tests/Unit/Controllers/Metrics/StatsTest.php +++ b/tests/Unit/Controllers/Metrics/StatsTest.php @@ -32,7 +32,7 @@ class StatsTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Stats::__construct * @covers \Engelsystem\Controllers\Metrics\Stats::newUsers */ - public function testNewUsers() + public function testNewUsers(): void { $this->addUsers(); @@ -44,7 +44,7 @@ class StatsTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Stats::vouchers * @covers \Engelsystem\Controllers\Metrics\Stats::vouchersQuery */ - public function testVouchers() + public function testVouchers(): void { $this->addUsers(); @@ -55,7 +55,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::vouchersBuckets */ - public function testVouchersBuckets() + public function testVouchersBuckets(): void { $this->addUsers(); @@ -66,7 +66,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::tshirts */ - public function testTshirts() + public function testTshirts(): void { $this->addUsers(); @@ -78,7 +78,7 @@ class StatsTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Stats::tshirtSizes * @covers \Engelsystem\Controllers\Metrics\Stats::raw */ - public function testTshirtSizes() + public function testTshirtSizes(): void { $this->addUsers(); @@ -94,7 +94,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::languages */ - public function testLanguages() + public function testLanguages(): void { $this->addUsers(); @@ -110,7 +110,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::themes */ - public function testThemes() + public function testThemes(): void { $this->addUsers(); @@ -127,7 +127,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::licenses */ - public function testLicenses() + public function testLicenses(): void { $this->addUsers(); @@ -143,7 +143,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::worklogSeconds */ - public function testWorklogSeconds() + public function testWorklogSeconds(): void { $this->addUsers(); $worklogData = [ @@ -165,7 +165,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::rooms */ - public function testRooms() + public function testRooms(): void { (new Room(['name' => 'Room 1']))->save(); (new Room(['name' => 'Second room']))->save(); @@ -179,7 +179,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::announcements */ - public function testAnnouncements() + public function testAnnouncements(): void { $this->addUsers(); $newsData = ['title' => 'Test', 'text' => 'Foo Bar', 'user_id' => 1]; @@ -197,7 +197,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::comments */ - public function testComments() + public function testComments(): void { $user = $this->addUser(); @@ -218,7 +218,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::questions */ - public function testQuestions() + public function testQuestions(): void { $this->addUsers(); $questionsData = ['text' => 'Lorem Ipsum', 'user_id' => 1]; @@ -236,7 +236,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::arrivedUsers */ - public function testArrivedUsers() + public function testArrivedUsers(): void { $this->addUsers(); @@ -247,7 +247,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::forceActiveUsers */ - public function testForceActiveUsers() + public function testForceActiveUsers(): void { $this->addUsers(); @@ -258,7 +258,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::usersPronouns */ - public function testUsersPronouns() + public function testUsersPronouns(): void { $this->addUsers(); @@ -269,7 +269,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::email */ - public function testEmail() + public function testEmail(): void { $this->addUsers(); @@ -284,7 +284,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::faq */ - public function testFaq() + public function testFaq(): void { (new Faq(['question' => 'Foo?', 'text' => 'Bar!']))->save(); (new Faq(['question' => 'Lorem??', 'text' => 'Ipsum!!!']))->save(); @@ -296,7 +296,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::messages */ - public function testMessages() + public function testMessages(): void { $this->addUsers(); @@ -312,7 +312,7 @@ class StatsTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Stats::sessions * @covers \Engelsystem\Controllers\Metrics\Stats::getQuery */ - public function testSessions() + public function testSessions(): void { $this->database ->getConnection() @@ -331,7 +331,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::oauth */ - public function testOauth() + public function testOauth(): void { $this->addUsers(); $user1 = User::find(1); @@ -356,7 +356,7 @@ class StatsTest extends TestCase * @covers \Engelsystem\Controllers\Metrics\Stats::databaseRead * @covers \Engelsystem\Controllers\Metrics\Stats::databaseWrite */ - public function testDatabase() + public function testDatabase(): void { $stats = new Stats($this->database); @@ -372,7 +372,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::logEntries */ - public function testLogEntries() + public function testLogEntries(): void { (new LogEntry(['level' => LogLevel::INFO, 'message' => 'Some info']))->save(); (new LogEntry(['level' => LogLevel::INFO, 'message' => 'Another info']))->save(); @@ -390,7 +390,7 @@ class StatsTest extends TestCase /** * @covers \Engelsystem\Controllers\Metrics\Stats::passwordResets */ - public function testPasswordResets() + public function testPasswordResets(): void { $this->addUsers(); @@ -404,7 +404,7 @@ class StatsTest extends TestCase /** * Add some example users */ - protected function addUsers() + protected function addUsers(): void { $this->addUser(); $this->addUser([], ['shirt_size' => 'L'], ['email_human' => true, 'email_shiftinfo' => true]); @@ -432,7 +432,6 @@ class StatsTest extends TestCase * @param array $personalData * @param array $settings * - * @return User */ protected function addUser( array $state = [], diff --git a/tests/Unit/Controllers/NewsControllerTest.php b/tests/Unit/Controllers/NewsControllerTest.php index 6d0663ca..7edc7197 100644 --- a/tests/Unit/Controllers/NewsControllerTest.php +++ b/tests/Unit/Controllers/NewsControllerTest.php @@ -72,7 +72,7 @@ class NewsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\NewsController::showOverview * @covers \Engelsystem\Controllers\NewsController::renderView */ - public function testIndex() + public function testIndex(): void { $this->request->attributes->set('page', 2); @@ -127,7 +127,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::show */ - public function testShow() + public function testShow(): void { $this->request->attributes->set('news_id', 1); $this->response->expects($this->once()) @@ -144,7 +144,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::show */ - public function testShowNotFound() + public function testShowNotFound(): void { $this->request->attributes->set('news_id', 42); @@ -158,7 +158,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::comment */ - public function testCommentInvalid() + public function testCommentInvalid(): void { /** @var NewsController $controller */ $controller = $this->app->make(NewsController::class); @@ -171,7 +171,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::comment */ - public function testCommentNewsNotFound() + public function testCommentNewsNotFound(): void { $this->request->attributes->set('news_id', 42); $this->request = $this->request->withParsedBody(['comment' => 'Foo bar!']); @@ -188,7 +188,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::comment */ - public function testComment() + public function testComment(): void { $this->request->attributes->set('news_id', 1); $this->request = $this->request->withParsedBody(['comment' => 'Foo bar!']); @@ -213,7 +213,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::deleteComment */ - public function testDeleteCommentInvalidRequest() + public function testDeleteCommentInvalidRequest(): void { /** @var NewsController $controller */ $controller = $this->app->get(NewsController::class); @@ -226,7 +226,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::deleteComment */ - public function testDeleteCommentNotFound() + public function testDeleteCommentNotFound(): void { $this->request = $this->request->withAttribute('news_id', 42)->withParsedBody(['delete' => '1']); @@ -241,7 +241,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::deleteComment */ - public function testDeleteCommentNotAllowed() + public function testDeleteCommentNotAllowed(): void { $this->request = $this->request->withAttribute('comment_id', 2)->withParsedBody(['delete' => '1']); @@ -259,7 +259,7 @@ class NewsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\NewsController::deleteComment */ - public function testDeleteComment() + public function testDeleteComment(): void { $this->request = $this->request->withAttribute('comment_id', 1)->withParsedBody(['delete' => '1']); $this->setExpects($this->response, 'redirectTo', ['http://localhost/news/1'], $this->response); @@ -305,7 +305,7 @@ class NewsControllerTest extends ControllerTest /** * Creates a new user */ - protected function addUser(int $id = 42) + protected function addUser(int $id = 42): void { $user = User::factory()->create(['id' => $id]); diff --git a/tests/Unit/Controllers/OAuthControllerTest.php b/tests/Unit/Controllers/OAuthControllerTest.php index 9641fdff..3b17ceae 100644 --- a/tests/Unit/Controllers/OAuthControllerTest.php +++ b/tests/Unit/Controllers/OAuthControllerTest.php @@ -86,7 +86,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::handleArrive * @covers \Engelsystem\Controllers\OAuthController::getId */ - public function testIndexArrive() + public function testIndexArrive(): void { $request = new Request(); $request = $request @@ -126,9 +126,9 @@ class OAuthControllerTest extends TestCase $this->setExpects($provider, 'getResourceOwner', [$accessToken], $resourceOwner, $this->atLeastOnce()); /** @var EventDispatcher|MockObject $event */ - $event = $this->createMock(EventDispatcher::class); - $this->app->instance('events.dispatcher', $event); - $this->setExpects($event, 'dispatch', ['oauth2.login'], null, 4); + $dispatcher = $this->createMock(EventDispatcher::class); + $this->app->instance('events.dispatcher', $dispatcher); + $this->setExpects($dispatcher, 'dispatch', ['oauth2.login'], $dispatcher, 4); $this->authController->expects($this->atLeastOnce()) ->method('loginUser') @@ -190,7 +190,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::index * @covers \Engelsystem\Controllers\OAuthController::getProvider */ - public function testIndexRedirectToProvider() + public function testIndexRedirectToProvider(): void { $this->redirect->expects($this->once()) ->method('to') @@ -218,7 +218,7 @@ class OAuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\OAuthController::index */ - public function testIndexInvalidState() + public function testIndexInvalidState(): void { /** @var GenericProvider|MockObject $provider */ $provider = $this->createMock(GenericProvider::class); @@ -250,7 +250,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::index * @covers \Engelsystem\Controllers\OAuthController::handleOAuthError */ - public function testIndexProviderError() + public function testIndexProviderError(): void { /** @var AccessToken|MockObject $accessToken */ $accessToken = $this->createMock(AccessToken::class); @@ -321,7 +321,7 @@ class OAuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\OAuthController::index */ - public function testIndexAlreadyConnectedToAUser() + public function testIndexAlreadyConnectedToAUser(): void { $accessToken = $this->createMock(AccessToken::class); @@ -367,7 +367,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::index * @dataProvider oAuthErrorCodeProvider */ - public function testIndexOAuthErrorResponse(string $oauth_error_code) + public function testIndexOAuthErrorResponse(string $oauth_error_code): void { $controller = $this->getMock(['getProvider']); @@ -404,7 +404,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::index * @covers \Engelsystem\Controllers\OAuthController::redirectRegister */ - public function testIndexRedirectRegister() + public function testIndexRedirectRegister(): void { $accessToken = $this->createMock(AccessToken::class); $this->setExpects($accessToken, 'getToken', null, 'test-token', $this->atLeastOnce()); @@ -488,7 +488,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::getId * @covers \Engelsystem\Controllers\OAuthController::redirectRegister */ - public function testIndexRedirectRegisterNestedInfo() + public function testIndexRedirectRegisterNestedInfo(): void { $accessToken = $this->createMock(AccessToken::class); $this->setExpects($accessToken, 'getToken', null, 'test-token', $this->atLeastOnce()); @@ -567,7 +567,7 @@ class OAuthControllerTest extends TestCase * @covers \Engelsystem\Controllers\OAuthController::requireProvider * @covers \Engelsystem\Controllers\OAuthController::isValidProvider */ - public function testConnect() + public function testConnect(): void { $controller = $this->getMock(['index']); $this->setExpects($controller, 'index', null, new Response()); @@ -590,7 +590,7 @@ class OAuthControllerTest extends TestCase /** * @covers \Engelsystem\Controllers\OAuthController::disconnect */ - public function testDisconnect() + public function testDisconnect(): void { $controller = $this->getMock(['addNotification']); $this->setExpects($controller, 'addNotification', ['oauth.disconnected']); diff --git a/tests/Unit/Controllers/PasswordResetControllerTest.php b/tests/Unit/Controllers/PasswordResetControllerTest.php index 955476c3..71a3ac5f 100644 --- a/tests/Unit/Controllers/PasswordResetControllerTest.php +++ b/tests/Unit/Controllers/PasswordResetControllerTest.php @@ -215,7 +215,6 @@ class PasswordResetControllerTest extends TestCase /** * @param array $data - * @return PasswordResetController */ protected function getController(?string $view = null, ?array $data = null): PasswordResetController { @@ -250,17 +249,11 @@ class PasswordResetControllerTest extends TestCase return $controller; } - /** - * @return User - */ protected function createUser(): User { return User::factory()->create(['email' => 'foo@bar.batz']); } - /** - * @return PasswordReset - */ protected function createToken(User $user): PasswordReset { $reset = new PasswordReset(['user_id' => $user->id, 'token' => 'SomeTestToken123']); diff --git a/tests/Unit/Controllers/QuestionsControllerTest.php b/tests/Unit/Controllers/QuestionsControllerTest.php index 3e205680..44c7a9e3 100644 --- a/tests/Unit/Controllers/QuestionsControllerTest.php +++ b/tests/Unit/Controllers/QuestionsControllerTest.php @@ -27,7 +27,7 @@ class QuestionsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\QuestionsController::index * @covers \Engelsystem\Controllers\QuestionsController::__construct */ - public function testIndex() + public function testIndex(): void { $this->response->expects($this->once()) ->method('withView') @@ -48,7 +48,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::add */ - public function testAdd() + public function testAdd(): void { $this->response->expects($this->once()) ->method('withView') @@ -70,7 +70,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::delete */ - public function testDeleteNotFound() + public function testDeleteNotFound(): void { $this->request = $this->request->withParsedBody([ 'id' => '3', @@ -88,7 +88,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::delete */ - public function testDeleteNotOwn() + public function testDeleteNotOwn(): void { $otherUser = User::factory()->create(); (new Question([ @@ -111,7 +111,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::delete */ - public function testDelete() + public function testDelete(): void { $this->request = $this->request->withParsedBody([ 'id' => '2', @@ -136,7 +136,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::save */ - public function testSaveInvalid() + public function testSaveInvalid(): void { /** @var QuestionsController $controller */ $controller = $this->app->get(QuestionsController::class); @@ -149,7 +149,7 @@ class QuestionsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\QuestionsController::save */ - public function testSave() + public function testSave(): void { $this->request = $this->request->withParsedBody([ 'text' => 'Some question?', diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php index 02cb8741..56531d13 100644 --- a/tests/Unit/Controllers/SettingsControllerTest.php +++ b/tests/Unit/Controllers/SettingsControllerTest.php @@ -30,7 +30,7 @@ class SettingsControllerTest extends ControllerTest /** @var SettingsController */ protected $controller; - protected function setUpProfileTest() + protected function setUpProfileTest(): array { $body = [ 'pronoun' => 'Herr', @@ -78,7 +78,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::profile */ - public function testProfile() + public function testProfile(): void { $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); /** @var Response|MockObject $response */ @@ -99,7 +99,7 @@ class SettingsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\SettingsController::saveProfile * @covers \Engelsystem\Controllers\SettingsController::getSaveProfileRules */ - public function testSaveProfile() + public function testSaveProfile(): void { $body = $this->setUpProfileTest(); $this->controller->saveProfile($this->request); @@ -129,7 +129,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileThrowsErrorOnInvalidArrival() + public function testSaveProfileThrowsErrorOnInvalidArrival(): void { $this->setUpProfileTest(); config(['buildup_start' => new Carbon('2022-01-02')]); // arrival before buildup @@ -140,7 +140,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileThrowsErrorOnInvalidDeparture() + public function testSaveProfileThrowsErrorOnInvalidDeparture(): void { $this->setUpProfileTest(); config(['teardown_end' => new Carbon('2022-01-01')]); // departure after teardown @@ -151,7 +151,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresPronounIfDisabled() + public function testSaveProfileIgnoresPronounIfDisabled(): void { $this->setUpProfileTest(); config(['enable_pronoun' => false]); @@ -162,7 +162,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresFirstAndLastnameIfDisabled() + public function testSaveProfileIgnoresFirstAndLastnameIfDisabled(): void { $this->setUpProfileTest(); config(['enable_user_name' => false]); @@ -174,7 +174,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresArrivalDatesIfDisabled() + public function testSaveProfileIgnoresArrivalDatesIfDisabled(): void { $this->setUpProfileTest(); config(['enable_planned_arrival' => false]); @@ -186,7 +186,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresDectIfDisabled() + public function testSaveProfileIgnoresDectIfDisabled(): void { $this->setUpProfileTest(); config(['enable_dect' => false]); @@ -197,7 +197,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresMobileShowIfDisabled() + public function testSaveProfileIgnoresMobileShowIfDisabled(): void { $this->setUpProfileTest(); config(['enable_mobile_show' => false]); @@ -208,7 +208,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresEmailGoodyIfDisabled() + public function testSaveProfileIgnoresEmailGoodyIfDisabled(): void { $this->setUpProfileTest(); config(['enable_goody' => false]); @@ -219,7 +219,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::saveProfile */ - public function testSaveProfileIgnoresTShirtSizeIfDisabled() + public function testSaveProfileIgnoresTShirtSizeIfDisabled(): void { $this->setUpProfileTest(); config(['enable_tshirt_size' => false]); @@ -230,7 +230,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::password */ - public function testPassword() + public function testPassword(): void { /** @var Response|MockObject $response */ $this->response->expects($this->once()) @@ -247,7 +247,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::savePassword */ - public function testSavePassword() + public function testSavePassword(): void { $body = [ 'password' => 'password', @@ -280,7 +280,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::savePassword */ - public function testSavePasswordWhenEmpty() + public function testSavePasswordWhenEmpty(): void { $this->user->password = ''; $this->user->save(); @@ -307,7 +307,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::savePassword */ - public function testSavePasswordWrongOldPassword() + public function testSavePasswordWrongOldPassword(): void { $body = [ 'password' => 'wrongpassword', @@ -338,7 +338,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::savePassword */ - public function testSavePasswordMismatchingNewPassword() + public function testSavePasswordMismatchingNewPassword(): void { $body = [ 'password' => 'password', @@ -389,7 +389,7 @@ class SettingsControllerTest extends ControllerTest ?string $password, ?string $newPassword, ?string $newPassword2 - ) { + ): void { $body = [ 'password' => $password, 'new_password' => $newPassword, @@ -409,7 +409,7 @@ class SettingsControllerTest extends ControllerTest * @testdox theme: underNormalConditions -> returnsCorrectViewAndData * @covers \Engelsystem\Controllers\SettingsController::theme */ - public function testThemeUnderNormalConditionReturnsCorrectViewAndData() + public function testThemeUnderNormalConditionReturnsCorrectViewAndData(): void { $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); @@ -434,7 +434,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveTheme: withNoSelectedThemeGiven -> throwsException * @covers \Engelsystem\Controllers\SettingsController::saveTheme */ - public function testSaveThemeWithNoSelectedThemeGivenThrowsException() + public function testSaveThemeWithNoSelectedThemeGivenThrowsException(): void { $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); $this->expectException(ValidationException::class); @@ -446,7 +446,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveTheme: withUnknownSelectedThemeGiven -> throwsException * @covers \Engelsystem\Controllers\SettingsController::saveTheme */ - public function testSaveThemeWithUnknownSelectedThemeGivenThrowsException() + public function testSaveThemeWithUnknownSelectedThemeGivenThrowsException(): void { $this->request = $this->request->withParsedBody(['select_theme' => 2]); @@ -460,7 +460,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveTheme: withKnownSelectedThemeGiven -> savesThemeAndRedirect * @covers \Engelsystem\Controllers\SettingsController::saveTheme */ - public function testSaveThemeWithKnownSelectedThemeGivenSavesThemeAndRedirect() + public function testSaveThemeWithKnownSelectedThemeGivenSavesThemeAndRedirect(): void { $this->assertEquals(1, $this->user->settings->theme); $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); @@ -480,7 +480,7 @@ class SettingsControllerTest extends ControllerTest * @testdox language: underNormalConditions -> returnsCorrectViewAndData * @covers \Engelsystem\Controllers\SettingsController::language */ - public function testLanguageUnderNormalConditionReturnsCorrectViewAndData() + public function testLanguageUnderNormalConditionReturnsCorrectViewAndData(): void { $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); @@ -505,7 +505,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveLanguage: withNoSelectedLanguageGiven -> throwsException * @covers \Engelsystem\Controllers\SettingsController::saveLanguage */ - public function testSaveLanguageWithNoSelectedLanguageGivenThrowsException() + public function testSaveLanguageWithNoSelectedLanguageGivenThrowsException(): void { $this->setExpects($this->auth, 'user', null, $this->user, $this->once()); $this->expectException(ValidationException::class); @@ -517,7 +517,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveLanguage: withUnknownSelectedLanguageGiven -> throwsException * @covers \Engelsystem\Controllers\SettingsController::saveLanguage */ - public function testSaveLanguageWithUnknownSelectedLanguageGivenThrowsException() + public function testSaveLanguageWithUnknownSelectedLanguageGivenThrowsException(): void { $this->request = $this->request->withParsedBody(['select_language' => 'unknown']); @@ -531,7 +531,7 @@ class SettingsControllerTest extends ControllerTest * @testdox saveLanguage: withKnownSelectedLanguageGiven -> savesLanguageAndUpdatesSessionAndRedirect * @covers \Engelsystem\Controllers\SettingsController::saveLanguage */ - public function testSaveLanguageWithKnownSelectedLanguageGivenSavesLanguageAndUpdatesSessionAndRedirect() + public function testSaveLanguageWithKnownSelectedLanguageGivenSavesLanguageAndUpdatesSessionAndRedirect(): void { $this->assertEquals('en_US', $this->user->settings->language); $this->session->set('locale', 'en_US'); @@ -554,7 +554,7 @@ class SettingsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\SettingsController::__construct * @covers \Engelsystem\Controllers\SettingsController::oauth */ - public function testOauth() + public function testOauth(): void { $providers = ['foo' => ['lorem' => 'ipsum']]; config(['oauth' => $providers]); @@ -575,7 +575,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::oauth */ - public function testOauthNotConfigured() + public function testOauthNotConfigured(): void { config(['oauth' => []]); @@ -587,7 +587,7 @@ class SettingsControllerTest extends ControllerTest * @covers \Engelsystem\Controllers\SettingsController::settingsMenu * @covers \Engelsystem\Controllers\SettingsController::checkOauthHidden */ - public function testSettingsMenuWithOAuth() + public function testSettingsMenuWithOAuth(): void { $providers = ['foo' => ['lorem' => 'ipsum']]; $providersHidden = ['foo' => ['lorem' => 'ipsum', 'hidden' => true]]; @@ -614,7 +614,7 @@ class SettingsControllerTest extends ControllerTest /** * @covers \Engelsystem\Controllers\SettingsController::settingsMenu */ - public function testSettingsMenuWithoutOAuth() + public function testSettingsMenuWithoutOAuth(): void { config(['oauth' => []]); diff --git a/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php b/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php index 2083c831..aa6f0125 100644 --- a/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php +++ b/tests/Unit/Controllers/Stub/HasUserNotificationsImplementation.php @@ -8,7 +8,7 @@ class HasUserNotificationsImplementation { use HasUserNotifications; - public function add(string|array $value, string $type = 'messages') + public function add(string|array $value, string $type = 'messages'): void { $this->addNotification($value, $type); } diff --git a/tests/Unit/Database/DatabaseServiceProviderTest.php b/tests/Unit/Database/DatabaseServiceProviderTest.php index 781659cb..c991fcac 100644 --- a/tests/Unit/Database/DatabaseServiceProviderTest.php +++ b/tests/Unit/Database/DatabaseServiceProviderTest.php @@ -20,7 +20,7 @@ class DatabaseServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Database\DatabaseServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var Application|MockObject $app */ /** @var CapsuleManager|MockObject $dbManager */ @@ -54,7 +54,7 @@ class DatabaseServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Database\DatabaseServiceProvider::exitOnError() * @covers \Engelsystem\Database\DatabaseServiceProvider::register() */ - public function testRegisterError() + public function testRegisterError(): void { list($app) = $this->prepare([ 'host' => 'localhost', @@ -75,7 +75,7 @@ class DatabaseServiceProviderTest extends ServiceProviderTest * @param array $dbConfigData * @return array */ - protected function prepare(array $dbConfigData, bool $getPdoThrowException = false) + protected function prepare(array $dbConfigData, bool $getPdoThrowException = false): array { /** @var Config|MockObject $config */ $config = $this->getMockBuilder(Config::class) diff --git a/tests/Unit/Database/DatabaseTest.php b/tests/Unit/Database/DatabaseTest.php index 741d3773..bebaf98d 100644 --- a/tests/Unit/Database/DatabaseTest.php +++ b/tests/Unit/Database/DatabaseTest.php @@ -19,7 +19,7 @@ class DatabaseTest extends TestCase * @covers \Engelsystem\Database\Database::getConnection() * @covers \Engelsystem\Database\Database::getPdo() */ - public function testInit() + public function testInit(): void { /** @var PDO|MockObject $pdo */ $pdo = $this->getMockBuilder(PDO::class) @@ -44,7 +44,7 @@ class DatabaseTest extends TestCase /** * @covers \Engelsystem\Database\Database::select() */ - public function testSelect() + public function testSelect(): void { $db = new Database($this->connection); @@ -58,7 +58,7 @@ class DatabaseTest extends TestCase /** * @covers \Engelsystem\Database\Database::selectOne() */ - public function testSelectOne() + public function testSelectOne(): void { $db = new Database($this->connection); @@ -75,7 +75,7 @@ class DatabaseTest extends TestCase /** * @covers \Engelsystem\Database\Database::insert() */ - public function testInsert() + public function testInsert(): void { $db = new Database($this->connection); @@ -86,7 +86,7 @@ class DatabaseTest extends TestCase /** * @covers \Engelsystem\Database\Database::update() */ - public function testUpdate() + public function testUpdate(): void { $db = new Database($this->connection); @@ -100,7 +100,7 @@ class DatabaseTest extends TestCase /** * @covers \Engelsystem\Database\Database::delete() */ - public function testDelete() + public function testDelete(): void { $db = new Database($this->connection); diff --git a/tests/Unit/Database/DbTest.php b/tests/Unit/Database/DbTest.php index 02e2f949..a590ff64 100644 --- a/tests/Unit/Database/DbTest.php +++ b/tests/Unit/Database/DbTest.php @@ -15,7 +15,7 @@ class DbTest extends TestCase * @covers \Engelsystem\Database\Db::connection() * @covers \Engelsystem\Database\Db::setDbManager() */ - public function testSetDbManager() + public function testSetDbManager(): void { /** @var PDO|MockObject $pdo */ $pdo = $this->getMockBuilder(PDO::class) @@ -47,7 +47,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::select() */ - public function testSelect() + public function testSelect(): void { $return = Db::select('SELECT * FROM test_data'); $this->assertTrue(count($return) > 3); @@ -59,7 +59,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::selectOne() */ - public function testSelectOne() + public function testSelectOne(): void { $return = Db::selectOne('SELECT * FROM test_data'); $this->assertEquals('Foo', $return['data']); @@ -75,7 +75,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::insert() */ - public function testInsert() + public function testInsert(): void { $result = Db::insert("INSERT INTO test_data (id, data) VALUES (5, 'Some random text'), (6, 'another text')"); $this->assertTrue($result); @@ -84,7 +84,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::update() */ - public function testUpdate() + public function testUpdate(): void { $count = Db::update("UPDATE test_data SET data='NOPE' WHERE data LIKE '%Replaceme%'"); $this->assertEquals(3, $count); @@ -96,7 +96,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::delete() */ - public function testDelete() + public function testDelete(): void { $count = Db::delete('DELETE FROM test_data WHERE id=1'); $this->assertEquals(1, $count); @@ -108,7 +108,7 @@ class DbTest extends TestCase /** * @covers \Engelsystem\Database\Db::getPdo() */ - public function testGetPdo() + public function testGetPdo(): void { $pdo = Db::getPdo(); $this->assertInstanceOf(PDO::class, $pdo); diff --git a/tests/Unit/Database/Migration/MigrateTest.php b/tests/Unit/Database/Migration/MigrateTest.php index 2ef8927d..67ae4df7 100644 --- a/tests/Unit/Database/Migration/MigrateTest.php +++ b/tests/Unit/Database/Migration/MigrateTest.php @@ -21,7 +21,7 @@ class MigrateTest extends TestCase * @covers \Engelsystem\Database\Migration\Migrate::setOutput * @covers \Engelsystem\Database\Migration\Migrate::mergeMigrations */ - public function testRun() + public function testRun(): void { /** @var Application|MockObject $app */ $app = $this->getMockBuilder(Application::class) @@ -84,7 +84,7 @@ class MigrateTest extends TestCase $migration->run('foo', Migrate::UP); $messages = []; - $migration->setOutput(function ($text) use (&$messages) { + $migration->setOutput(function ($text) use (&$messages): void { $messages[] = $text; }); @@ -122,7 +122,7 @@ class MigrateTest extends TestCase /** * @covers \Engelsystem\Database\Migration\Migrate::run */ - public function testRunExceptionUnlockTable() + public function testRunExceptionUnlockTable(): void { /** @var Application|MockObject $app */ $app = $this->getMockBuilder(Application::class) @@ -154,7 +154,7 @@ class MigrateTest extends TestCase $this->setExpects($migration, 'getMigrated', null, collect([])); $migration->expects($this->once()) ->method('migrate') - ->willReturnCallback(function () { + ->willReturnCallback(function (): void { throw new Exception(); }); @@ -172,7 +172,7 @@ class MigrateTest extends TestCase * @covers \Engelsystem\Database\Migration\Migrate::lockTable * @covers \Engelsystem\Database\Migration\Migrate::unlockTable */ - public function testRunIntegration() + public function testRunIntegration(): void { $app = new Application(); $dbManager = new CapsuleManager($app); @@ -188,7 +188,7 @@ class MigrateTest extends TestCase $migration = new Migrate($schema, $app); $messages = []; - $migration->setOutput(function ($msg) use (&$messages) { + $migration->setOutput(function ($msg) use (&$messages): void { $messages[] = $msg; }); diff --git a/tests/Unit/Database/Migration/MigrationServiceProviderTest.php b/tests/Unit/Database/Migration/MigrationServiceProviderTest.php index 589bda9c..889d2101 100644 --- a/tests/Unit/Database/Migration/MigrationServiceProviderTest.php +++ b/tests/Unit/Database/Migration/MigrationServiceProviderTest.php @@ -15,7 +15,7 @@ class MigrationServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Database\Migration\MigrationServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var Migrate|MockObject $migration */ $migration = $this->getMockBuilder(Migrate::class) diff --git a/tests/Unit/Database/Migration/MigrationTest.php b/tests/Unit/Database/Migration/MigrationTest.php index 9471a9a8..d7ade167 100644 --- a/tests/Unit/Database/Migration/MigrationTest.php +++ b/tests/Unit/Database/Migration/MigrationTest.php @@ -12,7 +12,7 @@ class MigrationTest extends TestCase /** * @covers \Engelsystem\Database\Migration\Migration::__construct */ - public function testConstructor() + public function testConstructor(): void { require_once __DIR__ . '/Stub/2017_12_24_053300_another_stuff.php'; diff --git a/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php b/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php index 307b776e..05a416c7 100644 --- a/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php +++ b/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php @@ -10,9 +10,9 @@ class CreateLoremIpsumTable extends Migration /** * Run the migration */ - public function up() + public function up(): void { - $this->schema->create('lorem_ipsum', function (Blueprint $table) { + $this->schema->create('lorem_ipsum', function (Blueprint $table): void { $table->increments('id'); $table->string('name')->unique(); $table->string('email'); @@ -22,7 +22,7 @@ class CreateLoremIpsumTable extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { $this->schema->dropIfExists('lorem_ipsum'); } diff --git a/tests/Unit/Database/Migration/Stub/2017_12_24_053300_another_stuff.php b/tests/Unit/Database/Migration/Stub/2017_12_24_053300_another_stuff.php index 4adaf3ed..5241a61d 100644 --- a/tests/Unit/Database/Migration/Stub/2017_12_24_053300_another_stuff.php +++ b/tests/Unit/Database/Migration/Stub/2017_12_24_053300_another_stuff.php @@ -10,7 +10,7 @@ class AnotherStuff extends Migration /** * Run the migration */ - public function up() + public function up(): void { // nope } @@ -18,15 +18,12 @@ class AnotherStuff extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { // nope } - /** - * @return SchemaBuilder - */ - public function getSchema() + public function getSchema(): SchemaBuilder { return $this->schema; } diff --git a/tests/Unit/Database/Migration/Stub/2022_12_22_221222_add_some_feature.php b/tests/Unit/Database/Migration/Stub/2022_12_22_221222_add_some_feature.php index 32317f71..85438376 100644 --- a/tests/Unit/Database/Migration/Stub/2022_12_22_221222_add_some_feature.php +++ b/tests/Unit/Database/Migration/Stub/2022_12_22_221222_add_some_feature.php @@ -9,7 +9,7 @@ class AddSomeFeature extends Migration /** * Run the migration */ - public function up() + public function up(): void { // nope } @@ -17,7 +17,7 @@ class AddSomeFeature extends Migration /** * Reverse the migration */ - public function down() + public function down(): void { // nope } diff --git a/tests/Unit/Events/EventDispatcherTest.php b/tests/Unit/Events/EventDispatcherTest.php index ba8773bc..548108de 100644 --- a/tests/Unit/Events/EventDispatcherTest.php +++ b/tests/Unit/Events/EventDispatcherTest.php @@ -132,9 +132,6 @@ class EventDispatcherTest extends TestCase return null; } - /** - * @return bool - */ public function returnFalse(): bool { return false; diff --git a/tests/Unit/Events/EventsServiceProviderTest.php b/tests/Unit/Events/EventsServiceProviderTest.php index b6f76328..6d1904f1 100644 --- a/tests/Unit/Events/EventsServiceProviderTest.php +++ b/tests/Unit/Events/EventsServiceProviderTest.php @@ -13,7 +13,7 @@ class EventsServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Events\EventsServiceProvider::register * @covers \Engelsystem\Events\EventsServiceProvider::registerEvents */ - public function testRegister() + public function testRegister(): void { $dispatcher = $this->createMock(EventDispatcher::class); $this->app->instance(EventDispatcher::class, $dispatcher); diff --git a/tests/Unit/Events/Listener/NewsTest.php b/tests/Unit/Events/Listener/NewsTest.php index fb0360a1..d9f92679 100644 --- a/tests/Unit/Events/Listener/NewsTest.php +++ b/tests/Unit/Events/Listener/NewsTest.php @@ -32,7 +32,7 @@ class NewsTest extends TestCase * @covers \Engelsystem\Events\Listener\News::__construct * @covers \Engelsystem\Events\Listener\News::sendMail */ - public function testCreated() + public function testCreated(): void { /** @var NewsModel $news */ $news = NewsModel::factory(['title' => 'Foo'])->create(); @@ -40,7 +40,7 @@ class NewsTest extends TestCase $i = 0; $this->mailer->expects($this->exactly(2)) ->method('sendViewTranslated') - ->willReturnCallback(function (User $user, string $subject, string $template, array $data) use (&$i) { + ->willReturnCallback(function (User $user, string $subject, string $template, array $data) use (&$i): void { $this->assertEquals(1, $user->id); $this->assertEquals('notification.news.new', $subject); $this->assertEquals('emails/news-new', $template); diff --git a/tests/Unit/Events/Listener/OAuth2Test.php b/tests/Unit/Events/Listener/OAuth2Test.php index 5a7c1bfc..e5b06a50 100644 --- a/tests/Unit/Events/Listener/OAuth2Test.php +++ b/tests/Unit/Events/Listener/OAuth2Test.php @@ -35,7 +35,7 @@ class OAuth2Test extends TestCase * @covers \Engelsystem\Events\Listener\OAuth2::syncTeams * @covers \Engelsystem\Events\Listener\OAuth2::__construct */ - public function testLogin() + public function testLogin(): void { $this->setExpects($this->auth, 'user', null, $this->user); @@ -64,7 +64,7 @@ class OAuth2Test extends TestCase /** * @covers \Engelsystem\Events\Listener\OAuth2::login */ - public function testLoginNoProvider() + public function testLoginNoProvider(): void { $this->setExpects($this->auth, 'user', null, $this->user); @@ -75,7 +75,7 @@ class OAuth2Test extends TestCase /** * @covers \Engelsystem\Events\Listener\OAuth2::login */ - public function testLoginNoMatchingGroups() + public function testLoginNoMatchingGroups(): void { $this->setExpects($this->auth, 'user', null, $this->user); @@ -87,7 +87,7 @@ class OAuth2Test extends TestCase * @covers \Engelsystem\Events\Listener\OAuth2::login * @covers \Engelsystem\Events\Listener\OAuth2::syncTeams */ - public function testLoginNoChanges() + public function testLoginNoChanges(): void { $this->setExpects($this->auth, 'user', null, $this->user); $this->user->userAngelTypes()->attach($this->angelTypes['test']); @@ -116,7 +116,7 @@ class OAuth2Test extends TestCase * @covers \Engelsystem\Events\Listener\OAuth2::login * @covers \Engelsystem\Events\Listener\OAuth2::syncTeams */ - public function testLoginChangeSupport() + public function testLoginChangeSupport(): void { $this->setExpects($this->auth, 'user', null, $this->user); $this->user->userAngelTypes()->attach($this->angelTypes['test']); @@ -137,7 +137,7 @@ class OAuth2Test extends TestCase /** * @covers \Engelsystem\Events\Listener\OAuth2::getSsoTeams */ - public function testGetSsoTeamsNotConfigured() + public function testGetSsoTeamsNotConfigured(): void { $instance = new OAuth2($this->config, $this->log, $this->auth); @@ -148,7 +148,7 @@ class OAuth2Test extends TestCase /** * @covers \Engelsystem\Events\Listener\OAuth2::getSsoTeams */ - public function testGetSsoTeams() + public function testGetSsoTeams(): void { $instance = new OAuth2($this->config, $this->log, $this->auth); diff --git a/tests/Unit/Exceptions/ExceptionsServiceProviderTest.php b/tests/Unit/Exceptions/ExceptionsServiceProviderTest.php index bd0fb811..c3c92a67 100644 --- a/tests/Unit/Exceptions/ExceptionsServiceProviderTest.php +++ b/tests/Unit/Exceptions/ExceptionsServiceProviderTest.php @@ -20,7 +20,7 @@ class ExceptionsServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addProductionHandler * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = $this->getApp(['make', 'instance', 'bind']); @@ -81,7 +81,7 @@ class ExceptionsServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::boot * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addLogger */ - public function testBoot() + public function testBoot(): void { /** @var HandlerInterface|MockObject $handlerImpl */ $handlerImpl = $this->getMockForAbstractClass(HandlerInterface::class); diff --git a/tests/Unit/Exceptions/HandlerTest.php b/tests/Unit/Exceptions/HandlerTest.php index 494afd31..28ba5996 100644 --- a/tests/Unit/Exceptions/HandlerTest.php +++ b/tests/Unit/Exceptions/HandlerTest.php @@ -15,7 +15,7 @@ class HandlerTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handler::__construct() */ - public function testCreate() + public function testCreate(): void { /** @var Handler|MockObject $handler */ $handler = new Handler(); @@ -29,7 +29,7 @@ class HandlerTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handler::errorHandler() */ - public function testErrorHandler() + public function testErrorHandler(): void { /** @var Handler|MockObject $handler */ $handler = $this->getMockBuilder(Handler::class) @@ -46,7 +46,7 @@ class HandlerTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handler::exceptionHandler() */ - public function testExceptionHandler() + public function testExceptionHandler(): void { $exception = new Exception(); $errorMessage = 'Oh noes, an error!'; @@ -59,7 +59,7 @@ class HandlerTest extends TestCase $handlerMock->expects($this->atLeastOnce()) ->method('render') ->with($this->isInstanceOf(Request::class), $exception) - ->willReturnCallback(function () use ($errorMessage) { + ->willReturnCallback(function () use ($errorMessage): void { echo $errorMessage; }); @@ -82,7 +82,7 @@ class HandlerTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handler::register() */ - public function testRegister() + public function testRegister(): void { /** @var Handler|MockObject $handler */ $handler = $this->getMockForAbstractClass(Handler::class); @@ -102,7 +102,7 @@ class HandlerTest extends TestCase * @covers \Engelsystem\Exceptions\Handler::getEnvironment() * @covers \Engelsystem\Exceptions\Handler::setEnvironment() */ - public function testEnvironment() + public function testEnvironment(): void { $handler = new Handler(); @@ -117,7 +117,7 @@ class HandlerTest extends TestCase * @covers \Engelsystem\Exceptions\Handler::getHandler() * @covers \Engelsystem\Exceptions\Handler::setHandler() */ - public function testHandler() + public function testHandler(): void { $handler = new Handler(); /** @var HandlerInterface|MockObject $devHandler */ @@ -136,7 +136,7 @@ class HandlerTest extends TestCase * @covers \Engelsystem\Exceptions\Handler::getRequest() * @covers \Engelsystem\Exceptions\Handler::setRequest() */ - public function testRequest() + public function testRequest(): void { $handler = new Handler(); /** @var Request|MockObject $request */ diff --git a/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php b/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php index bd0c6990..7913e223 100644 --- a/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php +++ b/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php @@ -14,7 +14,7 @@ class LegacyDevelopmentTest extends TestCase * @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace() * @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render() */ - public function testRender() + public function testRender(): void { $handler = new LegacyDevelopment(); /** @var Request|MockObject $request */ diff --git a/tests/Unit/Exceptions/Handlers/LegacyTest.php b/tests/Unit/Exceptions/Handlers/LegacyTest.php index 90dccbe8..54b99dd5 100644 --- a/tests/Unit/Exceptions/Handlers/LegacyTest.php +++ b/tests/Unit/Exceptions/Handlers/LegacyTest.php @@ -15,7 +15,7 @@ class LegacyTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handlers\Legacy::render */ - public function testRender() + public function testRender(): void { $handler = new Legacy(); /** @var Request|MockObject $request */ @@ -33,7 +33,7 @@ class LegacyTest extends TestCase * @covers \Engelsystem\Exceptions\Handlers\Legacy::setLogger * @covers \Engelsystem\Exceptions\Handlers\Legacy::stripBasePath */ - public function testReport() + public function testReport(): void { $handler = new Legacy(); $exception = new Exception('Lorem Ipsum', 4242); @@ -44,7 +44,7 @@ class LegacyTest extends TestCase $logger2 = $this->createMock(TestLogger::class); $logger2->expects($this->once()) ->method('critical') - ->willReturnCallback(function () { + ->willReturnCallback(function (): void { throw new ErrorException(); }); diff --git a/tests/Unit/Exceptions/Handlers/NullHandlerTest.php b/tests/Unit/Exceptions/Handlers/NullHandlerTest.php index 42eb2697..4e777e1f 100644 --- a/tests/Unit/Exceptions/Handlers/NullHandlerTest.php +++ b/tests/Unit/Exceptions/Handlers/NullHandlerTest.php @@ -12,7 +12,7 @@ class NullHandlerTest extends TestCase /** * @covers \Engelsystem\Exceptions\Handlers\NullHandler::render */ - public function testRender() + public function testRender(): void { $handler = new NullHandler(); $request = new Request(); diff --git a/tests/Unit/Exceptions/Handlers/WhoopsTest.php b/tests/Unit/Exceptions/Handlers/WhoopsTest.php index 9ef408d1..5a3d610d 100644 --- a/tests/Unit/Exceptions/Handlers/WhoopsTest.php +++ b/tests/Unit/Exceptions/Handlers/WhoopsTest.php @@ -23,7 +23,7 @@ class WhoopsTest extends TestCase * @covers \Engelsystem\Exceptions\Handlers\Whoops::getJsonResponseHandler * @covers \Engelsystem\Exceptions\Handlers\Whoops::getData */ - public function testRender() + public function testRender(): void { /** @var Application|MockObject $app */ $app = $this->createMock(Application::class); diff --git a/tests/Unit/FakerProvider.php b/tests/Unit/FakerProvider.php index ca594696..412b1750 100644 --- a/tests/Unit/FakerProvider.php +++ b/tests/Unit/FakerProvider.php @@ -12,17 +12,11 @@ class FakerProvider extends Base /** @var string[] */ protected static $shirtSizes = ['S', 'S-G', 'M', 'M-G', 'L', 'L-G', 'XL', 'XL-G', '2XL', '3XL', '4XL']; - /** - * @return string - */ - public function pronoun() + public function pronoun(): string { return static::randomElement(static::$pronouns); } - /** - * @return string - */ public function shirtSize(): string { return static::randomElement(static::$shirtSizes); diff --git a/tests/Unit/HasDatabase.php b/tests/Unit/HasDatabase.php index 58cf859e..902d6e3d 100644 --- a/tests/Unit/HasDatabase.php +++ b/tests/Unit/HasDatabase.php @@ -18,7 +18,7 @@ trait HasDatabase /** * Setup in memory database */ - protected function initDatabase() + protected function initDatabase(): void { $dbManager = new CapsuleManager(); $dbManager->addConnection(['driver' => 'sqlite', 'database' => ':memory:']); diff --git a/tests/Unit/Helpers/AssetsServiceProviderTest.php b/tests/Unit/Helpers/AssetsServiceProviderTest.php index c82f3c7d..90e89162 100644 --- a/tests/Unit/Helpers/AssetsServiceProviderTest.php +++ b/tests/Unit/Helpers/AssetsServiceProviderTest.php @@ -12,7 +12,7 @@ class AssetsServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\AssetsServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); $app->instance('path.assets.public', '/tmp'); diff --git a/tests/Unit/Helpers/AssetsTest.php b/tests/Unit/Helpers/AssetsTest.php index 6ff5ce5b..2e0ed8fb 100644 --- a/tests/Unit/Helpers/AssetsTest.php +++ b/tests/Unit/Helpers/AssetsTest.php @@ -11,7 +11,7 @@ class AssetsTest extends TestCase * @covers \Engelsystem\Helpers\Assets::__construct * @covers \Engelsystem\Helpers\Assets::getAssetPath */ - public function testGetAssetPath() + public function testGetAssetPath(): void { $assets = new Assets('/foo/bar'); $this->assertEquals('lorem.bar', $assets->getAssetPath('lorem.bar')); diff --git a/tests/Unit/Helpers/AuthenticatorServiceProviderTest.php b/tests/Unit/Helpers/AuthenticatorServiceProviderTest.php index bbf80b38..362fa8fe 100644 --- a/tests/Unit/Helpers/AuthenticatorServiceProviderTest.php +++ b/tests/Unit/Helpers/AuthenticatorServiceProviderTest.php @@ -15,7 +15,7 @@ class AuthenticatorServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\AuthenticatorServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { $app = new Application(); $app->bind(ServerRequestInterface::class, Request::class); diff --git a/tests/Unit/Helpers/AuthenticatorTest.php b/tests/Unit/Helpers/AuthenticatorTest.php index 5bf681cf..e5cc8b87 100644 --- a/tests/Unit/Helpers/AuthenticatorTest.php +++ b/tests/Unit/Helpers/AuthenticatorTest.php @@ -21,7 +21,7 @@ class AuthenticatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Authenticator::__construct * @covers \Engelsystem\Helpers\Authenticator::user */ - public function testUser() + public function testUser(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockForAbstractClass(ServerRequestInterface::class); @@ -64,7 +64,7 @@ class AuthenticatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Authenticator::apiUser */ - public function testApiUser() + public function testApiUser(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockForAbstractClass(ServerRequestInterface::class); @@ -108,7 +108,7 @@ class AuthenticatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Authenticator::can */ - public function testCan() + public function testCan(): void { $this->initDatabase(); @@ -160,7 +160,7 @@ class AuthenticatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Authenticator::authenticate */ - public function testAuthenticate() + public function testAuthenticate(): void { $this->initDatabase(); @@ -190,7 +190,7 @@ class AuthenticatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Authenticator::verifyPassword */ - public function testVerifyPassword() + public function testVerifyPassword(): void { $this->initDatabase(); $password = password_hash('testing', PASSWORD_ARGON2I); @@ -218,7 +218,7 @@ class AuthenticatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Authenticator::setPassword */ - public function testSetPassword() + public function testSetPassword(): void { $this->initDatabase(); /** @var User $user */ @@ -242,7 +242,7 @@ class AuthenticatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Authenticator::setPasswordAlgorithm * @covers \Engelsystem\Helpers\Authenticator::getPasswordAlgorithm */ - public function testPasswordAlgorithm() + public function testPasswordAlgorithm(): void { $auth = $this->getAuthenticator(); @@ -254,7 +254,7 @@ class AuthenticatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Authenticator::setDefaultRole * @covers \Engelsystem\Helpers\Authenticator::getDefaultRole */ - public function testDefaultRole() + public function testDefaultRole(): void { $auth = $this->getAuthenticator(); @@ -266,7 +266,7 @@ class AuthenticatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Authenticator::setGuestRole * @covers \Engelsystem\Helpers\Authenticator::getGuestRole */ - public function testGuestRole() + public function testGuestRole(): void { $auth = $this->getAuthenticator(); @@ -274,10 +274,7 @@ class AuthenticatorTest extends ServiceProviderTest $this->assertEquals(42, $auth->getGuestRole()); } - /** - * @return Authenticator - */ - protected function getAuthenticator() + protected function getAuthenticator(): Authenticator { return new class extends Authenticator { /** @noinspection PhpMissingParentConstructorInspection */ diff --git a/tests/Unit/Helpers/BarChartTest.php b/tests/Unit/Helpers/BarChartTest.php index 57fa1a56..c77ce3b4 100644 --- a/tests/Unit/Helpers/BarChartTest.php +++ b/tests/Unit/Helpers/BarChartTest.php @@ -159,7 +159,7 @@ class BarChartTest extends TestCase /** * @covers \Engelsystem\Helpers\BarChart::generateChartDemoData */ - public function testGenerateChartDemoData() + public function testGenerateChartDemoData(): void { $first = CarbonImmutable::now()->subDays(2)->format('Y-m-d'); $second = CarbonImmutable::now()->subDays()->format('Y-m-d'); diff --git a/tests/Unit/Helpers/ConfigureEnvironmentServiceProviderTest.php b/tests/Unit/Helpers/ConfigureEnvironmentServiceProviderTest.php index 45be5097..19f43ba7 100644 --- a/tests/Unit/Helpers/ConfigureEnvironmentServiceProviderTest.php +++ b/tests/Unit/Helpers/ConfigureEnvironmentServiceProviderTest.php @@ -15,7 +15,7 @@ class ConfigureEnvironmentServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\ConfigureEnvironmentServiceProvider::register * @covers \Engelsystem\Helpers\ConfigureEnvironmentServiceProvider::setupDevErrorHandler */ - public function testRegister() + public function testRegister(): void { $config = new Config(['timezone' => 'Australia/Eucla', 'environment' => 'production']); $this->app->instance('config', $config); @@ -31,7 +31,7 @@ class ConfigureEnvironmentServiceProviderTest extends ServiceProviderTest $serviceProvider->expects($this->exactly(2)) ->method('setTimeZone') - ->willReturnCallback(function (CarbonTimeZone $timeZone) { + ->willReturnCallback(function (CarbonTimeZone $timeZone): void { $this->assertEquals('Australia/Eucla', $timeZone->getName()); }); $serviceProvider->expects($this->exactly(3)) diff --git a/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php index eb4ceffd..f8817d3a 100644 --- a/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php +++ b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php @@ -10,14 +10,11 @@ class CalculatesTimeTest extends TestCase /** * @covers \Engelsystem\Helpers\Schedule\CalculatesTime::secondsFromTime */ - public function testSecondsFromTime() + public function testSecondsFromTime(): void { $calc = new class { use CalculatesTime; - /** - * @return int - */ public function calc(string $time): int { return $this->secondsFromTime($time); diff --git a/tests/Unit/Helpers/Schedule/ConferenceTest.php b/tests/Unit/Helpers/Schedule/ConferenceTest.php index 959e272b..140d4ade 100644 --- a/tests/Unit/Helpers/Schedule/ConferenceTest.php +++ b/tests/Unit/Helpers/Schedule/ConferenceTest.php @@ -18,7 +18,7 @@ class ConferenceTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Conference::getTimeslotDurationSeconds * @covers \Engelsystem\Helpers\Schedule\Conference::getBaseUrl */ - public function testCreate() + public function testCreate(): void { $conference = new Conference('Doing stuff', 'DS'); $this->assertEquals('Doing stuff', $conference->getTitle()); diff --git a/tests/Unit/Helpers/Schedule/DayTest.php b/tests/Unit/Helpers/Schedule/DayTest.php index 65704181..f892cfbd 100644 --- a/tests/Unit/Helpers/Schedule/DayTest.php +++ b/tests/Unit/Helpers/Schedule/DayTest.php @@ -17,7 +17,7 @@ class DayTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Day::getIndex * @covers \Engelsystem\Helpers\Schedule\Day::getRoom */ - public function testCreate() + public function testCreate(): void { $day = new Day( '2000-01-01', diff --git a/tests/Unit/Helpers/Schedule/EventTest.php b/tests/Unit/Helpers/Schedule/EventTest.php index d9706b13..8c1361bc 100644 --- a/tests/Unit/Helpers/Schedule/EventTest.php +++ b/tests/Unit/Helpers/Schedule/EventTest.php @@ -35,7 +35,7 @@ class EventTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl * @covers \Engelsystem\Helpers\Schedule\Event::getEndDate */ - public function testCreate() + public function testCreate(): void { $room = new Room('Foo'); $date = new Carbon('2020-12-28T19:30:00+00:00'); @@ -104,7 +104,7 @@ class EventTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Event::getUrl * @covers \Engelsystem\Helpers\Schedule\Event::getVideoDownloadUrl */ - public function testCreateNotDefault() + public function testCreateNotDefault(): void { $persons = [1337 => 'Some Person']; $links = ['https://foo.bar' => 'Foo Bar']; diff --git a/tests/Unit/Helpers/Schedule/RoomTest.php b/tests/Unit/Helpers/Schedule/RoomTest.php index 8b9b600a..41a68a44 100644 --- a/tests/Unit/Helpers/Schedule/RoomTest.php +++ b/tests/Unit/Helpers/Schedule/RoomTest.php @@ -14,7 +14,7 @@ class RoomTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Room::getEvent * @covers \Engelsystem\Helpers\Schedule\Room::setEvent */ - public function testCreate() + public function testCreate(): void { $room = new Room('Test'); $this->assertEquals('Test', $room->getName()); diff --git a/tests/Unit/Helpers/Schedule/ScheduleTest.php b/tests/Unit/Helpers/Schedule/ScheduleTest.php index 6a3634cf..58b417a4 100644 --- a/tests/Unit/Helpers/Schedule/ScheduleTest.php +++ b/tests/Unit/Helpers/Schedule/ScheduleTest.php @@ -20,7 +20,7 @@ class ScheduleTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Schedule::getConference * @covers \Engelsystem\Helpers\Schedule\Schedule::getDay */ - public function testCreate() + public function testCreate(): void { $conference = new Conference('Foo Bar', 'FooB'); $days = [$this->createMock(Day::class)]; @@ -34,7 +34,7 @@ class ScheduleTest extends TestCase /** * @covers \Engelsystem\Helpers\Schedule\Schedule::getRooms */ - public function testGetRooms() + public function testGetRooms(): void { $conference = new Conference('Test', 'T'); $room1 = new Room('Test 1'); @@ -68,7 +68,7 @@ class ScheduleTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\Schedule::getStartDateTime * @covers \Engelsystem\Helpers\Schedule\Schedule::getEndDateTime */ - public function testGetDateTimes() + public function testGetDateTimes(): void { $conference = new Conference('Some Conference', 'SC'); $days = [ diff --git a/tests/Unit/Helpers/Schedule/XmlParserTest.php b/tests/Unit/Helpers/Schedule/XmlParserTest.php index 729b3862..8b451fa1 100644 --- a/tests/Unit/Helpers/Schedule/XmlParserTest.php +++ b/tests/Unit/Helpers/Schedule/XmlParserTest.php @@ -19,7 +19,7 @@ class XmlParserTest extends TestCase * @covers \Engelsystem\Helpers\Schedule\XmlParser::getListFromSequence * @covers \Engelsystem\Helpers\Schedule\XmlParser::getSchedule */ - public function testLoad() + public function testLoad(): void { libxml_use_internal_errors(true); diff --git a/tests/Unit/Helpers/ShiftsTest.php b/tests/Unit/Helpers/ShiftsTest.php index a1ab4fe8..869c3fd1 100644 --- a/tests/Unit/Helpers/ShiftsTest.php +++ b/tests/Unit/Helpers/ShiftsTest.php @@ -14,7 +14,7 @@ class ShiftsTest extends TestCase /** * @covers \Engelsystem\Helpers\Shifts::isNightShift */ - public function testIsNightShiftDisabled() + public function testIsNightShiftDisabled(): void { $config = new Config(['night_shifts' => [ 'enabled' => false, @@ -55,7 +55,7 @@ class ShiftsTest extends TestCase * @covers \Engelsystem\Helpers\Shifts::isNightShift * @dataProvider nightShiftData */ - public function testIsNightShiftEnabled(Carbon $start, Carbon $end, bool $isNightShift) + public function testIsNightShiftEnabled(Carbon $start, Carbon $end, bool $isNightShift): void { $config = new Config(['night_shifts' => [ 'enabled' => true, @@ -71,7 +71,7 @@ class ShiftsTest extends TestCase /** * @covers \Engelsystem\Helpers\Shifts::getNightShiftMultiplier */ - public function testGetNightShiftMultiplier() + public function testGetNightShiftMultiplier(): void { $config = new Config(['night_shifts' => [ 'enabled' => true, diff --git a/tests/Unit/Helpers/Stub/UserModelImplementation.php b/tests/Unit/Helpers/Stub/UserModelImplementation.php index d9cc48ca..2e1e1731 100644 --- a/tests/Unit/Helpers/Stub/UserModelImplementation.php +++ b/tests/Unit/Helpers/Stub/UserModelImplementation.php @@ -20,9 +20,8 @@ class UserModelImplementation extends User /** * @param array $columns - * @return User|null */ - public function find(mixed $id, array $columns = ['*']) + public function find(mixed $id, array $columns = ['*']): ?User { if ($id != static::$id) { throw new InvalidArgumentException('Wrong user ID searched'); @@ -34,7 +33,7 @@ class UserModelImplementation extends User /** * @return User[]|Collection|QueryBuilder */ - public static function whereApiKey(string $apiKey) + public static function whereApiKey(string $apiKey): array|Collection|QueryBuilder { if ($apiKey != static::$apiKey) { throw new InvalidArgumentException('Wrong api key searched'); diff --git a/tests/Unit/Helpers/Translation/GettextTranslatorTest.php b/tests/Unit/Helpers/Translation/GettextTranslatorTest.php index 20876c98..4705250e 100644 --- a/tests/Unit/Helpers/Translation/GettextTranslatorTest.php +++ b/tests/Unit/Helpers/Translation/GettextTranslatorTest.php @@ -13,7 +13,7 @@ class GettextTranslatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Translation\GettextTranslator::assertHasTranslation() */ - public function testNoTranslation() + public function testNoTranslation(): void { $translations = $this->getTranslations(); $translator = GettextTranslator::createFromTranslations($translations); @@ -29,7 +29,7 @@ class GettextTranslatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Translation\GettextTranslator::translate() */ - public function testTranslate() + public function testTranslate(): void { $translations = $this->getTranslations(); $translator = GettextTranslator::createFromTranslations($translations); @@ -40,7 +40,7 @@ class GettextTranslatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Translation\GettextTranslator::translatePlural */ - public function testTranslatePlural() + public function testTranslatePlural(): void { $translations = $this->getTranslations(); $translator = GettextTranslator::createFromTranslations($translations); @@ -48,9 +48,6 @@ class GettextTranslatorTest extends ServiceProviderTest $this->assertEquals('Translations!', $translator->ngettext('test.value', 'test.value', 2)); } - /** - * @return Translations - */ protected function getTranslations(): Translations { $translation = Translation::create(null, 'test.value') diff --git a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php index 330ce1fd..8d63d3e0 100644 --- a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php +++ b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php @@ -65,7 +65,7 @@ class TranslationServiceProviderTest extends ServiceProviderTest $app->expects($this->once()) ->method('singleton') - ->willReturnCallback(function (string $abstract, callable $callback) use ($translator) { + ->willReturnCallback(function (string $abstract, callable $callback) use ($translator): void { $this->assertEquals(Translator::class, $abstract); $this->assertEquals($translator, $callback()); }); diff --git a/tests/Unit/Helpers/Translation/TranslatorTest.php b/tests/Unit/Helpers/Translation/TranslatorTest.php index 8c646850..54332b0a 100644 --- a/tests/Unit/Helpers/Translation/TranslatorTest.php +++ b/tests/Unit/Helpers/Translation/TranslatorTest.php @@ -19,7 +19,7 @@ class TranslatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Translation\Translator::setLocale * @covers \Engelsystem\Helpers\Translation\Translator::setLocales */ - public function testInit() + public function testInit(): void { $locales = ['te_ST' => 'Tests', 'fo_OO' => 'SomeFOO']; $locale = 'te_ST'; @@ -51,7 +51,7 @@ class TranslatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Translation\Translator::translate */ - public function testTranslate() + public function testTranslate(): void { /** @var Translator|MockObject $translator */ $translator = $this->getMockBuilder(Translator::class) @@ -73,7 +73,7 @@ class TranslatorTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\Translation\Translator::translatePlural */ - public function testTranslatePlural() + public function testTranslatePlural(): void { /** @var Translator|MockObject $translator */ $translator = $this->getMockBuilder(Translator::class) @@ -94,7 +94,7 @@ class TranslatorTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Translation\Translator::translateText * @covers \Engelsystem\Helpers\Translation\Translator::replaceText */ - public function testReplaceText() + public function testReplaceText(): void { /** @var GettextTranslator|MockObject $gtt */ $gtt = $this->createMock(GettextTranslator::class); @@ -135,7 +135,7 @@ class TranslatorTest extends ServiceProviderTest /** * Does nothing */ - public function doNothing() + public function doNothing(): void { } } diff --git a/tests/Unit/Helpers/UuidServiceProviderTest.php b/tests/Unit/Helpers/UuidServiceProviderTest.php index a89ba2d2..36094510 100644 --- a/tests/Unit/Helpers/UuidServiceProviderTest.php +++ b/tests/Unit/Helpers/UuidServiceProviderTest.php @@ -13,7 +13,7 @@ class UuidServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\UuidServiceProvider::register * @covers \Engelsystem\Helpers\UuidServiceProvider::uuid */ - public function testRegister() + public function testRegister(): void { $app = new Application(); diff --git a/tests/Unit/Helpers/VersionServiceProviderTest.php b/tests/Unit/Helpers/VersionServiceProviderTest.php index 609c649d..59b0966b 100644 --- a/tests/Unit/Helpers/VersionServiceProviderTest.php +++ b/tests/Unit/Helpers/VersionServiceProviderTest.php @@ -12,7 +12,7 @@ class VersionServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Helpers\VersionServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); $app->instance('path.storage.app', '/tmp'); diff --git a/tests/Unit/Helpers/VersionTest.php b/tests/Unit/Helpers/VersionTest.php index 40569abb..a68e4769 100644 --- a/tests/Unit/Helpers/VersionTest.php +++ b/tests/Unit/Helpers/VersionTest.php @@ -12,7 +12,7 @@ class VersionTest extends ServiceProviderTest * @covers \Engelsystem\Helpers\Version::__construct * @covers \Engelsystem\Helpers\Version::getVersion */ - public function testGetVersion() + public function testGetVersion(): void { $config = new Config(); $version = new Version(__DIR__ . '/Stub', $config); diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php index af1f318d..e3f3a672 100644 --- a/tests/Unit/HelpersTest.php +++ b/tests/Unit/HelpersTest.php @@ -22,7 +22,7 @@ class HelpersTest extends TestCase /** * @covers \app */ - public function testApp() + public function testApp(): void { $class = new class { @@ -37,7 +37,7 @@ class HelpersTest extends TestCase /** * @covers \auth */ - public function testAuth() + public function testAuth(): void { /** @var Application|MockObject $app */ $app = $this->createMock(Container::class); @@ -58,7 +58,7 @@ class HelpersTest extends TestCase /** * @covers \base_path */ - public function testBasePath() + public function testBasePath(): void { /** @var Application|MockObject $app */ $app = $this->getMockBuilder(Container::class) @@ -77,7 +77,7 @@ class HelpersTest extends TestCase /** * @covers \config */ - public function testConfig() + public function testConfig(): void { $configMock = $this->getMockBuilder(Config::class) ->getMock(); @@ -102,7 +102,7 @@ class HelpersTest extends TestCase /** * @covers \back */ - public function testBack() + public function testBack(): void { $response = new Response(); /** @var Redirector|MockObject $redirect */ @@ -125,7 +125,7 @@ class HelpersTest extends TestCase /** * @covers \config_path */ - public function testConfigPath() + public function testConfigPath(): void { /** @var Application|MockObject $app */ $app = $this->getMockBuilder(Container::class) @@ -144,7 +144,7 @@ class HelpersTest extends TestCase /** * @covers \event */ - public function testEvent() + public function testEvent(): void { /** @var Application|MockObject $app */ $app = $this->createMock(Container::class); @@ -152,7 +152,7 @@ class HelpersTest extends TestCase /** @var EventDispatcher|MockObject $dispatcher */ $dispatcher = $this->createMock(EventDispatcher::class); - $this->setExpects($dispatcher, 'dispatch', ['testevent', ['some' => 'thing']], ['test']); + $this->setExpects($dispatcher, 'dispatch', ['testevent', ['some' => 'thing']], $dispatcher); $app->expects($this->atLeastOnce()) ->method('get') @@ -160,13 +160,13 @@ class HelpersTest extends TestCase ->willReturn($dispatcher); $this->assertEquals($dispatcher, event()); - $this->assertEquals(['test'], event('testevent', ['some' => 'thing'])); + $this->assertEquals($dispatcher, event('testevent', ['some' => 'thing'])); } /** * @covers \redirect */ - public function testRedirect() + public function testRedirect(): void { $response = new Response(); /** @var Redirector|MockObject $redirect */ @@ -189,7 +189,7 @@ class HelpersTest extends TestCase /** * @covers \request */ - public function testRequest() + public function testRequest(): void { $requestMock = $this->getMockBuilder(Request::class) ->getMock(); @@ -208,7 +208,7 @@ class HelpersTest extends TestCase /** * @covers \response */ - public function testResponse() + public function testResponse(): void { /** @var Response|MockObject $response */ $response = $this->getMockBuilder(Response::class)->getMock(); @@ -235,7 +235,7 @@ class HelpersTest extends TestCase /** * @covers \session */ - public function testSession() + public function testSession(): void { $sessionStorage = $this->getMockForAbstractClass(StorageInterface::class); $sessionMock = $this->getMockBuilder(Session::class) @@ -256,7 +256,7 @@ class HelpersTest extends TestCase /** * @covers \view */ - public function testView() + public function testView(): void { $rendererMock = $this->getMockBuilder(Renderer::class) ->getMock(); @@ -276,7 +276,7 @@ class HelpersTest extends TestCase * @covers \__ * @covers \trans */ - public function testTrans() + public function testTrans(): void { /** @var Translator|MockObject $translator */ $translator = $this->getMockBuilder(Translator::class) @@ -298,7 +298,7 @@ class HelpersTest extends TestCase /** * @covers \_e */ - public function testTranslatePlural() + public function testTranslatePlural(): void { /** @var Translator|MockObject $translator */ $translator = $this->getMockBuilder(Translator::class) @@ -318,7 +318,7 @@ class HelpersTest extends TestCase /** * @covers \url */ - public function testUrl() + public function testUrl(): void { $urlGeneratorMock = $this->getMockForAbstractClass(UrlGeneratorInterface::class); @@ -333,10 +333,7 @@ class HelpersTest extends TestCase $this->assertEquals('http://lorem.ipsum/foo/bar?param=value', url('foo/bar', ['param' => 'value'])); } - /** - * @return Application|MockObject - */ - protected function getAppMock(string $alias, object $object) + protected function getAppMock(string $alias, object $object): Application|MockObject { /** @var Application|MockObject $appMock */ $appMock = $this->getMockBuilder(Container::class) diff --git a/tests/Unit/Http/Exceptions/HttpAuthExpiredTest.php b/tests/Unit/Http/Exceptions/HttpAuthExpiredTest.php index 4eaee032..f6ed9c87 100644 --- a/tests/Unit/Http/Exceptions/HttpAuthExpiredTest.php +++ b/tests/Unit/Http/Exceptions/HttpAuthExpiredTest.php @@ -10,7 +10,7 @@ class HttpAuthExpiredTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpAuthExpired::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpAuthExpired(); $this->assertEquals(419, $exception->getStatusCode()); diff --git a/tests/Unit/Http/Exceptions/HttpExceptionTest.php b/tests/Unit/Http/Exceptions/HttpExceptionTest.php index 6ab56d62..959a2ea3 100644 --- a/tests/Unit/Http/Exceptions/HttpExceptionTest.php +++ b/tests/Unit/Http/Exceptions/HttpExceptionTest.php @@ -12,7 +12,7 @@ class HttpExceptionTest extends TestCase * @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders * @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpException(123); $this->assertEquals(123, $exception->getStatusCode()); diff --git a/tests/Unit/Http/Exceptions/HttpForbiddenTest.php b/tests/Unit/Http/Exceptions/HttpForbiddenTest.php index 765a20d2..02a4589a 100644 --- a/tests/Unit/Http/Exceptions/HttpForbiddenTest.php +++ b/tests/Unit/Http/Exceptions/HttpForbiddenTest.php @@ -10,7 +10,7 @@ class HttpForbiddenTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpForbidden::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpForbidden(); $this->assertEquals(403, $exception->getStatusCode()); diff --git a/tests/Unit/Http/Exceptions/HttpNotFoundTest.php b/tests/Unit/Http/Exceptions/HttpNotFoundTest.php index a39ea087..c2add304 100644 --- a/tests/Unit/Http/Exceptions/HttpNotFoundTest.php +++ b/tests/Unit/Http/Exceptions/HttpNotFoundTest.php @@ -10,7 +10,7 @@ class HttpNotFoundTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpNotFound::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpNotFound(); $this->assertEquals(404, $exception->getStatusCode()); diff --git a/tests/Unit/Http/Exceptions/HttpPermanentRedirectTest.php b/tests/Unit/Http/Exceptions/HttpPermanentRedirectTest.php index e5886cb7..f132b272 100644 --- a/tests/Unit/Http/Exceptions/HttpPermanentRedirectTest.php +++ b/tests/Unit/Http/Exceptions/HttpPermanentRedirectTest.php @@ -11,7 +11,7 @@ class HttpPermanentRedirectTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpPermanentRedirect::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpPermanentRedirect('https://lorem.ipsum/foo/bar'); $this->assertInstanceOf(HttpRedirect::class, $exception); diff --git a/tests/Unit/Http/Exceptions/HttpRedirectTest.php b/tests/Unit/Http/Exceptions/HttpRedirectTest.php index 75e8bdd5..b12eb2fa 100644 --- a/tests/Unit/Http/Exceptions/HttpRedirectTest.php +++ b/tests/Unit/Http/Exceptions/HttpRedirectTest.php @@ -13,7 +13,7 @@ class HttpRedirectTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpRedirect::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpRedirect('https://lorem.ipsum/foo/bar'); $this->assertEquals(302, $exception->getStatusCode()); diff --git a/tests/Unit/Http/Exceptions/HttpTemporaryRedirectTest.php b/tests/Unit/Http/Exceptions/HttpTemporaryRedirectTest.php index 9c6709e7..2fb24403 100644 --- a/tests/Unit/Http/Exceptions/HttpTemporaryRedirectTest.php +++ b/tests/Unit/Http/Exceptions/HttpTemporaryRedirectTest.php @@ -11,7 +11,7 @@ class HttpTemporaryRedirectTest extends TestCase /** * @covers \Engelsystem\Http\Exceptions\HttpTemporaryRedirect::__construct */ - public function testConstruct() + public function testConstruct(): void { $exception = new HttpTemporaryRedirect('https://lorem.ipsum/foo/bar'); $this->assertInstanceOf(HttpRedirect::class, $exception); diff --git a/tests/Unit/Http/Exceptions/ValidationExceptionTest.php b/tests/Unit/Http/Exceptions/ValidationExceptionTest.php index c5a38b5a..04b7e708 100644 --- a/tests/Unit/Http/Exceptions/ValidationExceptionTest.php +++ b/tests/Unit/Http/Exceptions/ValidationExceptionTest.php @@ -13,7 +13,7 @@ class ValidationExceptionTest extends TestCase * @covers \Engelsystem\Http\Exceptions\ValidationException::__construct * @covers \Engelsystem\Http\Exceptions\ValidationException::getValidator */ - public function testConstruct() + public function testConstruct(): void { /** @var Validator|MockObject $validator */ $validator = $this->createMock(Validator::class); diff --git a/tests/Unit/Http/HttpClientServiceProviderTest.php b/tests/Unit/Http/HttpClientServiceProviderTest.php index 7dfc0a3e..5f9c4d85 100644 --- a/tests/Unit/Http/HttpClientServiceProviderTest.php +++ b/tests/Unit/Http/HttpClientServiceProviderTest.php @@ -12,7 +12,7 @@ class HttpClientServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\HttpClientServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); diff --git a/tests/Unit/Http/MessageTraitRequestTest.php b/tests/Unit/Http/MessageTraitRequestTest.php index 31ce68c3..874a06ff 100644 --- a/tests/Unit/Http/MessageTraitRequestTest.php +++ b/tests/Unit/Http/MessageTraitRequestTest.php @@ -14,7 +14,7 @@ class MessageTraitRequestTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withProtocolVersion */ - public function testWithProtocolVersion() + public function testWithProtocolVersion(): void { $message = new MessageTraitRequestImplementation(); $newMessage = $message->withProtocolVersion('0.1'); @@ -25,7 +25,7 @@ class MessageTraitRequestTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::getHeaders */ - public function testGetHeaders() + public function testGetHeaders(): void { $message = new MessageTraitRequestImplementation(); $newMessage = $message->withHeader('lorem', 'ipsum'); @@ -37,7 +37,7 @@ class MessageTraitRequestTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withBody */ - public function testWithBody() + public function testWithBody(): void { $stream = Stream::create('Test content'); $message = new MessageTraitRequestImplementation(); diff --git a/tests/Unit/Http/MessageTraitResponseTest.php b/tests/Unit/Http/MessageTraitResponseTest.php index 8ced6560..75d1befb 100644 --- a/tests/Unit/Http/MessageTraitResponseTest.php +++ b/tests/Unit/Http/MessageTraitResponseTest.php @@ -17,7 +17,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait */ - public function testCreate() + public function testCreate(): void { $message = new MessageTraitResponseImplementation(); $this->assertInstanceOf(MessageInterface::class, $message); @@ -28,7 +28,7 @@ class MessageTraitResponseTest extends TestCase * @covers \Engelsystem\Http\MessageTrait::getProtocolVersion * @covers \Engelsystem\Http\MessageTrait::withProtocolVersion */ - public function testGetProtocolVersion() + public function testGetProtocolVersion(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withProtocolVersion('0.1'); @@ -39,7 +39,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::getHeaders */ - public function testGetHeaders() + public function testGetHeaders(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withHeader('Foo', 'bar'); @@ -54,7 +54,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::hasHeader */ - public function testHasHeader() + public function testHasHeader(): void { $message = new MessageTraitResponseImplementation(); $this->assertFalse($message->hasHeader('test')); @@ -67,7 +67,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::getHeader */ - public function testGetHeader() + public function testGetHeader(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withHeader('foo', 'bar'); @@ -84,7 +84,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::getHeaderLine */ - public function testGetHeaderLine() + public function testGetHeaderLine(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withHeader('foo', ['bar', 'bla']); @@ -96,7 +96,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withHeader */ - public function testWithHeader() + public function testWithHeader(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withHeader('foo', 'bar'); @@ -111,7 +111,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withAddedHeader */ - public function testWithAddedHeader() + public function testWithAddedHeader(): void { $message = new MessageTraitResponseImplementation(); $newMessage = $message->withHeader('foo', 'bar'); @@ -126,7 +126,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withoutHeader */ - public function testWithoutHeader() + public function testWithoutHeader(): void { $message = (new MessageTraitResponseImplementation())->withHeader('foo', 'bar'); $this->assertTrue($message->hasHeader('foo')); @@ -139,7 +139,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::getBody */ - public function testGetBody() + public function testGetBody(): void { $message = (new MessageTraitResponseImplementation())->setContent('Foo bar!'); $body = $message->getBody(); @@ -151,7 +151,7 @@ class MessageTraitResponseTest extends TestCase /** * @covers \Engelsystem\Http\MessageTrait::withBody */ - public function testWithBody() + public function testWithBody(): void { $stream = Stream::create('Test content'); $message = new MessageTraitResponseImplementation(); diff --git a/tests/Unit/Http/Psr7ServiceProviderTest.php b/tests/Unit/Http/Psr7ServiceProviderTest.php index d0df726b..5a681697 100644 --- a/tests/Unit/Http/Psr7ServiceProviderTest.php +++ b/tests/Unit/Http/Psr7ServiceProviderTest.php @@ -18,7 +18,7 @@ class Psr7ServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\Psr7ServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { $app = new Application(); diff --git a/tests/Unit/Http/RedirectServiceProviderTest.php b/tests/Unit/Http/RedirectServiceProviderTest.php index 9c2a07fc..7bf16496 100644 --- a/tests/Unit/Http/RedirectServiceProviderTest.php +++ b/tests/Unit/Http/RedirectServiceProviderTest.php @@ -11,7 +11,7 @@ class RedirectServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\RedirectServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); diff --git a/tests/Unit/Http/RedirectorTest.php b/tests/Unit/Http/RedirectorTest.php index 78c24d1a..305b8181 100644 --- a/tests/Unit/Http/RedirectorTest.php +++ b/tests/Unit/Http/RedirectorTest.php @@ -15,7 +15,7 @@ class RedirectorTest extends TestCase * @covers \Engelsystem\Http\Redirector::__construct * @covers \Engelsystem\Http\Redirector::to */ - public function testTo() + public function testTo(): void { $request = new Request(); $response = new Response(); @@ -37,7 +37,7 @@ class RedirectorTest extends TestCase * @covers \Engelsystem\Http\Redirector::back * @covers \Engelsystem\Http\Redirector::getPreviousUrl */ - public function testBack() + public function testBack(): void { $request = new Request(); $response = new Response(); @@ -56,10 +56,7 @@ class RedirectorTest extends TestCase $this->assertEquals(['bar'], $return->getHeader('foo')); } - /** - * @return UrlGeneratorInterface|MockObject - */ - protected function getUrlGenerator() + protected function getUrlGenerator(): UrlGeneratorInterface|MockObject { /** @var UrlGeneratorInterface|MockObject $url */ $url = $this->getMockForAbstractClass(UrlGeneratorInterface::class); @@ -73,9 +70,8 @@ class RedirectorTest extends TestCase /** * Returns the provided path * - * @return string */ - public function returnPath(string $path) + public function returnPath(string $path): string { return $path; } diff --git a/tests/Unit/Http/RequestServiceProviderTest.php b/tests/Unit/Http/RequestServiceProviderTest.php index ec6b70d5..f2bebad9 100644 --- a/tests/Unit/Http/RequestServiceProviderTest.php +++ b/tests/Unit/Http/RequestServiceProviderTest.php @@ -34,7 +34,7 @@ class RequestServiceProviderTest extends ServiceProviderTest * * @param array $trustedProxies */ - public function testRegister(string|array $configuredProxies, array $trustedProxies) + public function testRegister(string|array $configuredProxies, array $trustedProxies): void { $config = new Config([ 'trusted_proxies' => $configuredProxies, @@ -67,7 +67,7 @@ class RequestServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\RequestServiceProvider::register */ - public function testRegisterRewritingPrefix() + public function testRegisterRewritingPrefix(): void { $config = new Config([ 'url' => 'https://some.app/subpath', @@ -109,7 +109,7 @@ class RequestServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Http\RequestServiceProvider::createRequestWithoutPrefix * @dataProvider provideRequestPathPrefix */ - public function testCreateRequestWithoutPrefix(string $requestUri, string $expected, string $url = null) + public function testCreateRequestWithoutPrefix(string $requestUri, string $expected, string $url = null): void { $_SERVER['REQUEST_URI'] = $requestUri; $config = new Config([ diff --git a/tests/Unit/Http/RequestTest.php b/tests/Unit/Http/RequestTest.php index 547a73d2..d26674f8 100644 --- a/tests/Unit/Http/RequestTest.php +++ b/tests/Unit/Http/RequestTest.php @@ -17,7 +17,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request */ - public function testCreate() + public function testCreate(): void { $response = new Request(); $this->assertInstanceOf(SymfonyRequest::class, $response); @@ -27,7 +27,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::postData */ - public function testPostData() + public function testPostData(): void { $request = new Request( ['foo' => 'I\'m a test!'], @@ -41,7 +41,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::input */ - public function testInput() + public function testInput(): void { $request = new Request( ['foo' => 'I\'m a test!'], @@ -55,7 +55,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::has */ - public function testHas() + public function testHas(): void { $request = new Request([ 'foo' => 'I\'m a test!', @@ -70,7 +70,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::hasPostData */ - public function testHasPostData() + public function testHasPostData(): void { $request = new Request([ 'foo' => 'bar', @@ -88,7 +88,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::path */ - public function testPath() + public function testPath(): void { /** @var Request|MockObject $request */ $request = $this @@ -111,7 +111,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::url */ - public function testUrl() + public function testUrl(): void { /** @var Request|MockObject $request */ $request = $this @@ -134,7 +134,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getRequestTarget */ - public function testGetRequestTarget() + public function testGetRequestTarget(): void { /** @var Request|MockObject $request */ $request = $this @@ -156,7 +156,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withRequestTarget */ - public function testWithRequestTarget() + public function testWithRequestTarget(): void { $request = new Request(); foreach ( @@ -174,7 +174,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withMethod */ - public function testWithMethod() + public function testWithMethod(): void { $request = new Request(); @@ -187,7 +187,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withUri */ - public function testWithUri() + public function testWithUri(): void { /** @var UriInterface|MockObject $uri */ $uri = $this->getMockForAbstractClass(UriInterface::class); @@ -209,7 +209,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getServerParams */ - public function testGetServerParams() + public function testGetServerParams(): void { $server = ['foo' => 'bar']; $request = new Request([], [], [], [], [], $server); @@ -220,7 +220,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getCookieParams */ - public function testGetCookieParams() + public function testGetCookieParams(): void { $cookies = ['session' => 'LoremIpsumDolorSit']; $request = new Request([], [], [], $cookies); @@ -231,7 +231,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withCookieParams */ - public function testWithCookieParams() + public function testWithCookieParams(): void { $cookies = ['lor' => 'em']; $request = new Request(); @@ -245,7 +245,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getQueryParams */ - public function testGetQueryParams() + public function testGetQueryParams(): void { $params = ['foo' => 'baz']; $request = new Request($params); @@ -256,7 +256,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withQueryParams */ - public function testWithQueryParams() + public function testWithQueryParams(): void { $params = ['test' => 'ing']; $request = new Request(); @@ -270,7 +270,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getUploadedFiles */ - public function testGetUploadedFiles() + public function testGetUploadedFiles(): void { $filename = tempnam(sys_get_temp_dir(), 'test'); file_put_contents($filename, 'LoremIpsum!'); @@ -292,7 +292,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withUploadedFiles */ - public function testWithUploadedFiles() + public function testWithUploadedFiles(): void { $filename = tempnam(sys_get_temp_dir(), 'test'); file_put_contents($filename, 'LoremIpsum!'); @@ -314,7 +314,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getParsedBody */ - public function testGetParsedBody() + public function testGetParsedBody(): void { $body = ['foo' => 'lorem']; $request = new Request(); @@ -326,7 +326,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withParsedBody */ - public function testWithParsedBody() + public function testWithParsedBody(): void { $data = ['test' => 'er']; $request = new Request(); @@ -340,7 +340,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getAttributes */ - public function testGetAttributes() + public function testGetAttributes(): void { $attributes = ['foo' => 'lorem', 'ipsum' => 'dolor']; $request = new Request([], [], $attributes); @@ -351,7 +351,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::getAttribute */ - public function testGetAttribute() + public function testGetAttribute(): void { $attributes = ['foo' => 'lorem', 'ipsum' => 'dolor']; $request = new Request([], [], $attributes); @@ -364,7 +364,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withAttribute */ - public function testWithAttribute() + public function testWithAttribute(): void { $request = new Request(); @@ -377,7 +377,7 @@ class RequestTest extends TestCase /** * @covers \Engelsystem\Http\Request::withoutAttribute */ - public function testWithoutAttribute() + public function testWithoutAttribute(): void { $attributes = ['foo' => 'lorem', 'ipsum' => 'dolor']; $request = new Request([], [], $attributes); diff --git a/tests/Unit/Http/ResponseServiceProviderTest.php b/tests/Unit/Http/ResponseServiceProviderTest.php index de252b99..126ee44a 100644 --- a/tests/Unit/Http/ResponseServiceProviderTest.php +++ b/tests/Unit/Http/ResponseServiceProviderTest.php @@ -13,7 +13,7 @@ class ResponseServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\ResponseServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var Response|MockObject $response */ $response = $this->getMockBuilder(Response::class) diff --git a/tests/Unit/Http/ResponseTest.php b/tests/Unit/Http/ResponseTest.php index a1b1bdc5..229f5f49 100644 --- a/tests/Unit/Http/ResponseTest.php +++ b/tests/Unit/Http/ResponseTest.php @@ -20,7 +20,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response */ - public function testCreate() + public function testCreate(): void { $response = new Response(); $this->assertInstanceOf(SymfonyResponse::class, $response); @@ -31,7 +31,7 @@ class ResponseTest extends TestCase * @covers \Engelsystem\Http\Response::getReasonPhrase * @covers \Engelsystem\Http\Response::withStatus */ - public function testWithStatus() + public function testWithStatus(): void { $response = new Response(); $newResponse = $response->withStatus(503); @@ -46,7 +46,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::withContent */ - public function testWithContent() + public function testWithContent(): void { $response = new Response(); $newResponse = $response->withContent('Lorem Ipsum?'); @@ -59,7 +59,7 @@ class ResponseTest extends TestCase * @covers \Engelsystem\Http\Response::withView * @covers \Engelsystem\Http\Response::setRenderer */ - public function testWithView() + public function testWithView(): void { /** @var Renderer|MockObject $renderer */ $renderer = $this->createMock(Renderer::class); @@ -92,7 +92,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::withView */ - public function testWithViewNoRenderer() + public function testWithViewNoRenderer(): void { $this->expectException(InvalidArgumentException::class); @@ -103,7 +103,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::redirectTo */ - public function testRedirectTo() + public function testRedirectTo(): void { $response = new Response(); $newResponse = $response->redirectTo('http://foo.bar/lorem', 301, ['test' => 'ing']); @@ -122,7 +122,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::with */ - public function testWith() + public function testWith(): void { $session = new Session(new MockArraySessionStorage()); $response = new Response('', 200, [], null, $session); @@ -140,7 +140,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::with */ - public function testWithNoSession() + public function testWithNoSession(): void { $this->expectException(InvalidArgumentException::class); @@ -151,7 +151,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::withInput */ - public function testWithInput() + public function testWithInput(): void { $session = new Session(new MockArraySessionStorage()); $response = new Response('', 200, [], null, $session); @@ -166,7 +166,7 @@ class ResponseTest extends TestCase /** * @covers \Engelsystem\Http\Response::withInput */ - public function testWithInputNoSession() + public function testWithInputNoSession(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Unit/Http/SessionHandlers/AbstractHandlerTest.php b/tests/Unit/Http/SessionHandlers/AbstractHandlerTest.php index 34174740..d042c329 100644 --- a/tests/Unit/Http/SessionHandlers/AbstractHandlerTest.php +++ b/tests/Unit/Http/SessionHandlers/AbstractHandlerTest.php @@ -10,7 +10,7 @@ class AbstractHandlerTest extends TestCase /** * @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::open */ - public function testOpen() + public function testOpen(): void { $handler = new ArrayHandler(); $return = $handler->open('/foo/bar', '1337asd098hkl7654'); @@ -23,7 +23,7 @@ class AbstractHandlerTest extends TestCase /** * @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::close */ - public function testClose() + public function testClose(): void { $handler = new ArrayHandler(); $return = $handler->close(); @@ -34,7 +34,7 @@ class AbstractHandlerTest extends TestCase /** * @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::gc */ - public function testGc() + public function testGc(): void { $handler = new ArrayHandler(); $return = $handler->gc(60 * 60 * 24); diff --git a/tests/Unit/Http/SessionHandlers/DatabaseHandlerTest.php b/tests/Unit/Http/SessionHandlers/DatabaseHandlerTest.php index 99abbdaa..cbc1b041 100644 --- a/tests/Unit/Http/SessionHandlers/DatabaseHandlerTest.php +++ b/tests/Unit/Http/SessionHandlers/DatabaseHandlerTest.php @@ -15,7 +15,7 @@ class DatabaseHandlerTest extends TestCase * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getQuery * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::read */ - public function testRead() + public function testRead(): void { $handler = new DatabaseHandler($this->database); $this->assertEquals('', $handler->read('foo')); @@ -28,7 +28,7 @@ class DatabaseHandlerTest extends TestCase * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getCurrentTimestamp * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::write */ - public function testWrite() + public function testWrite(): void { $handler = new DatabaseHandler($this->database); @@ -46,7 +46,7 @@ class DatabaseHandlerTest extends TestCase /** * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::destroy */ - public function testDestroy() + public function testDestroy(): void { $this->database->insert("INSERT INTO sessions VALUES ('foo', 'Lorem Ipsum', CURRENT_TIMESTAMP)"); $this->database->insert("INSERT INTO sessions VALUES ('bar', 'Dolor Sit', CURRENT_TIMESTAMP)"); @@ -69,7 +69,7 @@ class DatabaseHandlerTest extends TestCase /** * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::gc */ - public function testGc() + public function testGc(): void { $this->database->insert("INSERT INTO sessions VALUES ('foo', 'Lorem Ipsum', '2000-01-01 01:00')"); $this->database->insert("INSERT INTO sessions VALUES ('bar', 'Dolor Sit', '3000-01-01 01:00')"); diff --git a/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php b/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php index 4d37da48..9c44bf22 100644 --- a/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php +++ b/tests/Unit/Http/SessionHandlers/Stub/ArrayHandler.php @@ -41,17 +41,11 @@ class ArrayHandler extends AbstractHandler return true; } - /** - * @return string - */ public function getName(): string { return $this->name; } - /** - * @return string - */ public function getSessionPath(): string { return $this->sessionPath; diff --git a/tests/Unit/Http/SessionServiceProviderTest.php b/tests/Unit/Http/SessionServiceProviderTest.php index 037f6e04..df90c629 100644 --- a/tests/Unit/Http/SessionServiceProviderTest.php +++ b/tests/Unit/Http/SessionServiceProviderTest.php @@ -20,7 +20,7 @@ class SessionServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Http\SessionServiceProvider::getSessionStorage() * @covers \Engelsystem\Http\SessionServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { $app = $this->getApp(['make', 'instance', 'bind', 'get']); @@ -128,7 +128,7 @@ class SessionServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\SessionServiceProvider::isCli() */ - public function testIsCli() + public function testIsCli(): void { $app = $this->getApp(['make', 'instance', 'bind', 'get']); @@ -170,10 +170,7 @@ class SessionServiceProviderTest extends ServiceProviderTest $serviceProvider->register(); } - /** - * @return MockObject - */ - private function getSessionMock() + private function getSessionMock(): MockObject { $sessionStorage = $this->getMockForAbstractClass(StorageInterface::class); return $this->getMockBuilder(Session::class) @@ -182,10 +179,7 @@ class SessionServiceProviderTest extends ServiceProviderTest ->getMock(); } - /** - * @return MockObject - */ - private function getRequestMock() + private function getRequestMock(): MockObject { return $this->getMockBuilder(Request::class) ->onlyMethods(['setSession']) diff --git a/tests/Unit/Http/UrlGeneratorServiceProviderTest.php b/tests/Unit/Http/UrlGeneratorServiceProviderTest.php index 6d18f160..f96fa47e 100644 --- a/tests/Unit/Http/UrlGeneratorServiceProviderTest.php +++ b/tests/Unit/Http/UrlGeneratorServiceProviderTest.php @@ -13,7 +13,7 @@ class UrlGeneratorServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\UrlGeneratorServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var UrlGenerator|MockObject $urlGenerator */ $urlGenerator = $this->getMockBuilder(UrlGenerator::class) diff --git a/tests/Unit/Http/UrlGeneratorTest.php b/tests/Unit/Http/UrlGeneratorTest.php index b9eb7c92..b4948134 100644 --- a/tests/Unit/Http/UrlGeneratorTest.php +++ b/tests/Unit/Http/UrlGeneratorTest.php @@ -28,8 +28,13 @@ class UrlGeneratorTest extends TestCase * * @param string[] $arguments */ - public function testTo(string $urlToPath, string $path, string $willReturn, array $arguments, string $expectedUrl) - { + public function testTo( + string $urlToPath, + string $path, + string $willReturn, + array $arguments, + string $expectedUrl + ): void { $request = $this->getMockBuilder(Request::class) ->getMock(); $request->expects($this->once()) @@ -48,7 +53,7 @@ class UrlGeneratorTest extends TestCase /** * @covers \Engelsystem\Http\UrlGenerator::to */ - public function testToWithValidUrl() + public function testToWithValidUrl(): void { $url = new UrlGenerator(); $this->app->instance('config', new Config()); @@ -63,7 +68,7 @@ class UrlGeneratorTest extends TestCase * @covers \Engelsystem\Http\UrlGenerator::to * @covers \Engelsystem\Http\UrlGenerator::generateUrl */ - public function testToWithApplicationURL() + public function testToWithApplicationURL(): void { $this->app->instance('config', new Config(['url' => 'https://foo.bar/base/'])); @@ -81,7 +86,7 @@ class UrlGeneratorTest extends TestCase /** * @covers \Engelsystem\Http\UrlGenerator::isValidUrl */ - public function testIsValidUrl() + public function testIsValidUrl(): void { $url = new UrlGenerator(); diff --git a/tests/Unit/Http/Validation/Rules/BetweenTest.php b/tests/Unit/Http/Validation/Rules/BetweenTest.php index 130d2f93..39d1adce 100644 --- a/tests/Unit/Http/Validation/Rules/BetweenTest.php +++ b/tests/Unit/Http/Validation/Rules/BetweenTest.php @@ -10,7 +10,7 @@ class BetweenTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\Between */ - public function testValidate() + public function testValidate(): void { $rule = new Between(3, 10); $this->assertFalse($rule->validate(1)); diff --git a/tests/Unit/Http/Validation/Rules/CheckedTest.php b/tests/Unit/Http/Validation/Rules/CheckedTest.php index 59a27156..419df1e0 100644 --- a/tests/Unit/Http/Validation/Rules/CheckedTest.php +++ b/tests/Unit/Http/Validation/Rules/CheckedTest.php @@ -10,7 +10,7 @@ class CheckedTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\Checked::validate */ - public function testValidate() + public function testValidate(): void { $rule = new Checked(); diff --git a/tests/Unit/Http/Validation/Rules/InTest.php b/tests/Unit/Http/Validation/Rules/InTest.php index e5688d90..f0b3f696 100644 --- a/tests/Unit/Http/Validation/Rules/InTest.php +++ b/tests/Unit/Http/Validation/Rules/InTest.php @@ -10,7 +10,7 @@ class InTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\In::__construct */ - public function testConstruct() + public function testConstruct(): void { $rule = new In('foo,bar'); diff --git a/tests/Unit/Http/Validation/Rules/MaxTest.php b/tests/Unit/Http/Validation/Rules/MaxTest.php index 3f4d9516..a54da658 100644 --- a/tests/Unit/Http/Validation/Rules/MaxTest.php +++ b/tests/Unit/Http/Validation/Rules/MaxTest.php @@ -10,7 +10,7 @@ class MaxTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\Max */ - public function testValidate() + public function testValidate(): void { $rule = new Max(3); $this->assertFalse($rule->validate(10)); diff --git a/tests/Unit/Http/Validation/Rules/MinTest.php b/tests/Unit/Http/Validation/Rules/MinTest.php index 56350802..24f08505 100644 --- a/tests/Unit/Http/Validation/Rules/MinTest.php +++ b/tests/Unit/Http/Validation/Rules/MinTest.php @@ -10,7 +10,7 @@ class MinTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\Min */ - public function testValidate() + public function testValidate(): void { $rule = new Min(3); $this->assertFalse($rule->validate(1)); diff --git a/tests/Unit/Http/Validation/Rules/NotInTest.php b/tests/Unit/Http/Validation/Rules/NotInTest.php index 9be12336..ef157965 100644 --- a/tests/Unit/Http/Validation/Rules/NotInTest.php +++ b/tests/Unit/Http/Validation/Rules/NotInTest.php @@ -10,7 +10,7 @@ class NotInTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Rules\NotIn::validate */ - public function testConstruct() + public function testConstruct(): void { $rule = new NotIn('foo,bar'); diff --git a/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php index 2c8e0fe9..26c68079 100644 --- a/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php +++ b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php @@ -12,7 +12,7 @@ class StringInputLengthTest extends TestCase * @covers \Engelsystem\Http\Validation\Rules\StringInputLength::isDateTime * @dataProvider validateProvider */ - public function testValidate(mixed $input, mixed $expectedInput) + public function testValidate(mixed $input, mixed $expectedInput): void { $rule = new UsesStringInputLength(); $rule->validate($input); @@ -23,7 +23,7 @@ class StringInputLengthTest extends TestCase /** * @return array[] */ - public function validateProvider() + public function validateProvider(): array { return [ ['TEST', 4], diff --git a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php index 3611b07a..ee3699a6 100644 --- a/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php +++ b/tests/Unit/Http/Validation/Rules/Stub/ParentClassImplementation.php @@ -10,9 +10,6 @@ class ParentClassImplementation /** @var mixed */ public $lastInput; - /** - * @return bool - */ public function validate(mixed $input): bool { $this->lastInput = $input; diff --git a/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php b/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php index c6e4b59c..6ffb2b21 100644 --- a/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php +++ b/tests/Unit/Http/Validation/Stub/ValidatesRequestImplementation.php @@ -11,15 +11,12 @@ class ValidatesRequestImplementation extends BaseController * @param array $rules * @return array */ - public function validateData(Request $request, array $rules) + public function validateData(Request $request, array $rules): array { return $this->validate($request, $rules); } - /** - * @return bool - */ - public function hasValidator() + public function hasValidator(): bool { return !is_null($this->validator); } diff --git a/tests/Unit/Http/Validation/ValidatesRequestTest.php b/tests/Unit/Http/Validation/ValidatesRequestTest.php index 8011bd03..f446dee1 100644 --- a/tests/Unit/Http/Validation/ValidatesRequestTest.php +++ b/tests/Unit/Http/Validation/ValidatesRequestTest.php @@ -15,7 +15,7 @@ class ValidatesRequestTest extends TestCase * @covers \Engelsystem\Http\Validation\ValidatesRequest::validate * @covers \Engelsystem\Http\Validation\ValidatesRequest::setValidator */ - public function testValidate() + public function testValidate(): void { /** @var Validator|MockObject $validator */ $validator = $this->createMock(Validator::class); diff --git a/tests/Unit/Http/Validation/ValidationServiceProviderTest.php b/tests/Unit/Http/Validation/ValidationServiceProviderTest.php index 969f4351..65d893cf 100644 --- a/tests/Unit/Http/Validation/ValidationServiceProviderTest.php +++ b/tests/Unit/Http/Validation/ValidationServiceProviderTest.php @@ -14,7 +14,7 @@ class ValidationServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Http\Validation\ValidationServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = new Application(); diff --git a/tests/Unit/Http/Validation/ValidatorTest.php b/tests/Unit/Http/Validation/ValidatorTest.php index 44be56d9..29c8f987 100644 --- a/tests/Unit/Http/Validation/ValidatorTest.php +++ b/tests/Unit/Http/Validation/ValidatorTest.php @@ -13,7 +13,7 @@ class ValidatorTest extends TestCase * @covers \Engelsystem\Http\Validation\Validator::getData * @covers \Engelsystem\Http\Validation\Validator::getErrors */ - public function testValidate() + public function testValidate(): void { $val = new Validator(); @@ -36,7 +36,7 @@ class ValidatorTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Validator::validate */ - public function testValidateChaining() + public function testValidateChaining(): void { $val = new Validator(); @@ -63,7 +63,7 @@ class ValidatorTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Validator::validate */ - public function testValidateMultipleParameters() + public function testValidateMultipleParameters(): void { $val = new Validator(); @@ -84,7 +84,7 @@ class ValidatorTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Validator::validate */ - public function testValidateNotImplemented() + public function testValidateNotImplemented(): void { $val = new Validator(); @@ -100,7 +100,7 @@ class ValidatorTest extends TestCase * @covers \Engelsystem\Http\Validation\Validator::map * @covers \Engelsystem\Http\Validation\Validator::mapBack */ - public function testValidateMapping() + public function testValidateMapping(): void { $val = new Validator(); @@ -138,7 +138,7 @@ class ValidatorTest extends TestCase /** * @covers \Engelsystem\Http\Validation\Validator::validate */ - public function testValidateNesting() + public function testValidateNesting(): void { $val = new Validator(); diff --git a/tests/Unit/Logger/LoggerServiceProviderTest.php b/tests/Unit/Logger/LoggerServiceProviderTest.php index 1d6e1df4..01205f65 100644 --- a/tests/Unit/Logger/LoggerServiceProviderTest.php +++ b/tests/Unit/Logger/LoggerServiceProviderTest.php @@ -15,7 +15,7 @@ class LoggerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Logger\LoggerServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $serviceProvider = new LoggerServiceProvider($this->app); $serviceProvider->register(); @@ -29,7 +29,7 @@ class LoggerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Logger\LoggerServiceProvider::boot */ - public function testBoot() + public function testBoot(): void { /** @var Authenticator|MockObject $auth */ $auth = $this->getMockBuilder(Authenticator::class) diff --git a/tests/Unit/Logger/LoggerTest.php b/tests/Unit/Logger/LoggerTest.php index 3d956e75..40389acd 100644 --- a/tests/Unit/Logger/LoggerTest.php +++ b/tests/Unit/Logger/LoggerTest.php @@ -15,7 +15,7 @@ class LoggerTest extends ServiceProviderTest * @covers \Engelsystem\Logger\Logger::__construct * @covers \Engelsystem\Logger\Logger::log */ - public function testLog() + public function testLog(): void { /** @var LogEntry|MockObject $logEntry */ $logEntry = $this->getMockBuilder(LogEntry::class) @@ -34,7 +34,7 @@ class LoggerTest extends ServiceProviderTest * @covers \Engelsystem\Logger\Logger::log * @covers \Engelsystem\Logger\Logger::checkLevel */ - public function testCheckLevel() + public function testCheckLevel(): void { /** @var LogEntry|MockObject $logEntry */ $logEntry = $this->createMock(LogEntry::class); @@ -47,7 +47,7 @@ class LoggerTest extends ServiceProviderTest /** * @covers \Engelsystem\Logger\Logger::interpolate */ - public function testInterpolate() + public function testInterpolate(): void { /** @var LogEntry|MockObject $logEntry */ $logEntry = $this->getMockBuilder(LogEntry::class) @@ -69,7 +69,7 @@ class LoggerTest extends ServiceProviderTest 'user' => new class { - public function __toString() + public function __toString(): string { return 'Bar'; } diff --git a/tests/Unit/Logger/UserAwareLoggerTest.php b/tests/Unit/Logger/UserAwareLoggerTest.php index e53341cc..4fe5d45c 100644 --- a/tests/Unit/Logger/UserAwareLoggerTest.php +++ b/tests/Unit/Logger/UserAwareLoggerTest.php @@ -16,7 +16,7 @@ class UserAwareLoggerTest extends ServiceProviderTest * @covers \Engelsystem\Logger\UserAwareLogger::log * @covers \Engelsystem\Logger\UserAwareLogger::setAuth */ - public function testLog() + public function testLog(): void { $user = User::factory(['id' => 1, 'name' => 'admin'])->make(); diff --git a/tests/Unit/Mail/EngelsystemMailerTest.php b/tests/Unit/Mail/EngelsystemMailerTest.php index 96f16f51..17dc49ab 100644 --- a/tests/Unit/Mail/EngelsystemMailerTest.php +++ b/tests/Unit/Mail/EngelsystemMailerTest.php @@ -23,7 +23,7 @@ class EngelsystemMailerTest extends TestCase * @covers \Engelsystem\Mail\EngelsystemMailer::__construct * @covers \Engelsystem\Mail\EngelsystemMailer::sendView */ - public function testSendView() + public function testSendView(): void { /** @var Renderer|MockObject $view */ $view = $this->createMock(Renderer::class); @@ -43,7 +43,7 @@ class EngelsystemMailerTest extends TestCase /** * @covers \Engelsystem\Mail\EngelsystemMailer::sendViewTranslated */ - public function testSendViewTranslated() + public function testSendViewTranslated(): void { $this->initDatabase(); @@ -87,14 +87,14 @@ class EngelsystemMailerTest extends TestCase * @covers \Engelsystem\Mail\EngelsystemMailer::send * @covers \Engelsystem\Mail\EngelsystemMailer::setSubjectPrefix */ - public function testSend() + public function testSend(): void { /** @var MailerInterface|MockObject $symfonyMailer */ $symfonyMailer = $this->createMock(MailerInterface::class); $symfonyMailer->expects($this->once()) ->method('send') - ->willReturnCallback(function (RawMessage $message, Envelope $envelope = null) { + ->willReturnCallback(function (RawMessage $message, Envelope $envelope = null): void { $this->assertStringContainsString('foo@bar.baz', $message->toString()); $this->assertStringContainsString('Foo Bar', $message->toString()); $this->assertStringContainsString('Mail test', $message->toString()); diff --git a/tests/Unit/Mail/MailerServiceProviderTest.php b/tests/Unit/Mail/MailerServiceProviderTest.php index 4b3957d1..a0227b61 100644 --- a/tests/Unit/Mail/MailerServiceProviderTest.php +++ b/tests/Unit/Mail/MailerServiceProviderTest.php @@ -46,7 +46,7 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Mail\MailerServiceProvider::register */ - public function testRegister() + public function testRegister(): void { $app = $this->getApplication(); @@ -71,7 +71,7 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @return array */ - public function provideTransports() + public function provideTransports(): array { return [ [LogTransport::class, ['email' => ['driver' => 'log']]], @@ -89,7 +89,7 @@ class MailerServiceProviderTest extends ServiceProviderTest * @param array $emailConfig * @dataProvider provideTransports */ - public function testGetTransport(string $class, array $emailConfig = []) + public function testGetTransport(string $class, array $emailConfig = []): void { $app = $this->getApplication($emailConfig); @@ -103,7 +103,7 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Mail\MailerServiceProvider::getTransport */ - public function testGetTransportNotFound() + public function testGetTransportNotFound(): void { $app = $this->getApplication(['email' => ['driver' => 'foo-bar-batz']]); $this->expectException(InvalidArgumentException::class); @@ -115,7 +115,7 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Mail\MailerServiceProvider::getSmtpTransport */ - public function testGetSmtpTransport() + public function testGetSmtpTransport(): void { $app = $this->getApplication($this->smtpConfig); @@ -131,7 +131,6 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @param array $configuration - * @return Application */ protected function getApplication(array $configuration = []): Application { @@ -149,7 +148,7 @@ class MailerServiceProviderTest extends ServiceProviderTest /** * @param string[] $abstracts */ - protected function assertExistsInContainer(array $abstracts, Application $container) + protected function assertExistsInContainer(array $abstracts, Application $container): void { $first = array_shift($abstracts); $this->assertContainerHas($first, $container); @@ -160,7 +159,7 @@ class MailerServiceProviderTest extends ServiceProviderTest } } - protected function assertContainerHas(string $abstract, Application $container) + protected function assertContainerHas(string $abstract, Application $container): void { $this->assertTrue( $container->has($abstract) || $container->hasMethodBinding($abstract), diff --git a/tests/Unit/Mail/MailerTest.php b/tests/Unit/Mail/MailerTest.php index e3bde7af..7784780c 100644 --- a/tests/Unit/Mail/MailerTest.php +++ b/tests/Unit/Mail/MailerTest.php @@ -18,7 +18,7 @@ class MailerTest extends TestCase * @covers \Engelsystem\Mail\Mailer::setFromAddress * @covers \Engelsystem\Mail\Mailer::setFromName */ - public function testInitAndSettersAndGetters() + public function testInitAndSettersAndGetters(): void { /** @var MailerInterface|MockObject $symfonyMailer */ $symfonyMailer = $this->createMock(MailerInterface::class); @@ -35,13 +35,13 @@ class MailerTest extends TestCase /** * @covers \Engelsystem\Mail\Mailer::send */ - public function testSend() + public function testSend(): void { /** @var MailerInterface|MockObject $symfonyMailer */ $symfonyMailer = $this->createMock(MailerInterface::class); $symfonyMailer->expects($this->once()) ->method('send') - ->willReturnCallback(function (RawMessage $message, Envelope $envelope = null) { + ->willReturnCallback(function (RawMessage $message, Envelope $envelope = null): void { $this->assertStringContainsString('to@xam.pel', $message->toString()); $this->assertStringContainsString('foo@bar.baz', $message->toString()); $this->assertStringContainsString('Test Tester', $message->toString()); diff --git a/tests/Unit/Mail/Transport/LogTransportTest.php b/tests/Unit/Mail/Transport/LogTransportTest.php index eb5f0b6e..f1a26887 100644 --- a/tests/Unit/Mail/Transport/LogTransportTest.php +++ b/tests/Unit/Mail/Transport/LogTransportTest.php @@ -15,7 +15,7 @@ class LogTransportTest extends TestCase * @covers \Engelsystem\Mail\Transport\LogTransport::__construct * @covers \Engelsystem\Mail\Transport\LogTransport::doSend */ - public function testSend() + public function testSend(): void { $logger = new TestLogger(); $email = (new Email()) @@ -33,7 +33,7 @@ class LogTransportTest extends TestCase /** * @covers \Engelsystem\Mail\Transport\LogTransport::__toString */ - public function testToString() + public function testToString(): void { /** @var LoggerInterface|MockObject $logger */ $logger = $this->getMockForAbstractClass(LoggerInterface::class); diff --git a/tests/Unit/Middleware/AddHeadersTest.php b/tests/Unit/Middleware/AddHeadersTest.php index be61f9e9..5832ec55 100644 --- a/tests/Unit/Middleware/AddHeadersTest.php +++ b/tests/Unit/Middleware/AddHeadersTest.php @@ -19,7 +19,7 @@ class AddHeadersTest extends TestCase * @covers \Engelsystem\Middleware\AddHeaders::__construct * @covers \Engelsystem\Middleware\AddHeaders::process */ - public function testRegister() + public function testRegister(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockForAbstractClass(ServerRequestInterface::class); diff --git a/tests/Unit/Middleware/CallableHandlerTest.php b/tests/Unit/Middleware/CallableHandlerTest.php index 72761bb5..a7714691 100644 --- a/tests/Unit/Middleware/CallableHandlerTest.php +++ b/tests/Unit/Middleware/CallableHandlerTest.php @@ -16,10 +16,10 @@ use stdClass; class CallableHandlerTest extends TestCase { - public function provideCallable() + public function provideCallable(): array { return [ - [function () { + [function (): void { }], [[$this, 'provideCallable']], [[HasStaticMethod::class, 'foo']], @@ -31,7 +31,7 @@ class CallableHandlerTest extends TestCase * @covers \Engelsystem\Middleware\CallableHandler::__construct * @covers \Engelsystem\Middleware\CallableHandler::getCallable */ - public function testInit(callable $callable) + public function testInit(callable $callable): void { $handler = new CallableHandler($callable); @@ -41,7 +41,7 @@ class CallableHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\CallableHandler::process */ - public function testProcess() + public function testProcess(): void { /** @var ServerRequestInterface|MockObject $request */ /** @var ResponseInterface|MockObject $response */ @@ -61,7 +61,7 @@ class CallableHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\CallableHandler::handle */ - public function testHandler() + public function testHandler(): void { /** @var ServerRequestInterface|MockObject $request */ /** @var ResponseInterface|MockObject $response */ @@ -80,7 +80,7 @@ class CallableHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\CallableHandler::execute */ - public function testExecute() + public function testExecute(): void { /** @var ServerRequestInterface|MockObject $request */ /** @var Response|MockObject $response */ diff --git a/tests/Unit/Middleware/DispatcherTest.php b/tests/Unit/Middleware/DispatcherTest.php index 6c1d348a..39811ef0 100644 --- a/tests/Unit/Middleware/DispatcherTest.php +++ b/tests/Unit/Middleware/DispatcherTest.php @@ -4,7 +4,6 @@ namespace Engelsystem\Test\Unit\Middleware; use Engelsystem\Application; use Engelsystem\Middleware\Dispatcher; -use InvalidArgumentException; use LogicException; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -13,13 +12,14 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; use ReflectionClass as Reflection; +use TypeError; class DispatcherTest extends TestCase { /** * @covers \Engelsystem\Middleware\Dispatcher::__construct */ - public function testInit() + public function testInit(): void { /** @var Application|MockObject $container */ $container = $this->createMock(Application::class); @@ -37,7 +37,7 @@ class DispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\Dispatcher::process */ - public function testProcess() + public function testProcess(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -68,7 +68,7 @@ class DispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\Dispatcher::handle */ - public function testHandle() + public function testHandle(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -90,7 +90,7 @@ class DispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\Dispatcher::handle */ - public function testHandleNext() + public function testHandleNext(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -117,7 +117,7 @@ class DispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\Dispatcher::handle */ - public function testHandleNoMiddleware() + public function testHandleNoMiddleware(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -131,7 +131,7 @@ class DispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\Dispatcher::handle */ - public function testHandleCallResolve() + public function testHandleCallResolve(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -159,14 +159,14 @@ class DispatcherTest extends TestCase $return = $dispatcher->handle($request); $this->assertEquals($response, $return); - $this->expectException(InvalidArgumentException::class); + $this->expectException(TypeError::class); $dispatcher->handle($request); } /** * @covers \Engelsystem\Middleware\Dispatcher::setContainer */ - public function testSetContainer() + public function testSetContainer(): void { /** @var Application|MockObject $container */ $container = $this->createMock(Application::class); diff --git a/tests/Unit/Middleware/ErrorHandlerTest.php b/tests/Unit/Middleware/ErrorHandlerTest.php index cca346a2..cd657257 100644 --- a/tests/Unit/Middleware/ErrorHandlerTest.php +++ b/tests/Unit/Middleware/ErrorHandlerTest.php @@ -32,7 +32,7 @@ class ErrorHandlerTest extends TestCase * @covers \Engelsystem\Middleware\ErrorHandler::process * @covers \Engelsystem\Middleware\ErrorHandler::selectView */ - public function testProcess() + public function testProcess(): void { /** @var TwigLoader|MockObject $twigLoader */ $twigLoader = $this->createMock(TwigLoader::class); @@ -121,7 +121,7 @@ class ErrorHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\ErrorHandler::process */ - public function testProcessHttpException() + public function testProcessHttpException(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -142,7 +142,7 @@ class ErrorHandlerTest extends TestCase $returnResponseHandler->expects($this->once()) ->method('handle') - ->willReturnCallback(function () { + ->willReturnCallback(function (): void { throw new HttpException(300, 'Some response', ['lor' => 'em']); }); @@ -165,7 +165,7 @@ class ErrorHandlerTest extends TestCase * @covers \Engelsystem\Middleware\ErrorHandler::process * @covers \Engelsystem\Middleware\ErrorHandler::redirectBack */ - public function testProcessValidationException() + public function testProcessValidationException(): void { /** @var TwigLoader|MockObject $twigLoader */ $twigLoader = $this->createMock(TwigLoader::class); @@ -174,7 +174,7 @@ class ErrorHandlerTest extends TestCase $handler->expects($this->exactly(2)) ->method('handle') - ->willReturnCallback(function () use ($validator) { + ->willReturnCallback(function () use ($validator): void { throw new ValidationException($validator); }); @@ -229,7 +229,7 @@ class ErrorHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\ErrorHandler::process */ - public function testProcessModelNotFoundException() + public function testProcessModelNotFoundException(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); @@ -251,7 +251,7 @@ class ErrorHandlerTest extends TestCase $returnResponseHandler->expects($this->once()) ->method('handle') - ->willReturnCallback(function () { + ->willReturnCallback(function (): void { throw new ModelNotFoundException('Some model could not be found'); }); @@ -273,7 +273,7 @@ class ErrorHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\ErrorHandler::process */ - public function testProcessContentTypeSniffer() + public function testProcessContentTypeSniffer(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->createMock(ServerRequestInterface::class); diff --git a/tests/Unit/Middleware/ExceptionHandlerTest.php b/tests/Unit/Middleware/ExceptionHandlerTest.php index 33429cc0..af252ae9 100644 --- a/tests/Unit/Middleware/ExceptionHandlerTest.php +++ b/tests/Unit/Middleware/ExceptionHandlerTest.php @@ -20,7 +20,7 @@ class ExceptionHandlerTest extends TestCase * @covers \Engelsystem\Middleware\ExceptionHandler::__construct * @covers \Engelsystem\Middleware\ExceptionHandler::process */ - public function testRegister() + public function testRegister(): void { /** @var ContainerInterface|MockObject $container */ $container = $this->getMockForAbstractClass(ContainerInterface::class); diff --git a/tests/Unit/Middleware/LegacyMiddlewareTest.php b/tests/Unit/Middleware/LegacyMiddlewareTest.php index 713e8f4f..8e62c27a 100644 --- a/tests/Unit/Middleware/LegacyMiddlewareTest.php +++ b/tests/Unit/Middleware/LegacyMiddlewareTest.php @@ -20,7 +20,7 @@ class LegacyMiddlewareTest extends TestCase * @covers \Engelsystem\Middleware\LegacyMiddleware::__construct * @covers \Engelsystem\Middleware\LegacyMiddleware::process */ - public function testRegister() + public function testRegister(): void { /** @var ContainerInterface|MockObject $container */ $container = $this->getMockForAbstractClass(ContainerInterface::class); diff --git a/tests/Unit/Middleware/RequestHandlerServiceProviderTest.php b/tests/Unit/Middleware/RequestHandlerServiceProviderTest.php index 281016b5..06dc2994 100644 --- a/tests/Unit/Middleware/RequestHandlerServiceProviderTest.php +++ b/tests/Unit/Middleware/RequestHandlerServiceProviderTest.php @@ -12,7 +12,7 @@ class RequestHandlerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Middleware\RequestHandlerServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var RequestHandler|MockObject $requestHandler */ $requestHandler = $this->createMock(RequestHandler::class); diff --git a/tests/Unit/Middleware/RequestHandlerTest.php b/tests/Unit/Middleware/RequestHandlerTest.php index a3c529ac..309ef963 100644 --- a/tests/Unit/Middleware/RequestHandlerTest.php +++ b/tests/Unit/Middleware/RequestHandlerTest.php @@ -8,7 +8,6 @@ use Engelsystem\Http\Exceptions\HttpForbidden; use Engelsystem\Middleware\CallableHandler; use Engelsystem\Middleware\RequestHandler; use Engelsystem\Test\Unit\Middleware\Stub\ControllerImplementation; -use InvalidArgumentException; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; @@ -16,13 +15,14 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; use ReflectionClass as Reflection; +use TypeError; class RequestHandlerTest extends TestCase { /** * @covers \Engelsystem\Middleware\RequestHandler::__construct */ - public function testInit() + public function testInit(): void { /** @var Application|MockObject $container */ $container = $this->createMock(Application::class); @@ -39,7 +39,7 @@ class RequestHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\RequestHandler::process */ - public function testProcess() + public function testProcess(): void { /** @var Application|MockObject $container */ /** @var ServerRequestInterface|MockObject $request */ @@ -84,14 +84,14 @@ class RequestHandlerTest extends TestCase $middleware->process($request, $handler); $this->assertEquals($return, $response); - $this->expectException(InvalidArgumentException::class); + $this->expectException(TypeError::class); $middleware->process($request, $handler); } /** * @covers \Engelsystem\Middleware\RequestHandler::resolveRequestHandler */ - public function testResolveRequestHandler() + public function testResolveRequestHandler(): void { /** @var Application|MockObject $container */ /** @var ServerRequestInterface|MockObject $request */ @@ -139,7 +139,7 @@ class RequestHandlerTest extends TestCase * @covers \Engelsystem\Middleware\RequestHandler::checkPermissions * @covers \Engelsystem\Middleware\RequestHandler::process */ - public function testCheckPermissions() + public function testCheckPermissions(): void { /** @var Application|MockObject $container */ /** @var ServerRequestInterface|MockObject $request */ diff --git a/tests/Unit/Middleware/ResolvesMiddlewareTraitTest.php b/tests/Unit/Middleware/ResolvesMiddlewareTraitTest.php index 7cd4d9d3..69803985 100644 --- a/tests/Unit/Middleware/ResolvesMiddlewareTraitTest.php +++ b/tests/Unit/Middleware/ResolvesMiddlewareTraitTest.php @@ -17,7 +17,7 @@ class ResolvesMiddlewareTraitTest extends TestCase * @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::isMiddleware * @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware */ - public function testResolveMiddleware() + public function testResolveMiddleware(): void { /** @var Application|MockObject $container */ $container = $this->createMock(Application::class); @@ -52,7 +52,7 @@ class ResolvesMiddlewareTraitTest extends TestCase /** * @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware */ - public function testResolveMiddlewareNoContainer() + public function testResolveMiddlewareNoContainer(): void { $middlewareInterface = $this->getMockForAbstractClass(MiddlewareInterface::class); diff --git a/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php b/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php index cf583a8d..35cd7a96 100644 --- a/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php +++ b/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php @@ -17,7 +17,7 @@ class RouteDispatcherServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Middleware\RouteDispatcherServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var ContextualBindingBuilder|MockObject $bindingBuilder */ $bindingBuilder = $this->createMock(ContextualBindingBuilder::class); diff --git a/tests/Unit/Middleware/RouteDispatcherTest.php b/tests/Unit/Middleware/RouteDispatcherTest.php index d3b79498..c5035d1b 100644 --- a/tests/Unit/Middleware/RouteDispatcherTest.php +++ b/tests/Unit/Middleware/RouteDispatcherTest.php @@ -18,7 +18,7 @@ class RouteDispatcherTest extends TestCase * @covers \Engelsystem\Middleware\RouteDispatcher::__construct * @covers \Engelsystem\Middleware\RouteDispatcher::process */ - public function testProcess() + public function testProcess(): void { /** @var FastRouteDispatcher|MockObject $dispatcher */ /** @var ResponseInterface|MockObject $response */ @@ -54,7 +54,7 @@ class RouteDispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\RouteDispatcher::process */ - public function testProcessNotFound() + public function testProcessNotFound(): void { /** @var FastRouteDispatcher|MockObject $dispatcher */ /** @var ResponseInterface|MockObject $response */ @@ -91,7 +91,7 @@ class RouteDispatcherTest extends TestCase /** * @covers \Engelsystem\Middleware\RouteDispatcher::process */ - public function testProcessNotAllowed() + public function testProcessNotAllowed(): void { /** @var FastRouteDispatcher|MockObject $dispatcher */ /** @var ResponseInterface|MockObject $response */ diff --git a/tests/Unit/Middleware/SendResponseHandlerTest.php b/tests/Unit/Middleware/SendResponseHandlerTest.php index 9189bd6d..1ffeafca 100644 --- a/tests/Unit/Middleware/SendResponseHandlerTest.php +++ b/tests/Unit/Middleware/SendResponseHandlerTest.php @@ -14,7 +14,7 @@ class SendResponseHandlerTest extends TestCase /** * @covers \Engelsystem\Middleware\SendResponseHandler::process */ - public function testRegister() + public function testRegister(): void { /** @var SendResponseHandler|MockObject $middleware */ $middleware = $this->getMockBuilder(SendResponseHandler::class) diff --git a/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php index eb780974..d0a359f3 100644 --- a/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php +++ b/tests/Unit/Middleware/SessionHandlerServiceProviderTest.php @@ -13,7 +13,7 @@ class SessionHandlerServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Middleware\SessionHandlerServiceProvider::register() */ - public function testRegister() + public function testRegister(): void { /** @var ContextualBindingBuilder|MockObject $bindingBuilder */ $bindingBuilder = $this->createMock(ContextualBindingBuilder::class); @@ -31,7 +31,7 @@ class SessionHandlerServiceProviderTest extends ServiceProviderTest $bindingBuilder->expects($this->once()) ->method('give') - ->willReturnCallback(function (callable $callable) { + ->willReturnCallback(function (callable $callable): void { $paths = $callable(); $this->assertIsArray($paths); diff --git a/tests/Unit/Middleware/SessionHandlerTest.php b/tests/Unit/Middleware/SessionHandlerTest.php index 7d3dd13f..45a22c44 100644 --- a/tests/Unit/Middleware/SessionHandlerTest.php +++ b/tests/Unit/Middleware/SessionHandlerTest.php @@ -16,7 +16,7 @@ class SessionHandlerTest extends TestCase * @covers \Engelsystem\Middleware\SessionHandler::__construct * @covers \Engelsystem\Middleware\SessionHandler::process */ - public function testProcess() + public function testProcess(): void { /** @var NativeSessionStorage|MockObject $sessionStorage */ $sessionStorage = $this->createMock(NativeSessionStorage::class); diff --git a/tests/Unit/Middleware/SetLocaleTest.php b/tests/Unit/Middleware/SetLocaleTest.php index 29041472..ebb41d9c 100644 --- a/tests/Unit/Middleware/SetLocaleTest.php +++ b/tests/Unit/Middleware/SetLocaleTest.php @@ -23,7 +23,7 @@ class SetLocaleTest extends TestCase * @covers \Engelsystem\Middleware\SetLocale::__construct * @covers \Engelsystem\Middleware\SetLocale::process */ - public function testRegister() + public function testRegister(): void { $this->initDatabase(); diff --git a/tests/Unit/Middleware/Stub/ControllerImplementation.php b/tests/Unit/Middleware/Stub/ControllerImplementation.php index 939dde5b..0add7fb0 100644 --- a/tests/Unit/Middleware/Stub/ControllerImplementation.php +++ b/tests/Unit/Middleware/Stub/ControllerImplementation.php @@ -9,15 +9,12 @@ class ControllerImplementation extends BaseController /** * @param array $permissions */ - public function setPermissions(array $permissions) + public function setPermissions(array $permissions): void { $this->permissions = $permissions; } - /** - * @return string - */ - public function actionStub() + public function actionStub(): string { return ''; } diff --git a/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php b/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php index f8b9ad96..0922a35a 100644 --- a/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php +++ b/tests/Unit/Middleware/Stub/ExceptionMiddlewareHandler.php @@ -12,7 +12,6 @@ class ExceptionMiddlewareHandler implements RequestHandlerInterface /** * Throws an exception * - * @return ResponseInterface * @throws Exception */ public function handle(ServerRequestInterface $request): ResponseInterface diff --git a/tests/Unit/Middleware/Stub/HasStaticMethod.php b/tests/Unit/Middleware/Stub/HasStaticMethod.php index 329e1248..b1f8fef3 100644 --- a/tests/Unit/Middleware/Stub/HasStaticMethod.php +++ b/tests/Unit/Middleware/Stub/HasStaticMethod.php @@ -4,7 +4,7 @@ namespace Engelsystem\Test\Unit\Middleware\Stub; class HasStaticMethod { - public static function foo() + public static function foo(): void { } } diff --git a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php index 542c7757..db4a011b 100644 --- a/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php +++ b/tests/Unit/Middleware/Stub/ResolvesMiddlewareTraitImplementation.php @@ -4,7 +4,6 @@ namespace Engelsystem\Test\Unit\Middleware\Stub; use Engelsystem\Application; use Engelsystem\Middleware\ResolvesMiddlewareTrait; -use InvalidArgumentException; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; @@ -20,12 +19,9 @@ class ResolvesMiddlewareTraitImplementation $this->container = $container; } - /** - * @return MiddlewareInterface|RequestHandlerInterface - * @throws InvalidArgumentException - */ - public function callResolveMiddleware(string|callable|MiddlewareInterface|RequestHandlerInterface $middleware) - { + public function callResolveMiddleware( + string|callable|MiddlewareInterface|RequestHandlerInterface $middleware + ): MiddlewareInterface|RequestHandlerInterface { return $this->resolveMiddleware($middleware); } } diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php index e7fe1a88..558f293f 100644 --- a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php +++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php @@ -23,7 +23,6 @@ class ReturnResponseMiddleware implements MiddlewareInterface * * Could be used to group middleware * - * @return ResponseInterface */ public function process( ServerRequestInterface $request, diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php index cf565329..ab357ce4 100644 --- a/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php +++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddlewareHandler.php @@ -20,7 +20,6 @@ class ReturnResponseMiddlewareHandler implements RequestHandlerInterface /** * Returns a given response * - * @return ResponseInterface * @throws Exception */ public function handle(ServerRequestInterface $request): ResponseInterface @@ -32,7 +31,7 @@ class ReturnResponseMiddlewareHandler implements RequestHandlerInterface * Set the response * */ - public function setResponse(ResponseInterface $response) + public function setResponse(ResponseInterface $response): void { $this->response = $response; } diff --git a/tests/Unit/Middleware/VerifyCsrfTokenTest.php b/tests/Unit/Middleware/VerifyCsrfTokenTest.php index ce045720..bd9b4273 100644 --- a/tests/Unit/Middleware/VerifyCsrfTokenTest.php +++ b/tests/Unit/Middleware/VerifyCsrfTokenTest.php @@ -17,7 +17,7 @@ class VerifyCsrfTokenTest extends TestCase * @covers \Engelsystem\Middleware\VerifyCsrfToken::isReading * @covers \Engelsystem\Middleware\VerifyCsrfToken::process */ - public function testProcess() + public function testProcess(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockForAbstractClass(ServerRequestInterface::class); @@ -60,7 +60,7 @@ class VerifyCsrfTokenTest extends TestCase * @covers \Engelsystem\Middleware\VerifyCsrfToken::__construct * @covers \Engelsystem\Middleware\VerifyCsrfToken::tokensMatch */ - public function testTokensMatch() + public function testTokensMatch(): void { /** @var ServerRequestInterface|MockObject $request */ $request = $this->getMockForAbstractClass(ServerRequestInterface::class); diff --git a/tests/Unit/Models/EventConfigTest.php b/tests/Unit/Models/EventConfigTest.php index 8dfd9e6c..94fbf10e 100644 --- a/tests/Unit/Models/EventConfigTest.php +++ b/tests/Unit/Models/EventConfigTest.php @@ -10,7 +10,7 @@ class EventConfigTest extends ModelTest /** * @covers \Engelsystem\Models\EventConfig::setValueAttribute */ - public function testSetValueAttribute() + public function testSetValueAttribute(): void { (new EventConfig()) ->setAttribute('name', 'foo') @@ -50,7 +50,7 @@ class EventConfigTest extends ModelTest /** * @covers \Engelsystem\Models\EventConfig::getValueAttribute */ - public function testGetValueAttribute() + public function testGetValueAttribute(): void { $model = new EventConfig(['name', 'buildup_start', 'value' => '']); $this->assertEquals('', $model->value); @@ -87,7 +87,7 @@ class EventConfigTest extends ModelTest /** * @covers \Engelsystem\Models\EventConfig::getValueCast */ - public function testGetValueCast() + public function testGetValueCast(): void { $model = new EventConfig(['name' => 'foo', 'value' => 'bar']); $this->assertEquals('bar', $model->value); @@ -98,16 +98,12 @@ class EventConfigTest extends ModelTest /** * Init a new EventConfig class * - * @return EventConfig */ - protected function getEventConfig() + protected function getEventConfig(): EventConfig { return new class extends EventConfig { - /** - * @return EventConfig - */ - public function setValueCast(string $value, string $type) + public function setValueCast(string $value, string $type): EventConfig { $this->valueCasts[$value] = $type; diff --git a/tests/Unit/Models/LogEntryTest.php b/tests/Unit/Models/LogEntryTest.php index 35db9435..9edca0fb 100644 --- a/tests/Unit/Models/LogEntryTest.php +++ b/tests/Unit/Models/LogEntryTest.php @@ -10,7 +10,7 @@ class LogEntryTest extends ModelTest /** * @covers \Engelsystem\Models\LogEntry::filter */ - public function testFilter() + public function testFilter(): void { foreach ( [ diff --git a/tests/Unit/Models/MessageTest.php b/tests/Unit/Models/MessageTest.php index 33db6a50..b0d8de74 100644 --- a/tests/Unit/Models/MessageTest.php +++ b/tests/Unit/Models/MessageTest.php @@ -27,9 +27,6 @@ class MessageTest extends ModelTest /** @var Message */ private $message3; - /** - * @return void - */ protected function setUp(): void { parent::setUp(); @@ -62,7 +59,6 @@ class MessageTest extends ModelTest * * @covers \Engelsystem\Models\Message::__construct * - * @return void */ public function testLoad(): void { @@ -85,7 +81,6 @@ class MessageTest extends ModelTest * @covers \Engelsystem\Models\Message::user * @covers \Engelsystem\Models\Message::sender * - * @return void */ public function testSenders(): void { @@ -103,7 +98,6 @@ class MessageTest extends ModelTest * * @covers \Engelsystem\Models\Message::receiver * - * @return void */ public function testReceivers(): void { @@ -117,7 +111,6 @@ class MessageTest extends ModelTest * * @covers \Engelsystem\Models\User\User::messagesSent * - * @return void */ public function testUserSentMessages(): void { @@ -136,7 +129,6 @@ class MessageTest extends ModelTest * * @covers \Engelsystem\Models\User\User::messagesReceived * - * @return void */ public function testUserReceivedMessages(): void { diff --git a/tests/Unit/Models/NewsTest.php b/tests/Unit/Models/NewsTest.php index 1278884d..81980db1 100644 --- a/tests/Unit/Models/NewsTest.php +++ b/tests/Unit/Models/NewsTest.php @@ -18,9 +18,6 @@ class NewsTest extends ModelTest /** @var User */ private $user; - /** - * @return void - */ protected function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Models/QuestionTest.php b/tests/Unit/Models/QuestionTest.php index 786914c5..595d6129 100644 --- a/tests/Unit/Models/QuestionTest.php +++ b/tests/Unit/Models/QuestionTest.php @@ -21,9 +21,6 @@ class QuestionTest extends ModelTest */ private $user2; - /** - * @return void - */ protected function setUp(): void { parent::setUp(); @@ -86,9 +83,6 @@ class QuestionTest extends ModelTest $this->assertInstanceOf(Carbon::class, Question::find($question1->id)->answered_at); } - /** - * @return Question - */ private function createQuestion(User $user, ?User $answerer = null): Question { $data = [ diff --git a/tests/Unit/Models/Shifts/ScheduleShiftTest.php b/tests/Unit/Models/Shifts/ScheduleShiftTest.php index 4c861ad9..f56ed3c8 100644 --- a/tests/Unit/Models/Shifts/ScheduleShiftTest.php +++ b/tests/Unit/Models/Shifts/ScheduleShiftTest.php @@ -12,7 +12,7 @@ class ScheduleShiftTest extends ModelTest /** * @covers \Engelsystem\Models\Shifts\ScheduleShift::schedule */ - public function testScheduleShifts() + public function testScheduleShifts(): void { $schedule = new Schedule([ 'url' => 'https://lorem.ipsum/schedule.xml', diff --git a/tests/Unit/Models/Stub/BaseModelImplementation.php b/tests/Unit/Models/Stub/BaseModelImplementation.php index 70643b03..e7e73b39 100644 --- a/tests/Unit/Models/Stub/BaseModelImplementation.php +++ b/tests/Unit/Models/Stub/BaseModelImplementation.php @@ -21,18 +21,14 @@ class BaseModelImplementation extends BaseModel /** * @param array $options - * @return bool */ - public function save(array $options = []) + public function save(array $options = []): bool { $this->saveCount++; return true; } - /** - * @return QueryBuilder - */ - public static function query() + public static function query(): QueryBuilder { return self::$queryBuilder; } diff --git a/tests/Unit/Models/User/LicenseTest.php b/tests/Unit/Models/User/LicenseTest.php index 0215f001..2ed9e9ab 100644 --- a/tests/Unit/Models/User/LicenseTest.php +++ b/tests/Unit/Models/User/LicenseTest.php @@ -10,7 +10,7 @@ class LicenseTest extends ModelTest /** * @covers \Engelsystem\Models\User\License::wantsToDrive */ - public function testWantsToDrive() + public function testWantsToDrive(): void { $license = new License(); $this->assertFalse($license->wantsToDrive()); diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php index 5cbec77a..d241b948 100644 --- a/tests/Unit/Models/User/UserTest.php +++ b/tests/Unit/Models/User/UserTest.php @@ -41,7 +41,7 @@ class UserTest extends ModelTest /** * @return array */ - public function hasOneRelationsProvider() + public function hasOneRelationsProvider(): array { return [ [ @@ -144,7 +144,7 @@ class UserTest extends ModelTest * @param array $data * @throws Exception */ - public function testHasOneRelations(string $class, string $name, array $data) + public function testHasOneRelations(string $class, string $name, array $data): void { $user = new User($this->data); $user->save(); @@ -214,9 +214,8 @@ class UserTest extends ModelTest /** * @covers \Engelsystem\Models\User\User::userAngelTypes - * @return void */ - public function testUserAngelTypes() + public function testUserAngelTypes(): void { AngelType::factory(2)->create(); $angelType1 = AngelType::factory()->create(); @@ -239,9 +238,8 @@ class UserTest extends ModelTest /** * @covers \Engelsystem\Models\User\User::isAngelTypeSupporter - * @return void */ - public function testIsAngelTypeSupporter() + public function testIsAngelTypeSupporter(): void { /** @var AngelType $angelType1 */ $angelType1 = AngelType::factory()->create(); @@ -262,7 +260,7 @@ class UserTest extends ModelTest * @covers \Engelsystem\Models\User\User::privileges * @covers \Engelsystem\Models\User\User::getPrivilegesAttribute */ - public function testPrivileges() + public function testPrivileges(): void { $user = new User($this->data); $user->save(); diff --git a/tests/Unit/Models/User/UsesUserModelTest.php b/tests/Unit/Models/User/UsesUserModelTest.php index 028c8b30..087f98ad 100644 --- a/tests/Unit/Models/User/UsesUserModelTest.php +++ b/tests/Unit/Models/User/UsesUserModelTest.php @@ -12,7 +12,7 @@ class UsesUserModelTest extends ModelTest /** * @covers \Engelsystem\Models\User\UsesUserModel::user */ - public function testHasOneRelations() + public function testHasOneRelations(): void { /** @var UsesUserModel $contact */ $model = new class extends BaseModel diff --git a/tests/Unit/Renderer/EngineTest.php b/tests/Unit/Renderer/EngineTest.php index 659d85c5..bc828f66 100644 --- a/tests/Unit/Renderer/EngineTest.php +++ b/tests/Unit/Renderer/EngineTest.php @@ -10,7 +10,7 @@ class EngineTest extends TestCase /** * @covers \Engelsystem\Renderer\Engine::share */ - public function testShare() + public function testShare(): void { $engine = new EngineImplementation(); $engine->share(['foo' => ['bar' => 'baz', 'lorem' => 'ipsum']]); diff --git a/tests/Unit/Renderer/HtmlEngineTest.php b/tests/Unit/Renderer/HtmlEngineTest.php index d6f5088b..deda3085 100644 --- a/tests/Unit/Renderer/HtmlEngineTest.php +++ b/tests/Unit/Renderer/HtmlEngineTest.php @@ -13,7 +13,7 @@ class HtmlEngineTest extends TestCase /** * @covers \Engelsystem\Renderer\HtmlEngine::get */ - public function testGet() + public function testGet(): void { $engine = new HtmlEngine(); $engine->share('shared_data', 'tester'); @@ -27,7 +27,7 @@ class HtmlEngineTest extends TestCase /** * @covers \Engelsystem\Renderer\HtmlEngine::canRender */ - public function testCanRender() + public function testCanRender(): void { $engine = new HtmlEngine(); @@ -40,10 +40,7 @@ class HtmlEngineTest extends TestCase $this->assertTrue($engine->canRender($htmFile)); } - /** - * @return string - */ - protected function createTempFile(string $content = '', string $extension = '.html') + protected function createTempFile(string $content = '', string $extension = '.html'): string { $tmpFileName = tempnam(sys_get_temp_dir(), 'EngelsystemUnitTest'); diff --git a/tests/Unit/Renderer/RendererServiceProviderTest.php b/tests/Unit/Renderer/RendererServiceProviderTest.php index e655284d..64e68057 100644 --- a/tests/Unit/Renderer/RendererServiceProviderTest.php +++ b/tests/Unit/Renderer/RendererServiceProviderTest.php @@ -16,7 +16,7 @@ class RendererServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Renderer\RendererServiceProvider::registerHtmlEngine() * @covers \Engelsystem\Renderer\RendererServiceProvider::registerRenderer() */ - public function testRegister() + public function testRegister(): void { /** @var Renderer|MockObject $renderer */ $renderer = $this->getMockBuilder(Renderer::class) @@ -55,7 +55,7 @@ class RendererServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Renderer\RendererServiceProvider::boot() */ - public function testBoot() + public function testBoot(): void { /** @var Renderer|MockObject $renderer */ $renderer = $this->getMockBuilder(Renderer::class) diff --git a/tests/Unit/Renderer/RendererTest.php b/tests/Unit/Renderer/RendererTest.php index d7f59648..0700ea4f 100644 --- a/tests/Unit/Renderer/RendererTest.php +++ b/tests/Unit/Renderer/RendererTest.php @@ -14,7 +14,7 @@ class RendererTest extends TestCase * @covers \Engelsystem\Renderer\Renderer::render * @covers \Engelsystem\Renderer\Renderer::addRenderer */ - public function testGet() + public function testGet(): void { $renderer = new Renderer(); @@ -48,7 +48,7 @@ class RendererTest extends TestCase /** * @covers \Engelsystem\Renderer\Renderer::render */ - public function testError() + public function testError(): void { $renderer = new Renderer(); diff --git a/tests/Unit/Renderer/Twig/Extensions/AssetsTest.php b/tests/Unit/Renderer/Twig/Extensions/AssetsTest.php index 15255444..66e61fd9 100644 --- a/tests/Unit/Renderer/Twig/Extensions/AssetsTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/AssetsTest.php @@ -13,7 +13,7 @@ class AssetsTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Assets::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Assets::getFunctions */ - public function testGetFunctions() + public function testGetFunctions(): void { /** @var UrlGenerator&MockObject $urlGenerator */ $urlGenerator = $this->createMock(UrlGenerator::class); @@ -29,7 +29,7 @@ class AssetsTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Assets::getAsset */ - public function testGetAsset() + public function testGetAsset(): void { /** @var UrlGenerator&MockObject $urlGenerator */ $urlGenerator = $this->createMock(UrlGenerator::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/AuthenticationTest.php b/tests/Unit/Renderer/Twig/Extensions/AuthenticationTest.php index e444fcca..94eb1478 100644 --- a/tests/Unit/Renderer/Twig/Extensions/AuthenticationTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/AuthenticationTest.php @@ -13,7 +13,7 @@ class AuthenticationTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Authentication::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Authentication::getFunctions */ - public function testGetFunctions() + public function testGetFunctions(): void { /** @var Authenticator|MockObject $auth */ $auth = $this->createMock(Authenticator::class); @@ -30,7 +30,7 @@ class AuthenticationTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Authentication::isAuthenticated * @covers \Engelsystem\Renderer\Twig\Extensions\Authentication::isGuest */ - public function testIsAuthenticated() + public function testIsAuthenticated(): void { /** @var Authenticator|MockObject $auth */ $auth = $this->createMock(Authenticator::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/ConfigTest.php b/tests/Unit/Renderer/Twig/Extensions/ConfigTest.php index 6a9cb78a..2b996b21 100644 --- a/tests/Unit/Renderer/Twig/Extensions/ConfigTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/ConfigTest.php @@ -12,7 +12,7 @@ class ConfigTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Config::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Config::getFunctions */ - public function testGetFunctions() + public function testGetFunctions(): void { /** @var EngelsystemConfig|MockObject $config */ $config = $this->createMock(EngelsystemConfig::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php b/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php index f81f210a..bc53585b 100644 --- a/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php @@ -11,7 +11,7 @@ class CsrfTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Csrf::getFunctions */ - public function testGetGlobals() + public function testGetGlobals(): void { /** @var SessionInterface|MockObject $session */ $session = $this->createMock(SessionInterface::class); @@ -26,7 +26,7 @@ class CsrfTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Csrf::getCsrfField */ - public function testGetCsrfField() + public function testGetCsrfField(): void { /** @var Csrf|MockObject $extension */ $extension = $this->getMockBuilder(Csrf::class) @@ -48,7 +48,7 @@ class CsrfTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Csrf::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Csrf::getCsrfToken */ - public function testGetCsrfToken() + public function testGetCsrfToken(): void { /** @var SessionInterface|MockObject $session */ $session = $this->createMock(SessionInterface::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/DevelopTest.php b/tests/Unit/Renderer/Twig/Extensions/DevelopTest.php index 51c92054..b977a02d 100644 --- a/tests/Unit/Renderer/Twig/Extensions/DevelopTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/DevelopTest.php @@ -13,7 +13,7 @@ class DevelopTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Develop::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Develop::getFunctions */ - public function testGetGlobals() + public function testGetGlobals(): void { $config = new Config(); $extension = new Develop($config); @@ -31,11 +31,11 @@ class DevelopTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Develop::dump * @covers \Engelsystem\Renderer\Twig\Extensions\Develop::setDumper */ - public function testDump() + public function testDump(): void { $config = new Config(); $varDumper = new VarDumper(); - $varDumper->setHandler(function ($var) { + $varDumper->setHandler(function ($var): void { echo $var; }); @@ -49,7 +49,7 @@ class DevelopTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Develop::dd */ - public function testDD() + public function testDD(): void { /** @var Develop|MockObject $extension */ $extension = $this->getMockBuilder(Develop::class) diff --git a/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php index aa9dce26..cb4d7c07 100644 --- a/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/ExtensionTest.php @@ -18,7 +18,7 @@ abstract class ExtensionTest extends TestCase * * @param TwigFunction[] $functions */ - protected function assertFilterExists(string $name, callable $callback, array $functions) + protected function assertFilterExists(string $name, callable $callback, array $functions): void { foreach ($functions as $function) { if ($function->getName() != $name) { @@ -39,8 +39,12 @@ abstract class ExtensionTest extends TestCase * @param array $options * @throws Exception */ - protected function assertExtensionExists(string $name, callable $callback, array $functions, array $options = []) - { + protected function assertExtensionExists( + string $name, + callable $callback, + array $functions, + array $options = [] + ): void { foreach ($functions as $function) { if ($function->getName() != $name) { continue; @@ -67,7 +71,7 @@ abstract class ExtensionTest extends TestCase * @param mixed[] $globals * @throws Exception */ - protected function assertGlobalsExists(string $name, mixed $value, array $globals) + protected function assertGlobalsExists(string $name, mixed $value, array $globals): void { if (array_key_exists($name, $globals)) { $this->assertArraySubset([$name => $value], $globals); diff --git a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php index 8bb59f87..e5c238f6 100644 --- a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php @@ -19,7 +19,7 @@ class GlobalsTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Globals::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Globals::getGlobals */ - public function testGetGlobals() + public function testGetGlobals(): void { $this->initDatabase(); diff --git a/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php b/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php index df1e7ce0..cbd26e7f 100644 --- a/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/LegacyTest.php @@ -11,7 +11,7 @@ class LegacyTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::getFunctions */ - public function testGetFunctions() + public function testGetFunctions(): void { $isSafeHtml = ['is_safe' => ['html']]; /** @var Request|MockObject $request */ @@ -32,7 +32,7 @@ class LegacyTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::getPage */ - public function testIsAuthenticated() + public function testIsAuthenticated(): void { /** @var Request|MockObject $request */ $request = $this->createMock(Request::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/MarkdownTest.php b/tests/Unit/Renderer/Twig/Extensions/MarkdownTest.php index f59ffa03..2e07a8bc 100644 --- a/tests/Unit/Renderer/Twig/Extensions/MarkdownTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/MarkdownTest.php @@ -10,7 +10,7 @@ class MarkdownTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Markdown::getFilters */ - public function testGeFilters() + public function testGeFilters(): void { $extension = new Markdown(new Parsedown()); $filters = $extension->getFilters(); @@ -23,7 +23,7 @@ class MarkdownTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Markdown::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Markdown::render */ - public function testRender() + public function testRender(): void { $extension = new Markdown(new Parsedown()); @@ -36,7 +36,7 @@ class MarkdownTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Markdown::render */ - public function testRenderHtml() + public function testRenderHtml(): void { $renderer = new Parsedown(); $extension = new Markdown($renderer); diff --git a/tests/Unit/Renderer/Twig/Extensions/SessionTest.php b/tests/Unit/Renderer/Twig/Extensions/SessionTest.php index 526017ed..b43e885e 100644 --- a/tests/Unit/Renderer/Twig/Extensions/SessionTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/SessionTest.php @@ -12,7 +12,7 @@ class SessionTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Session::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Session::getFunctions */ - public function testGetGlobals() + public function testGetGlobals(): void { /** @var SymfonySession|MockObject $session */ $session = $this->createMock(SymfonySession::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/TranslationTest.php b/tests/Unit/Renderer/Twig/Extensions/TranslationTest.php index 3b4b05c6..db8ddd6d 100644 --- a/tests/Unit/Renderer/Twig/Extensions/TranslationTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/TranslationTest.php @@ -12,7 +12,7 @@ class TranslationTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Translation::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Translation::getFilters */ - public function testGeFilters() + public function testGeFilters(): void { /** @var Translator|MockObject $translator */ $translator = $this->createMock(Translator::class); @@ -26,7 +26,7 @@ class TranslationTest extends ExtensionTest /** * @covers \Engelsystem\Renderer\Twig\Extensions\Translation::getFunctions */ - public function testGetFunctions() + public function testGetFunctions(): void { /** @var Translator|MockObject $translator */ $translator = $this->createMock(Translator::class); diff --git a/tests/Unit/Renderer/Twig/Extensions/UrlTest.php b/tests/Unit/Renderer/Twig/Extensions/UrlTest.php index f9c30ec7..c6d2cd1f 100644 --- a/tests/Unit/Renderer/Twig/Extensions/UrlTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/UrlTest.php @@ -12,7 +12,7 @@ class UrlTest extends ExtensionTest * @covers \Engelsystem\Renderer\Twig\Extensions\Url::__construct * @covers \Engelsystem\Renderer\Twig\Extensions\Url::getFunctions */ - public function testGetGlobals() + public function testGetGlobals(): void { /** @var UrlGenerator|MockObject $urlGenerator */ $urlGenerator = $this->createMock(UrlGenerator::class); @@ -26,7 +26,7 @@ class UrlTest extends ExtensionTest /** * @return string[][] */ - public function getUrls() + public function getUrls(): array { return [ ['/', '/', 'http://foo.bar/'], @@ -43,7 +43,7 @@ class UrlTest extends ExtensionTest * * @covers \Engelsystem\Renderer\Twig\Extensions\Url::getUrl */ - public function testGetUrl(string $url, string $urlTo, string $return, array $parameters = []) + public function testGetUrl(string $url, string $urlTo, string $return, array $parameters = []): void { /** @var UrlGenerator|MockObject $urlGenerator */ $urlGenerator = $this->createMock(UrlGenerator::class); diff --git a/tests/Unit/Renderer/TwigEngineTest.php b/tests/Unit/Renderer/TwigEngineTest.php index 8798d0ff..7bb6e9bc 100644 --- a/tests/Unit/Renderer/TwigEngineTest.php +++ b/tests/Unit/Renderer/TwigEngineTest.php @@ -14,7 +14,7 @@ class TwigEngineTest extends TestCase * @covers \Engelsystem\Renderer\TwigEngine::__construct * @covers \Engelsystem\Renderer\TwigEngine::get */ - public function testGet() + public function testGet(): void { /** @var Twig|MockObject $twig */ $twig = $this->createMock(Twig::class); @@ -36,7 +36,7 @@ class TwigEngineTest extends TestCase /** * @covers \Engelsystem\Renderer\TwigEngine::canRender */ - public function testCanRender() + public function testCanRender(): void { /** @var Twig|MockObject $twig */ $twig = $this->createMock(Twig::class); diff --git a/tests/Unit/Renderer/TwigLoaderTest.php b/tests/Unit/Renderer/TwigLoaderTest.php index e6867643..061a3891 100644 --- a/tests/Unit/Renderer/TwigLoaderTest.php +++ b/tests/Unit/Renderer/TwigLoaderTest.php @@ -11,7 +11,7 @@ class TwigLoaderTest extends TestCase /** * @covers \Engelsystem\Renderer\TwigLoader::findTemplate */ - public function testFindTemplate() + public function testFindTemplate(): void { $loader = new TwigLoader(); diff --git a/tests/Unit/Renderer/TwigServiceProviderTest.php b/tests/Unit/Renderer/TwigServiceProviderTest.php index 3fed41c5..d38a9542 100644 --- a/tests/Unit/Renderer/TwigServiceProviderTest.php +++ b/tests/Unit/Renderer/TwigServiceProviderTest.php @@ -25,7 +25,7 @@ class TwigServiceProviderTest extends ServiceProviderTest * @covers \Engelsystem\Renderer\TwigServiceProvider::register * @covers \Engelsystem\Renderer\TwigServiceProvider::registerTwigExtensions */ - public function testRegister() + public function testRegister(): void { $app = $this->getApp(['make', 'instance', 'tag']); $class = $this->createMock(stdClass::class); @@ -64,7 +64,7 @@ class TwigServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Renderer\TwigServiceProvider::boot */ - public function testBoot() + public function testBoot(): void { /** @var Twig|MockObject $twig */ $twig = $this->createMock(Twig::class); @@ -107,7 +107,7 @@ class TwigServiceProviderTest extends ServiceProviderTest /** * @covers \Engelsystem\Renderer\TwigServiceProvider::registerTwigEngine */ - public function testRegisterTwigEngine() + public function testRegisterTwigEngine(): void { /** @var TwigEngine|MockObject $htmlEngine */ $twigEngine = $this->createMock(TwigEngine::class); @@ -186,7 +186,7 @@ class TwigServiceProviderTest extends ServiceProviderTest * @param array $extensions * @throws ReflectionException */ - protected function setExtensionsTo(TwigServiceProvider $serviceProvider, array $extensions) + protected function setExtensionsTo(TwigServiceProvider $serviceProvider, array $extensions): void { $reflection = new Reflection(get_class($serviceProvider)); diff --git a/tests/Unit/ServiceProviderTest.php b/tests/Unit/ServiceProviderTest.php index d840c0c1..30b5d4f9 100644 --- a/tests/Unit/ServiceProviderTest.php +++ b/tests/Unit/ServiceProviderTest.php @@ -9,9 +9,8 @@ abstract class ServiceProviderTest extends TestCase { /** * @param array $methods - * @return Application|MockObject */ - protected function getApp(array $methods = ['make', 'instance']) + protected function getApp(array $methods = ['make', 'instance']): Application|MockObject { return $this->getMockBuilder(Application::class) ->onlyMethods($methods) diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index d24bcf1e..16529627 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -25,7 +25,7 @@ abstract class TestCase extends PHPUnitTestCase array $arguments = null, mixed $return = null, InvocationOrder|int $times = null - ) { + ): void { if (is_null($times)) { $times = $this->once(); }