Set native return types

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann 2022-12-14 19:15:20 +01:00
parent 2b88322c0c
commit aff8826c99
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
386 changed files with 1038 additions and 2008 deletions

View File

@ -27,5 +27,9 @@
<exclude-pattern>/includes</exclude-pattern> <exclude-pattern>/includes</exclude-pattern>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" /> <exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule> </rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude-pattern>/includes</exclude-pattern>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" /> <rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
</ruleset> </ruleset>

View File

@ -17,7 +17,7 @@ $route->get('/logout', 'AuthController@logout');
// OAuth // OAuth
$route->addGroup( $route->addGroup(
'/oauth/{provider}', '/oauth/{provider}',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'OAuthController@index'); $route->get('', 'OAuthController@index');
$route->post('/connect', 'OAuthController@connect'); $route->post('/connect', 'OAuthController@connect');
$route->post('/disconnect', 'OAuthController@disconnect'); $route->post('/disconnect', 'OAuthController@disconnect');
@ -27,7 +27,7 @@ $route->addGroup(
// User settings // User settings
$route->addGroup( $route->addGroup(
'/settings', '/settings',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('/profile', 'SettingsController@profile'); $route->get('/profile', 'SettingsController@profile');
$route->post('/profile', 'SettingsController@saveProfile'); $route->post('/profile', 'SettingsController@saveProfile');
$route->get('/password', 'SettingsController@password'); $route->get('/password', 'SettingsController@password');
@ -43,7 +43,7 @@ $route->addGroup(
// Password recovery // Password recovery
$route->addGroup( $route->addGroup(
'/password/reset', '/password/reset',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'PasswordResetController@reset'); $route->get('', 'PasswordResetController@reset');
$route->post('', 'PasswordResetController@postReset'); $route->post('', 'PasswordResetController@postReset');
$route->get('/{token:.+}', 'PasswordResetController@resetPassword'); $route->get('/{token:.+}', 'PasswordResetController@resetPassword');
@ -59,7 +59,7 @@ $route->get('/stats', 'Metrics\\Controller@stats');
$route->get('/meetings', 'NewsController@meetings'); $route->get('/meetings', 'NewsController@meetings');
$route->addGroup( $route->addGroup(
'/news', '/news',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'NewsController@index'); $route->get('', 'NewsController@index');
$route->get('/{news_id:\d+}', 'NewsController@show'); $route->get('/{news_id:\d+}', 'NewsController@show');
$route->post('/{news_id:\d+}', 'NewsController@comment'); $route->post('/{news_id:\d+}', 'NewsController@comment');
@ -73,7 +73,7 @@ $route->get('/faq', 'FaqController@index');
// Questions // Questions
$route->addGroup( $route->addGroup(
'/questions', '/questions',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'QuestionsController@index'); $route->get('', 'QuestionsController@index');
$route->post('', 'QuestionsController@delete'); $route->post('', 'QuestionsController@delete');
$route->get('/new', 'QuestionsController@add'); $route->get('/new', 'QuestionsController@add');
@ -84,7 +84,7 @@ $route->addGroup(
// Messages // Messages
$route->addGroup( $route->addGroup(
'/messages', '/messages',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'MessagesController@index'); $route->get('', 'MessagesController@index');
$route->post('', 'MessagesController@redirectToConversation'); $route->post('', 'MessagesController@redirectToConversation');
$route->get('/{user_id:\d+}', 'MessagesController@messagesOfConversation'); $route->get('/{user_id:\d+}', 'MessagesController@messagesOfConversation');
@ -102,11 +102,11 @@ $route->get('/design', 'DesignController@index');
// Administration // Administration
$route->addGroup( $route->addGroup(
'/admin', '/admin',
function (RouteCollector $route) { function (RouteCollector $route): void {
// FAQ // FAQ
$route->addGroup( $route->addGroup(
'/faq', '/faq',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('[/{faq_id:\d+}]', 'Admin\\FaqController@edit'); $route->get('[/{faq_id:\d+}]', 'Admin\\FaqController@edit');
$route->post('[/{faq_id:\d+}]', 'Admin\\FaqController@save'); $route->post('[/{faq_id:\d+}]', 'Admin\\FaqController@save');
} }
@ -115,7 +115,7 @@ $route->addGroup(
// Log // Log
$route->addGroup( $route->addGroup(
'/logs', '/logs',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'Admin\\LogsController@index'); $route->get('', 'Admin\\LogsController@index');
$route->post('', 'Admin\\LogsController@index'); $route->post('', 'Admin\\LogsController@index');
} }
@ -124,7 +124,7 @@ $route->addGroup(
// Schedule // Schedule
$route->addGroup( $route->addGroup(
'/schedule', '/schedule',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'Admin\\Schedule\\ImportSchedule@index'); $route->get('', 'Admin\\Schedule\\ImportSchedule@index');
$route->get('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@edit'); $route->get('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@edit');
$route->post('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@save'); $route->post('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@save');
@ -136,7 +136,7 @@ $route->addGroup(
// Questions // Questions
$route->addGroup( $route->addGroup(
'/questions', '/questions',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'Admin\\QuestionsController@index'); $route->get('', 'Admin\\QuestionsController@index');
$route->post('', 'Admin\\QuestionsController@delete'); $route->post('', 'Admin\\QuestionsController@delete');
$route->get('/{question_id:\d+}', 'Admin\\QuestionsController@edit'); $route->get('/{question_id:\d+}', 'Admin\\QuestionsController@edit');
@ -147,11 +147,11 @@ $route->addGroup(
// User // User
$route->addGroup( $route->addGroup(
'/user/{user_id:\d+}', '/user/{user_id:\d+}',
function (RouteCollector $route) { function (RouteCollector $route): void {
// Shirts // Shirts
$route->addGroup( $route->addGroup(
'/shirt', '/shirt',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('', 'Admin\\UserShirtController@editShirt'); $route->get('', 'Admin\\UserShirtController@editShirt');
$route->post('', 'Admin\\UserShirtController@saveShirt'); $route->post('', 'Admin\\UserShirtController@saveShirt');
} }
@ -160,7 +160,7 @@ $route->addGroup(
// Worklogs // Worklogs
$route->addGroup( $route->addGroup(
'/worklog', '/worklog',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@editWorklog'); $route->get('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@editWorklog');
$route->post('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@saveWorklog'); $route->post('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@saveWorklog');
$route->get( $route->get(
@ -179,7 +179,7 @@ $route->addGroup(
// News // News
$route->addGroup( $route->addGroup(
'/news', '/news',
function (RouteCollector $route) { function (RouteCollector $route): void {
$route->get('[/{news_id:\d+}]', 'Admin\\NewsController@edit'); $route->get('[/{news_id:\d+}]', 'Admin\\NewsController@edit');
$route->post('[/{news_id:\d+}]', 'Admin\\NewsController@save'); $route->post('[/{news_id:\d+}]', 'Admin\\NewsController@save');
} }

View File

@ -13,7 +13,7 @@ class FaqFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'question' => $this->faker->text(100), 'question' => $this->faker->text(100),

View File

@ -13,7 +13,7 @@ class GroupFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'name' => $this->faker->unique()->word(), 'name' => $this->faker->unique()->word(),

View File

@ -14,7 +14,7 @@ class MessageFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'user_id' => User::factory(), 'user_id' => User::factory(),

View File

@ -15,7 +15,7 @@ class NewsCommentFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'news_id' => News::factory(), 'news_id' => News::factory(),

View File

@ -14,7 +14,7 @@ class NewsFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'title' => $this->faker->text(50), 'title' => $this->faker->text(50),

View File

@ -13,7 +13,7 @@ class PrivilegeFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'name' => $this->faker->unique()->word(), 'name' => $this->faker->unique()->word(),

View File

@ -15,7 +15,7 @@ class QuestionFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'user_id' => User::factory(), 'user_id' => User::factory(),

View File

@ -13,7 +13,7 @@ class RoomFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'name' => $this->faker->unique()->firstName(), 'name' => $this->faker->unique()->firstName(),

View File

@ -13,7 +13,7 @@ class ScheduleFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'name' => $this->faker->unique()->words(4, true), 'name' => $this->faker->unique()->words(4, true),

View File

@ -13,7 +13,7 @@ class ContactFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'dect' => $this->faker->optional()->numberBetween(1000, 9999), 'dect' => $this->faker->optional()->numberBetween(1000, 9999),

View File

@ -13,7 +13,7 @@ class LicenseFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
$drive_car = $this->faker->boolean(.8); $drive_car = $this->faker->boolean(.8);
$drive_3_5t = $drive_car && $this->faker->boolean(.7); $drive_3_5t = $drive_car && $this->faker->boolean(.7);

View File

@ -13,7 +13,7 @@ class PasswordResetFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'token' => bin2hex(random_bytes(16)), 'token' => bin2hex(random_bytes(16)),

View File

@ -14,7 +14,7 @@ class PersonalDataFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
$arrival = $this->faker->optional()->dateTimeThisMonth('2 weeks'); $arrival = $this->faker->optional()->dateTimeThisMonth('2 weeks');
$departure = $this->faker->optional()->dateTimeThisMonth('2 weeks'); $departure = $this->faker->optional()->dateTimeThisMonth('2 weeks');

View File

@ -13,7 +13,7 @@ class SettingsFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'language' => $this->faker->locale(), 'language' => $this->faker->locale(),

View File

@ -14,7 +14,7 @@ class StateFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
$arrival = $this->faker->optional()->dateTimeThisMonth(); $arrival = $this->faker->optional()->dateTimeThisMonth();
@ -31,9 +31,8 @@ class StateFactory extends Factory
/** /**
* Indicate that the user is arrived * Indicate that the user is arrived
* *
* @return self
*/ */
public function arrived() public function arrived(): self
{ {
return $this->state( return $this->state(
function (array $attributes) { function (array $attributes) {

View File

@ -13,7 +13,7 @@ class UserFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'name' => $this->faker->unique()->userName(), 'name' => $this->faker->unique()->userName(),

View File

@ -14,7 +14,7 @@ class WorklogFactory extends Factory
/** /**
* @return array * @return array
*/ */
public function definition() public function definition(): array
{ {
return [ return [
'user_id' => User::factory(), 'user_id' => User::factory(),

View File

@ -31,7 +31,7 @@ class ImportInstallSql extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
foreach ($this->oldTables as $table) { foreach ($this->oldTables as $table) {
if ($this->schema->hasTable($table)) { if ($this->schema->hasTable($table)) {
@ -47,7 +47,7 @@ class ImportInstallSql extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->getConnection()->statement('SET FOREIGN_KEY_CHECKS=0;'); $this->schema->getConnection()->statement('SET FOREIGN_KEY_CHECKS=0;');

View File

@ -9,7 +9,7 @@ class ImportUpdateSql extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if ($this->schema->hasTable('UserWorkLog')) { if ($this->schema->hasTable('UserWorkLog')) {
return; return;
@ -22,7 +22,7 @@ class ImportUpdateSql extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->dropIfExists('UserWorkLog'); $this->schema->dropIfExists('UserWorkLog');
} }

View File

@ -10,7 +10,7 @@ class FixOldTables extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -29,7 +29,7 @@ class FixOldTables extends Migration
->where($column, '<', '0001-01-01 00:00:00') ->where($column, '<', '0001-01-01 00:00:00')
->update([$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(); $table->dateTime($column)->default('0001-01-01 00:00:00')->change();
}); });
} }
@ -38,7 +38,7 @@ class FixOldTables extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
} }
} }

View File

@ -9,7 +9,7 @@ class CleanupGroupPrivileges extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;
@ -43,7 +43,7 @@ class CleanupGroupPrivileges extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;

View File

@ -15,7 +15,7 @@ class AddAngelSupporterPermissions extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;
@ -39,7 +39,7 @@ class AddAngelSupporterPermissions extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;
@ -52,10 +52,7 @@ class AddAngelSupporterPermissions extends Migration
); );
} }
/** protected function getQuery(string $type): string
* @return string
*/
protected function getQuery(string $type)
{ {
return sprintf(' return sprintf('
%s FROM GroupPrivileges %s FROM GroupPrivileges

View File

@ -10,9 +10,9 @@ class CreateLogEntriesTable extends Migration
/** /**
* Run the 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->increments('id');
$table->string('level', 20); $table->string('level', 20);
$table->text('message'); $table->text('message');
@ -32,9 +32,9 @@ class CreateLogEntriesTable extends Migration
/** /**
* Reverse the 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->increments('id');
$table->string('level', 20); $table->string('level', 20);
$table->text('message'); $table->text('message');

View File

@ -10,9 +10,9 @@ class CreateSessionsTable extends Migration
/** /**
* Run the 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->string('id')->unique();
$table->text('payload'); $table->text('payload');
$table->dateTime('last_activity')->useCurrent(); $table->dateTime('last_activity')->useCurrent();
@ -22,7 +22,7 @@ class CreateSessionsTable extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->dropIfExists('sessions'); $this->schema->dropIfExists('sessions');
} }

View File

@ -20,11 +20,11 @@ class CreateEventConfigTable extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
foreach (['json', 'text'] as $type) { foreach (['json', 'text'] as $type) {
try { 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->string('name')->index()->unique();
$table->{$type}('value'); $table->{$type}('value');
$table->timestamps(); $table->timestamps();
@ -69,11 +69,11 @@ class CreateEventConfigTable extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$connection = $this->schema->getConnection(); $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->string('event_name')->nullable();
$table->integer('buildup_start_date')->nullable(); $table->integer('buildup_start_date')->nullable();
$table->integer('event_start_date')->nullable(); $table->integer('event_start_date')->nullable();
@ -112,10 +112,7 @@ class CreateEventConfigTable extends Migration
$this->schema->dropIfExists('event_config'); $this->schema->dropIfExists('event_config');
} }
/** protected function getConfigValue(Collection $config, string $name): mixed
* @return mixed|null
*/
protected function getConfigValue(Collection $config, string $name)
{ {
$value = $config->where('name', $name)->first('value', (object)['value' => null])->value; $value = $config->where('name', $name)->first('value', (object)['value' => null])->value;

View File

@ -15,9 +15,9 @@ class CreateUsersTables extends Migration
/** /**
* Run the 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->increments('id');
$table->string('name', 24)->unique(); $table->string('name', 24)->unique();
@ -29,7 +29,7 @@ class CreateUsersTables extends Migration
$table->timestamps(); $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); $this->referencesUser($table, true);
$table->string('first_name', 64)->nullable(); $table->string('first_name', 64)->nullable();
@ -40,7 +40,7 @@ class CreateUsersTables extends Migration
$table->date('planned_departure_date')->nullable(); $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); $this->referencesUser($table, true);
$table->string('dect', 5)->nullable(); $table->string('dect', 5)->nullable();
@ -48,7 +48,7 @@ class CreateUsersTables extends Migration
$table->string('email', 254)->nullable(); $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); $this->referencesUser($table, true);
$table->string('language', 64); $table->string('language', 64);
@ -57,7 +57,7 @@ class CreateUsersTables extends Migration
$table->boolean('email_shiftinfo')->default(false); $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); $this->referencesUser($table, true);
$table->boolean('arrived')->default(false); $table->boolean('arrived')->default(false);
@ -68,7 +68,7 @@ class CreateUsersTables extends Migration
$table->integer('got_voucher')->default(0); $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); $this->referencesUser($table, true);
$table->text('token'); $table->text('token');
@ -155,11 +155,11 @@ class CreateUsersTables extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('User', function (Blueprint $table) { $this->schema->create('User', function (Blueprint $table): void {
$table->integer('UID', true); $table->integer('UID', true);
$table->string('Nick', 23)->unique()->default(''); $table->string('Nick', 23)->unique()->default('');

View File

@ -16,7 +16,7 @@ class ChangeUsersContactDectFieldSize extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->changeDectTo(40); $this->changeDectTo(40);
} }
@ -24,19 +24,19 @@ class ChangeUsersContactDectFieldSize extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->changeDectTo(5); $this->changeDectTo(5);
} }
protected function changeDectTo(int $length) protected function changeDectTo(int $length): void
{ {
foreach ($this->tables as $table => $column) { foreach ($this->tables as $table => $column) {
if (!$this->schema->hasTable($table)) { if (!$this->schema->hasTable($table)) {
continue; 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(); $table->string($column, $length)->change();
}); });
} }

View File

@ -10,7 +10,7 @@ class FixMissingArrivalDates extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -36,7 +36,7 @@ class FixMissingArrivalDates extends Migration
/** /**
* Down is not possible and not needed since this is a bugfix. * Down is not possible and not needed since this is a bugfix.
*/ */
public function down() public function down(): void
{ {
} }
} }

View File

@ -9,7 +9,7 @@ class FixUserLanguages extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$connection $connection
@ -22,7 +22,7 @@ class FixUserLanguages extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$connection $connection

View File

@ -9,7 +9,7 @@ class MigrateAdminSchedulePermissions extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('Privileges')) { if (!$this->schema->hasTable('Privileges')) {
return; return;
@ -29,7 +29,7 @@ class MigrateAdminSchedulePermissions extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('Privileges')) { if (!$this->schema->hasTable('Privileges')) {
return; return;

View File

@ -12,11 +12,11 @@ class CreateScheduleShiftTable extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->create( $this->schema->create(
'schedules', 'schedules',
function (Blueprint $table) { function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('url'); $table->string('url');
} }
@ -24,7 +24,7 @@ class CreateScheduleShiftTable extends Migration
$this->schema->create( $this->schema->create(
'schedule_shift', 'schedule_shift',
function (Blueprint $table) { function (Blueprint $table): void {
$table->integer('shift_id')->index()->unique(); $table->integer('shift_id')->index()->unique();
if ($this->schema->hasTable('Shifts')) { if ($this->schema->hasTable('Shifts')) {
// Legacy table access // Legacy table access
@ -42,7 +42,7 @@ class CreateScheduleShiftTable extends Migration
if ($this->schema->hasTable('Shifts')) { if ($this->schema->hasTable('Shifts')) {
$this->schema->table( $this->schema->table(
'Shifts', 'Shifts',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('PSID'); $table->dropColumn('PSID');
} }
); );
@ -51,7 +51,7 @@ class CreateScheduleShiftTable extends Migration
if ($this->schema->hasTable('Room')) { if ($this->schema->hasTable('Room')) {
$this->schema->table( $this->schema->table(
'Room', 'Room',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('from_frab'); $table->dropColumn('from_frab');
} }
); );
@ -61,12 +61,12 @@ class CreateScheduleShiftTable extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if ($this->schema->hasTable('Room')) { if ($this->schema->hasTable('Room')) {
$this->schema->table( $this->schema->table(
'Room', 'Room',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('from_frab') $table->boolean('from_frab')
->default(false); ->default(false);
} }
@ -76,7 +76,7 @@ class CreateScheduleShiftTable extends Migration
if ($this->schema->hasTable('Shifts')) { if ($this->schema->hasTable('Shifts')) {
$this->schema->table( $this->schema->table(
'Shifts', 'Shifts',
function (Blueprint $table) { function (Blueprint $table): void {
$table->integer('PSID') $table->integer('PSID')
->nullable()->default(null) ->nullable()->default(null)
->unique(); ->unique();

View File

@ -64,12 +64,9 @@ class CreateNewsTable extends Migration
$this->schema->drop('new_news'); $this->schema->drop('new_news');
} }
/**
* @return void
*/
private function createNewNewsTable(): void private function createNewNewsTable(): void
{ {
$this->schema->create('news', function (Blueprint $table) { $this->schema->create('news', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('title', 150); $table->string('title', 150);
$table->text('text'); $table->text('text');
@ -79,9 +76,6 @@ class CreateNewsTable extends Migration
}); });
} }
/**
* @return void
*/
private function copyPreviousToNewNewsTable(): void private function copyPreviousToNewNewsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -104,12 +98,9 @@ class CreateNewsTable extends Migration
} }
} }
/**
* @return void
*/
private function createPreviousNewsTable(): void private function createPreviousNewsTable(): void
{ {
$this->schema->create('News', function (Blueprint $table) { $this->schema->create('News', function (Blueprint $table): void {
$table->increments('ID'); $table->increments('ID');
$table->integer('Datum'); $table->integer('Datum');
$table->string('Betreff', 150) $table->string('Betreff', 150)
@ -120,9 +111,6 @@ class CreateNewsTable extends Migration
}); });
} }
/**
* @return void
*/
private function copyNewToPreviousNewsTable(): void private function copyNewToPreviousNewsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();

View File

@ -53,12 +53,9 @@ class CreateNewsCommentsTable extends Migration
$this->schema->drop('news_comments'); $this->schema->drop('news_comments');
} }
/**
* @return void
*/
private function createNewNewsCommentsTable(): 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'); $table->increments('id');
$this->references($table, 'news', 'news_id'); $this->references($table, 'news', 'news_id');
$table->text('text'); $table->text('text');
@ -67,9 +64,6 @@ class CreateNewsCommentsTable extends Migration
}); });
} }
/**
* @return void
*/
private function copyPreviousToNewNewsCommentsTable(): void private function copyPreviousToNewNewsCommentsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -90,12 +84,9 @@ class CreateNewsCommentsTable extends Migration
} }
} }
/**
* @return void
*/
private function createPreviousNewsCommentsTable(): void private function createPreviousNewsCommentsTable(): void
{ {
$this->schema->create('NewsComments', function (Blueprint $table) { $this->schema->create('NewsComments', function (Blueprint $table): void {
$table->increments('ID'); $table->increments('ID');
$this->references($table, 'news', 'Refid'); $this->references($table, 'news', 'Refid');
$table->dateTime('Datum'); $table->dateTime('Datum');
@ -104,9 +95,6 @@ class CreateNewsCommentsTable extends Migration
}); });
} }
/**
* @return void
*/
private function copyNewToPreviousNewsCommentsTable(): void private function copyNewToPreviousNewsCommentsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();

View File

@ -64,14 +64,11 @@ class CreateMessagesTable extends Migration
$this->schema->drop('new_messages'); $this->schema->drop('new_messages');
} }
/**
* @return void
*/
private function createNewMessagesTable(): void private function createNewMessagesTable(): void
{ {
$this->schema->create( $this->schema->create(
'messages', 'messages',
function (Blueprint $table) { function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$this->references($table, 'users', 'receiver_id'); $this->references($table, 'users', 'receiver_id');
@ -82,9 +79,6 @@ class CreateMessagesTable extends Migration
); );
} }
/**
* @return void
*/
private function copyPreviousToNewMessagesTable(): void private function copyPreviousToNewMessagesTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -109,14 +103,11 @@ class CreateMessagesTable extends Migration
} }
} }
/**
* @return void
*/
private function createPreviousMessagesTable(): void private function createPreviousMessagesTable(): void
{ {
$this->schema->create( $this->schema->create(
'Messages', 'Messages',
function (Blueprint $table) { function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->integer('Datum'); $table->integer('Datum');
$this->references($table, 'users', 'SUID'); $this->references($table, 'users', 'SUID');
@ -128,9 +119,6 @@ class CreateMessagesTable extends Migration
); );
} }
/**
* @return void
*/
private function copyNewToPreviousMessagesTable(): void private function copyNewToPreviousMessagesTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();

View File

@ -17,9 +17,6 @@ class CreateQuestionsTable extends Migration
use ChangesReferences; use ChangesReferences;
use Reference; use Reference;
/**
* @return void
*/
public function up(): void public function up(): void
{ {
$hasPreviousQuestionsTable = $this->schema->hasTable('Questions'); $hasPreviousQuestionsTable = $this->schema->hasTable('Questions');
@ -43,9 +40,6 @@ class CreateQuestionsTable extends Migration
} }
} }
/**
* @return void
*/
public function down(): void public function down(): void
{ {
// Rename as some SQL DBMS handle identifiers case insensitive // Rename as some SQL DBMS handle identifiers case insensitive
@ -63,14 +57,11 @@ class CreateQuestionsTable extends Migration
$this->schema->drop('new_questions'); $this->schema->drop('new_questions');
} }
/**
* @return void
*/
private function createNewQuestionsTable(): void private function createNewQuestionsTable(): void
{ {
$this->schema->create( $this->schema->create(
'questions', 'questions',
function (Blueprint $table) { function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$table->text('text'); $table->text('text');
@ -82,9 +73,6 @@ class CreateQuestionsTable extends Migration
); );
} }
/**
* @return void
*/
private function copyPreviousToNewQuestionsTable(): void private function copyPreviousToNewQuestionsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -104,14 +92,11 @@ class CreateQuestionsTable extends Migration
} }
} }
/**
* @return void
*/
private function createPreviousQuestionsTable(): void private function createPreviousQuestionsTable(): void
{ {
$this->schema->create( $this->schema->create(
'Questions', 'Questions',
function (Blueprint $table) { function (Blueprint $table): void {
$table->increments('QID'); $table->increments('QID');
$this->references($table, 'users', 'UID'); $this->references($table, 'users', 'UID');
$table->text('Question'); $table->text('Question');
@ -123,9 +108,6 @@ class CreateQuestionsTable extends Migration
); );
} }
/**
* @return void
*/
private function copyNewToPreviousQuestionsTable(): void private function copyNewToPreviousQuestionsTable(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();

View File

@ -14,7 +14,7 @@ class UserPersonalDataAddPronounField extends Migration
*/ */
public function up(): void 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) $table->string('pronoun', 15)
->nullable() ->nullable()
->default(null) ->default(null)
@ -27,7 +27,7 @@ class UserPersonalDataAddPronounField extends Migration
*/ */
public function down(): void 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'); $table->dropColumn('pronoun');
}); });
} }

View File

@ -18,7 +18,7 @@ class CreateRoomsTable extends Migration
*/ */
public function up(): void public function up(): void
{ {
$this->schema->create('rooms', function (Blueprint $table) { $this->schema->create('rooms', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('name', 35)->unique(); $table->string('name', 35)->unique();
$table->string('map_url', 300)->nullable(); $table->string('map_url', 300)->nullable();
@ -61,7 +61,7 @@ class CreateRoomsTable extends Migration
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('Room', function (Blueprint $table) { $this->schema->create('Room', function (Blueprint $table): void {
$table->increments('RID'); $table->increments('RID');
$table->string('Name', 35)->unique(); $table->string('Name', 35)->unique();
$table->string('map_url', 300)->nullable(); $table->string('map_url', 300)->nullable();

View File

@ -19,7 +19,7 @@ class CreateWorklogsTable extends Migration
*/ */
public function up(): void public function up(): void
{ {
$this->schema->create('worklogs', function (Blueprint $table) { $this->schema->create('worklogs', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$this->references($table, 'users', 'creator_id'); $this->references($table, 'users', 'creator_id');
@ -70,7 +70,7 @@ class CreateWorklogsTable extends Migration
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('UserWorkLog', function (Blueprint $table) { $this->schema->create('UserWorkLog', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$table->integer('work_timestamp'); $table->integer('work_timestamp');

View File

@ -9,7 +9,7 @@ class CreateWelcomeAngelPermissionsGroup extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('Groups')) { if (!$this->schema->hasTable('Groups')) {
return; return;
@ -38,7 +38,7 @@ class CreateWelcomeAngelPermissionsGroup extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('Groups')) { if (!$this->schema->hasTable('Groups')) {
return; return;

View File

@ -18,7 +18,7 @@ class AddTimestampsToQuestions extends Migration
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$now = Carbon::now(); $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->timestamp('answered_at')->after('answerer_id')->nullable();
$table->timestamps(); $table->timestamps();
}); });
@ -40,7 +40,7 @@ class AddTimestampsToQuestions extends Migration
*/ */
public function down(): void public function down(): void
{ {
$this->schema->table('questions', function (Blueprint $table) { $this->schema->table('questions', function (Blueprint $table): void {
$table->dropColumn('answered_at'); $table->dropColumn('answered_at');
$table->dropTimestamps(); $table->dropTimestamps();
}); });

View File

@ -10,9 +10,9 @@ class CreateFaqTableAndPermissions extends Migration
/** /**
* Run the 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->increments('id');
$table->string('question'); $table->string('question');
$table->text('text'); $table->text('text');
@ -46,7 +46,7 @@ class CreateFaqTableAndPermissions extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->drop('faq'); $this->schema->drop('faq');

View File

@ -9,7 +9,7 @@ class CreateQuestionsPermissions extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if ($this->schema->hasTable('Privileges')) { if ($this->schema->hasTable('Privileges')) {
$db = $this->schema->getConnection(); $db = $this->schema->getConnection();
@ -36,7 +36,7 @@ class CreateQuestionsPermissions extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('Privileges')) { if (!$this->schema->hasTable('Privileges')) {
return; return;

View File

@ -16,7 +16,7 @@ class CreateOauthTable extends Migration
*/ */
public function up(): void public function up(): void
{ {
$this->schema->create('oauth', function (Blueprint $table) { $this->schema->create('oauth', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$table->string('provider'); $table->string('provider');

View File

@ -13,13 +13,13 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->table( $this->schema->table(
'schedules', 'schedules',
function (Blueprint $table) { function (Blueprint $table): void {
$table->string('name')->default('')->after('id'); $table->string('name')->default('')->after('id');
$table->integer('shift_type')->default(0)->after('name'); $table->integer('shift_type')->default(0)->after('name');
$table->integer('minutes_before')->default(0)->after('shift_type'); $table->integer('minutes_before')->default(0)->after('shift_type');
@ -37,7 +37,7 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration
$this->schema->table( $this->schema->table(
'schedules', 'schedules',
function (Blueprint $table) { function (Blueprint $table): void {
$table->string('name')->default(null)->change(); $table->string('name')->default(null)->change();
$table->integer('shift_type')->default(null)->change(); $table->integer('shift_type')->default(null)->change();
$table->integer('minutes_before')->default(null)->change(); $table->integer('minutes_before')->default(null)->change();
@ -61,7 +61,7 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration
$this->schema->table( $this->schema->table(
'schedules', 'schedules',
function (Blueprint $table) { function (Blueprint $table): void {
$this->addReference($table, 'shift_type', 'ShiftTypes'); $this->addReference($table, 'shift_type', 'ShiftTypes');
} }
); );
@ -71,11 +71,11 @@ class AddNameMinutesAndTimestampsToSchedules extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'schedules', 'schedules',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropForeign('schedules_shift_type_foreign'); $table->dropForeign('schedules_shift_type_foreign');
$table->dropColumn('name'); $table->dropColumn('name');
$table->dropColumn('shift_type'); $table->dropColumn('shift_type');

View File

@ -12,11 +12,11 @@ class AddEmailNewsToUsersSettings extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('email_news')->default(false)->after('email_shiftinfo'); $table->boolean('email_news')->default(false)->after('email_shiftinfo');
} }
); );
@ -25,11 +25,11 @@ class AddEmailNewsToUsersSettings extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('email_news'); $table->dropColumn('email_news');
} }
); );

View File

@ -12,11 +12,11 @@ class OauthAddTokens extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'oauth', 'oauth',
function (Blueprint $table) { function (Blueprint $table): void {
$table->string('access_token')->nullable()->default(null)->after('identifier'); $table->string('access_token')->nullable()->default(null)->after('identifier');
$table->string('refresh_token')->nullable()->default(null)->after('access_token'); $table->string('refresh_token')->nullable()->default(null)->after('access_token');
$table->dateTime('expires_at')->nullable()->default(null)->after('refresh_token'); $table->dateTime('expires_at')->nullable()->default(null)->after('refresh_token');
@ -27,11 +27,11 @@ class OauthAddTokens extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'oauth', 'oauth',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('access_token'); $table->dropColumn('access_token');
$table->dropColumn('refresh_token'); $table->dropColumn('refresh_token');
$table->dropColumn('expires_at'); $table->dropColumn('expires_at');

View File

@ -12,11 +12,11 @@ class NewsAddIsPinned extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'news', 'news',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('is_pinned')->default(false)->after('is_meeting'); $table->boolean('is_pinned')->default(false)->after('is_meeting');
} }
); );
@ -25,11 +25,11 @@ class NewsAddIsPinned extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'news', 'news',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('is_pinned'); $table->dropColumn('is_pinned');
} }
); );

View File

@ -12,11 +12,11 @@ class OauthChangeTokensToText extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'oauth', 'oauth',
function (Blueprint $table) { function (Blueprint $table): void {
$table->text('access_token')->change(); $table->text('access_token')->change();
$table->text('refresh_token')->change(); $table->text('refresh_token')->change();
} }
@ -26,11 +26,11 @@ class OauthChangeTokensToText extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'oauth', 'oauth',
function (Blueprint $table) { function (Blueprint $table): void {
$table->string('access_token')->change(); $table->string('access_token')->change();
$table->string('refresh_token')->change(); $table->string('refresh_token')->change();
} }

View File

@ -28,7 +28,7 @@ class SetAdminPassword extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$admin = $this->auth->authenticate('admin', 'asdfasdf'); $admin = $this->auth->authenticate('admin', 'asdfasdf');
$setupPassword = $this->config->get('setup_admin_password'); $setupPassword = $this->config->get('setup_admin_password');

View File

@ -9,7 +9,7 @@ class AddShirtEditPermissions extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;
@ -40,7 +40,7 @@ class AddShirtEditPermissions extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;

View File

@ -12,7 +12,7 @@ class AddShiftsDescription extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('Shifts')) { if (!$this->schema->hasTable('Shifts')) {
return; return;
@ -20,7 +20,7 @@ class AddShiftsDescription extends Migration
$this->schema->table( $this->schema->table(
'Shifts', 'Shifts',
function (Blueprint $table) { function (Blueprint $table): void {
$table->text('description')->nullable()->after('shifttype_id'); $table->text('description')->nullable()->after('shifttype_id');
} }
); );
@ -29,7 +29,7 @@ class AddShiftsDescription extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('Shifts')) { if (!$this->schema->hasTable('Shifts')) {
return; return;
@ -37,7 +37,7 @@ class AddShiftsDescription extends Migration
$this->schema->table( $this->schema->table(
'Shifts', 'Shifts',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('description'); $table->dropColumn('description');
} }
); );

View File

@ -16,7 +16,7 @@ class CreateUserLicensesTable extends Migration
*/ */
public function up(): void 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); $this->referencesUser($table, true);
$table->boolean('has_car')->default(false); $table->boolean('has_car')->default(false);
$table->boolean('drive_forklift')->default(false); $table->boolean('drive_forklift')->default(false);
@ -54,7 +54,7 @@ class CreateUserLicensesTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
$this->schema->create('UserDriverLicenses', function (Blueprint $table) { $this->schema->create('UserDriverLicenses', function (Blueprint $table): void {
$this->referencesUser($table, true); $this->referencesUser($table, true);
$table->boolean('has_car'); $table->boolean('has_car');
$table->boolean('has_license_car'); $table->boolean('has_license_car');

View File

@ -10,9 +10,9 @@ class IncreaseSessionsTablePayloadSize extends Migration
/** /**
* Run the 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(); $table->mediumText('payload')->change();
}); });
} }
@ -20,9 +20,9 @@ class IncreaseSessionsTablePayloadSize extends Migration
/** /**
* Reverse the 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(); $table->text('payload')->change();
}); });
} }

View File

@ -12,13 +12,13 @@ class UsersSettingsAddEmailGoody extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('email_goody')->default(false)->after('email_human'); $table->boolean('email_goody')->default(false)->after('email_human');
} }
); );
@ -31,11 +31,11 @@ class UsersSettingsAddEmailGoody extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('email_goody'); $table->dropColumn('email_goody');
} }
); );

View File

@ -9,7 +9,7 @@ class RemoveAdminNewsHtmlPrivilege extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;
@ -27,7 +27,7 @@ class RemoveAdminNewsHtmlPrivilege extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('GroupPrivileges')) { if (!$this->schema->hasTable('GroupPrivileges')) {
return; return;

View File

@ -13,9 +13,9 @@ class IncreaseTshirtFieldWidth extends Migration
/** /**
* Run the 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(); $table->string('shirt_size', 10)->change();
}); });
} }
@ -23,9 +23,9 @@ class IncreaseTshirtFieldWidth extends Migration
/** /**
* Reverse the 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(); $table->string('shirt_size', 4)->change();
}); });
} }

View File

@ -9,7 +9,7 @@ class CreateVoucherEditPermission extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('Privileges')) { if (!$this->schema->hasTable('Privileges')) {
return; return;
@ -36,7 +36,7 @@ class CreateVoucherEditPermission extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('Privileges')) { if (!$this->schema->hasTable('Privileges')) {
return; return;

View File

@ -18,7 +18,7 @@ class ShiftsAddTransactionId extends Migration
return; return;
} }
$this->schema->table('Shifts', function (Blueprint $table) { $this->schema->table('Shifts', function (Blueprint $table): void {
$table->uuid('transaction_id')->index()->nullable()->default(null); $table->uuid('transaction_id')->index()->nullable()->default(null);
}); });
} }
@ -32,7 +32,7 @@ class ShiftsAddTransactionId extends Migration
return; return;
} }
$this->schema->table('Shifts', function (Blueprint $table) { $this->schema->table('Shifts', function (Blueprint $table): void {
$table->dropColumn('transaction_id'); $table->dropColumn('transaction_id');
}); });
} }

View File

@ -32,7 +32,7 @@ class FixOldGroupsTableIdAndName extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->migrate($this->naming, $this->ids); $this->migrate($this->naming, $this->ids);
} }
@ -40,7 +40,7 @@ class FixOldGroupsTableIdAndName extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->migrate(array_flip($this->naming), array_flip($this->ids)); $this->migrate(array_flip($this->naming), array_flip($this->ids));
} }
@ -49,7 +49,7 @@ class FixOldGroupsTableIdAndName extends Migration
* @param string[] $naming * @param string[] $naming
* @param int[] $ids * @param int[] $ids
*/ */
protected function migrate(array $naming, array $ids) protected function migrate(array $naming, array $ids): void
{ {
if (!$this->schema->hasTable('Groups')) { if (!$this->schema->hasTable('Groups')) {
return; return;

View File

@ -10,11 +10,11 @@ class AddMobileShowToUsersSettings extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('mobile_show')->default(false)->after('email_news'); $table->boolean('mobile_show')->default(false)->after('email_news');
} }
); );
@ -23,11 +23,11 @@ class AddMobileShowToUsersSettings extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'users_settings', 'users_settings',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('mobile_show'); $table->dropColumn('mobile_show');
} }
); );

View File

@ -10,11 +10,11 @@ class AddDectToRooms extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
$this->schema->table( $this->schema->table(
'rooms', 'rooms',
function (Blueprint $table) { function (Blueprint $table): void {
$table->text('dect')->nullable()->after('description'); $table->text('dect')->nullable()->after('description');
} }
); );
@ -23,11 +23,11 @@ class AddDectToRooms extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
$this->schema->table( $this->schema->table(
'rooms', 'rooms',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('dect'); $table->dropColumn('dect');
} }
); );

View File

@ -10,7 +10,7 @@ class AddHideRegisterToAngeltypes extends Migration
/** /**
* Run the migration * Run the migration
*/ */
public function up() public function up(): void
{ {
if (!$this->schema->hasTable('AngelTypes')) { if (!$this->schema->hasTable('AngelTypes')) {
return; return;
@ -18,7 +18,7 @@ class AddHideRegisterToAngeltypes extends Migration
$this->schema->table( $this->schema->table(
'AngelTypes', 'AngelTypes',
function (Blueprint $table) { function (Blueprint $table): void {
$table->boolean('hide_register')->default(false)->after('show_on_dashboard'); $table->boolean('hide_register')->default(false)->after('show_on_dashboard');
} }
); );
@ -27,7 +27,7 @@ class AddHideRegisterToAngeltypes extends Migration
/** /**
* Reverse the migration * Reverse the migration
*/ */
public function down() public function down(): void
{ {
if (!$this->schema->hasTable('AngelTypes')) { if (!$this->schema->hasTable('AngelTypes')) {
return; return;
@ -35,7 +35,7 @@ class AddHideRegisterToAngeltypes extends Migration
$this->schema->table( $this->schema->table(
'AngelTypes', 'AngelTypes',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropColumn('hide_register'); $table->dropColumn('hide_register');
} }
); );

View File

@ -108,59 +108,53 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration
$this->schema->drop('privileges_new'); $this->schema->drop('privileges_new');
} }
/**
* @return void
*/
protected function createNew(): void protected function createNew(): void
{ {
$this->schema->create('groups', function (Blueprint $table) { $this->schema->create('groups', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('name', 35)->unique(); $table->string('name', 35)->unique();
}); });
$this->schema->create('privileges', function (Blueprint $table) { $this->schema->create('privileges', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('name', 128)->unique(); $table->string('name', 128)->unique();
$table->string('description', 1024); $table->string('description', 1024);
}); });
$this->schema->create('users_groups', function (Blueprint $table) { $this->schema->create('users_groups', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table)->index(); $this->referencesUser($table)->index();
$this->references($table, 'groups')->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'); $table->increments('id');
$this->references($table, 'groups')->index(); $this->references($table, 'groups')->index();
$this->references($table, 'privileges')->index(); $this->references($table, 'privileges')->index();
}); });
} }
/**
* @return void
*/
protected function createOldTable(): 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->string('Name', 35);
$table->integer('UID')->primary(); $table->integer('UID')->primary();
}); });
$this->schema->create('Privileges', function (Blueprint $table) { $this->schema->create('Privileges', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('name', 128)->unique(); $table->string('name', 128)->unique();
$table->string('desc', 1024); $table->string('desc', 1024);
}); });
$this->schema->create('UserGroups', function (Blueprint $table) { $this->schema->create('UserGroups', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->references($table, 'users', 'uid'); $this->references($table, 'users', 'uid');
$this->references($table, 'Groups', 'group_id', 'UID', false, 'integer')->index(); $this->references($table, 'Groups', 'group_id', 'UID', false, 'integer')->index();
$table->index(['uid', 'group_id']); $table->index(['uid', 'group_id']);
}); });
$this->schema->create('GroupPrivileges', function (Blueprint $table) { $this->schema->create('GroupPrivileges', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->references($table, 'Groups', 'group_id', 'UID', false, 'integer'); $this->references($table, 'Groups', 'group_id', 'UID', false, 'integer');
$this->references($table, 'Privileges', 'privilege_id')->index(); $this->references($table, 'Privileges', 'privilege_id')->index();
@ -168,9 +162,6 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration
}); });
} }
/**
* @return void
*/
protected function copyOldToNew(): void protected function copyOldToNew(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
@ -220,9 +211,6 @@ class CreatePrivilegesAndGroupsRelatedTables extends Migration
} }
} }
/**
* @return void
*/
protected function copyNewToOld(): void protected function copyNewToOld(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();

View File

@ -20,7 +20,7 @@ class ShifttypeRemoveAngeltype extends Migration
$this->schema->table( $this->schema->table(
'ShiftTypes', 'ShiftTypes',
function (Blueprint $table) { function (Blueprint $table): void {
$table->dropForeign('shifttypes_ibfk_1'); $table->dropForeign('shifttypes_ibfk_1');
$table->dropColumn('angeltype_id'); $table->dropColumn('angeltype_id');
} }
@ -38,7 +38,7 @@ class ShifttypeRemoveAngeltype extends Migration
$this->schema->table( $this->schema->table(
'ShiftTypes', 'ShiftTypes',
function (Blueprint $table) { function (Blueprint $table): void {
$table->integer('angeltype_id') $table->integer('angeltype_id')
->after('name') ->after('name')
->index() ->index()

View File

@ -18,7 +18,7 @@ class CreateShiftTypesTable extends Migration
public function up(): void public function up(): void
{ {
$connection = $this->schema->getConnection(); $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->increments('id');
$table->string('name')->unique(); $table->string('name')->unique();
$table->text('description'); $table->text('description');
@ -56,7 +56,7 @@ class CreateShiftTypesTable extends Migration
public function down(): void public function down(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('ShiftTypes', function (Blueprint $table) { $this->schema->create('ShiftTypes', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$table->string('name', 255); $table->string('name', 255);
$table->mediumText('description'); $table->mediumText('description');

View File

@ -19,7 +19,7 @@ class CreateAngelTypesTable extends Migration
public function up(): void public function up(): void
{ {
$connection = $this->schema->getConnection(); $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->increments('id');
$table->string('name')->unique(); $table->string('name')->unique();
$table->text('description')->default(''); $table->text('description')->default('');
@ -77,7 +77,7 @@ class CreateAngelTypesTable extends Migration
public function down(): void public function down(): void
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('AngelTypes', function (Blueprint $table) { $this->schema->create('AngelTypes', function (Blueprint $table): void {
$table->integer('id', true); $table->integer('id', true);
$table->string('name', 50)->default('')->unique(); $table->string('name', 50)->default('')->unique();
$table->boolean('restricted'); $table->boolean('restricted');

View File

@ -20,7 +20,7 @@ class CreateUserAngelTypesTable extends Migration
{ {
$connection = $this->schema->getConnection(); $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'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$this->references($table, 'angel_types')->index(); $this->references($table, 'angel_types')->index();
@ -65,7 +65,7 @@ class CreateUserAngelTypesTable extends Migration
{ {
$connection = $this->schema->getConnection(); $connection = $this->schema->getConnection();
$this->schema->create('UserAngelTypes', function (Blueprint $table) { $this->schema->create('UserAngelTypes', function (Blueprint $table): void {
$table->increments('id'); $table->increments('id');
$this->referencesUser($table); $this->referencesUser($table);
$this->references($table, 'angel_types', 'angeltype_id')->index('angeltype_id'); $this->references($table, 'angel_types', 'angeltype_id')->index('angeltype_id');

View File

@ -12,9 +12,9 @@ class ChangeApiKeyLength extends Migration
/** /**
* Run the 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(); $table->string('api_key', 64)->change();
}); });
} }
@ -22,9 +22,9 @@ class ChangeApiKeyLength extends Migration
/** /**
* Reverse the 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(); $table->string('api_key', 32)->change();
}); });
} }

View File

@ -13,18 +13,18 @@ trait ChangesReferences
string $targetTable, string $targetTable,
string $targetColumn, string $targetColumn,
string $type = 'unsignedInteger' string $type = 'unsignedInteger'
) { ): void {
$references = $this->getReferencingTables($fromTable, $fromColumn); $references = $this->getReferencingTables($fromTable, $fromColumn);
foreach ($references as $reference) { foreach ($references as $reference) {
/** @var stdClass $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); $table->dropForeign($reference->constraint);
}); });
$this->schema->table( $this->schema->table(
$reference->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->{$type}($reference->column)->change();
$table->foreign($reference->column) $table->foreign($reference->column)

View File

@ -8,17 +8,11 @@ use Illuminate\Support\Str;
trait Reference trait Reference
{ {
/**
* @return ColumnDefinition
*/
protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition
{ {
return $this->references($table, 'users', null, null, $setPrimary); return $this->references($table, 'users', null, null, $setPrimary);
} }
/**
* @return ColumnDefinition
*/
protected function references( protected function references(
Blueprint $table, Blueprint $table,
string $targetTable, string $targetTable,

View File

@ -41,7 +41,7 @@ class Application extends Container
$this->registerBaseBindings(); $this->registerBaseBindings();
} }
protected function registerBaseBindings() protected function registerBaseBindings(): void
{ {
static::setInstance($this); static::setInstance($this);
Container::setInstance($this); Container::setInstance($this);
@ -54,10 +54,7 @@ class Application extends Container
$this->bind(ContainerInterface::class, self::class); $this->bind(ContainerInterface::class, self::class);
} }
/** public function register(string|ServiceProvider $provider): ServiceProvider
* @return ServiceProvider
*/
public function register(string|ServiceProvider $provider)
{ {
if (is_string($provider)) { if (is_string($provider)) {
$provider = $this->make($provider); $provider = $this->make($provider);
@ -79,7 +76,7 @@ class Application extends Container
* *
* @param Config|null $config * @param Config|null $config
*/ */
public function bootstrap(Config $config = null) public function bootstrap(Config $config = null): void
{ {
if ($this->isBootstrapped) { if ($this->isBootstrapped) {
return; return;
@ -100,7 +97,7 @@ class Application extends Container
$this->isBootstrapped = true; $this->isBootstrapped = true;
} }
protected function registerPaths() protected function registerPaths(): void
{ {
$appPath = $this->appPath; $appPath = $this->appPath;
@ -124,7 +121,7 @@ class Application extends Container
* *
* @return static * @return static
*/ */
public function setAppPath(string $appPath) public function setAppPath(string $appPath): static
{ {
$appPath = realpath($appPath); $appPath = realpath($appPath);
$appPath = rtrim($appPath, DIRECTORY_SEPARATOR); $appPath = rtrim($appPath, DIRECTORY_SEPARATOR);
@ -136,18 +133,12 @@ class Application extends Container
return $this; return $this;
} }
/** public function path(): ?string
* @return string|null
*/
public function path()
{ {
return $this->appPath; return $this->appPath;
} }
/** public function isBooted(): bool
* @return bool
*/
public function isBooted()
{ {
return $this->isBootstrapped; return $this->isBootstrapped;
} }
@ -155,7 +146,7 @@ class Application extends Container
/** /**
* @return MiddlewareInterface[]|string[] * @return MiddlewareInterface[]|string[]
*/ */
public function getMiddleware() public function getMiddleware(): array
{ {
return $this->middleware; return $this->middleware;
} }

View File

@ -16,7 +16,7 @@ class Config extends Fluent
/** /**
* @param string|array $key * @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)) { if (is_null($key)) {
return $this->attributes; return $this->attributes;
@ -32,7 +32,7 @@ class Config extends Fluent
/** /**
* @param string|array $key * @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)) { if (is_array($key)) {
foreach ($key as $configKey => $configValue) { foreach ($key as $configKey => $configValue) {
@ -47,9 +47,8 @@ class Config extends Fluent
/** /**
* @param string $key * @param string $key
* @return bool
*/ */
public function has(mixed $key) public function has(mixed $key): bool
{ {
return $this->offsetExists($key); return $this->offsetExists($key);
} }
@ -57,7 +56,7 @@ class Config extends Fluent
/** /**
* @param string $key * @param string $key
*/ */
public function remove(mixed $key) public function remove(mixed $key): void
{ {
$this->offsetUnset($key); $this->offsetUnset($key);
} }

View File

@ -23,7 +23,7 @@ class ConfigServiceProvider extends ServiceProvider
$this->eventConfig = $eventConfig; $this->eventConfig = $eventConfig;
} }
public function register() public function register(): void
{ {
$config = $this->app->make(Config::class); $config = $this->app->make(Config::class);
$this->app->instance(Config::class, $config); $this->app->instance(Config::class, $config);
@ -48,7 +48,7 @@ class ConfigServiceProvider extends ServiceProvider
} }
} }
public function boot() public function boot(): void
{ {
if (!$this->eventConfig) { if (!$this->eventConfig) {
return; return;
@ -80,7 +80,6 @@ class ConfigServiceProvider extends ServiceProvider
/** /**
* Get the config path * Get the config path
* *
* @return string
*/ */
protected function getConfigPath(string $path = ''): string protected function getConfigPath(string $path = ''): string
{ {

View File

@ -21,14 +21,14 @@ abstract class ServiceProvider
/** /**
* Register container bindings * Register container bindings
*/ */
public function register() public function register(): void
{ {
} }
/** /**
* Called after other services had been registered * Called after other services had been registered
*/ */
public function boot() public function boot(): void
{ {
} }
} }

View File

@ -44,10 +44,6 @@ class FaqController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
*
* @return Response
*/
public function edit(Request $request): Response public function edit(Request $request): Response
{ {
$faqId = $request->getAttribute('faq_id'); // optional $faqId = $request->getAttribute('faq_id'); // optional
@ -57,10 +53,6 @@ class FaqController extends BaseController
return $this->showEdit($faq); return $this->showEdit($faq);
} }
/**
*
* @return Response
*/
public function save(Request $request): Response public function save(Request $request): Response
{ {
$faqId = $request->getAttribute('faq_id'); // optional $faqId = $request->getAttribute('faq_id'); // optional
@ -101,10 +93,6 @@ class FaqController extends BaseController
return $this->redirect->to('/faq#faq-' . $faq->id); return $this->redirect->to('/faq#faq-' . $faq->id);
} }
/**
*
* @return Response
*/
protected function showEdit(?Faq $faq): Response protected function showEdit(?Faq $faq): Response
{ {
return $this->response->withView( return $this->response->withView(

View File

@ -26,9 +26,6 @@ class LogsController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
* @return Response
*/
public function index(Request $request): Response public function index(Request $request): Response
{ {
$search = $request->input('search'); $search = $request->input('search');

View File

@ -49,10 +49,6 @@ class NewsController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
*
* @return Response
*/
public function edit(Request $request): Response public function edit(Request $request): Response
{ {
$newsId = $request->getAttribute('news_id'); // optional $newsId = $request->getAttribute('news_id'); // optional
@ -63,10 +59,6 @@ class NewsController extends BaseController
return $this->showEdit($news, $isMeeting); return $this->showEdit($news, $isMeeting);
} }
/**
*
* @return Response
*/
protected function showEdit(?News $news, bool $isMeetingDefault = false): Response protected function showEdit(?News $news, bool $isMeetingDefault = false): Response
{ {
return $this->response->withView( return $this->response->withView(
@ -79,10 +71,6 @@ class NewsController extends BaseController
); );
} }
/**
*
* @return Response
*/
public function save(Request $request): Response public function save(Request $request): Response
{ {
$newsId = $request->getAttribute('news_id'); // optional $newsId = $request->getAttribute('news_id'); // optional

View File

@ -51,9 +51,6 @@ class QuestionsController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
$questions = $this->question $questions = $this->question
@ -67,10 +64,6 @@ class QuestionsController extends BaseController
); );
} }
/**
*
* @return Response
*/
public function delete(Request $request): Response public function delete(Request $request): Response
{ {
$data = $this->validate($request, [ $data = $this->validate($request, [
@ -87,10 +80,6 @@ class QuestionsController extends BaseController
return $this->redirect->to('/admin/questions'); return $this->redirect->to('/admin/questions');
} }
/**
*
* @return Response
*/
public function edit(Request $request): Response public function edit(Request $request): Response
{ {
$questionId = (int)$request->getAttribute('question_id'); $questionId = (int)$request->getAttribute('question_id');
@ -100,10 +89,6 @@ class QuestionsController extends BaseController
return $this->showEdit($questions); return $this->showEdit($questions);
} }
/**
*
* @return Response
*/
public function save(Request $request): Response public function save(Request $request): Response
{ {
$questionId = (int)$request->getAttribute('question_id'); $questionId = (int)$request->getAttribute('question_id');
@ -149,10 +134,6 @@ class QuestionsController extends BaseController
return $this->redirect->to('/admin/questions'); return $this->redirect->to('/admin/questions');
} }
/**
*
* @return Response
*/
protected function showEdit(?Question $question): Response protected function showEdit(?Question $question): Response
{ {
return $this->response->withView( return $this->response->withView(

View File

@ -56,10 +56,6 @@ class UserShirtController extends BaseController
$this->user = $user; $this->user = $user;
} }
/**
*
* @return Response
*/
public function editShirt(Request $request): Response public function editShirt(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $userId = (int)$request->getAttribute('user_id');
@ -72,10 +68,6 @@ class UserShirtController extends BaseController
); );
} }
/**
*
* @return Response
*/
public function saveShirt(Request $request): Response public function saveShirt(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $userId = (int)$request->getAttribute('user_id');

View File

@ -63,9 +63,6 @@ class UserWorkLogController extends BaseController
$this->user = $user; $this->user = $user;
} }
/**
* @return Response
*/
public function editWorklog(Request $request): Response public function editWorklog(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $userId = (int)$request->getAttribute('user_id');
@ -85,9 +82,6 @@ class UserWorkLogController extends BaseController
} }
} }
/**
* @return Response
*/
public function saveWorklog(Request $request): Response public function saveWorklog(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $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 // TODO Once User_view.php gets removed, change this to withView + getNotifications
} }
/**
* @return Response
*/
public function showDeleteWorklog(Request $request): Response public function showDeleteWorklog(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $userId = (int)$request->getAttribute('user_id');
@ -144,9 +135,6 @@ class UserWorkLogController extends BaseController
); );
} }
/**
* @return Response
*/
public function deleteWorklog(Request $request): Response public function deleteWorklog(Request $request): Response
{ {
$userId = (int)$request->getAttribute('user_id'); $userId = (int)$request->getAttribute('user_id');
@ -184,9 +172,6 @@ class UserWorkLogController extends BaseController
); );
} }
/**
* @return Carbon
*/
private function getWorkDateSuggestion(): Carbon private function getWorkDateSuggestion(): Carbon
{ {
$buildup_start = config('buildup_start'); $buildup_start = config('buildup_start');

View File

@ -14,10 +14,7 @@ class ApiController extends BaseController
$this->response = $response; $this->response = $response;
} }
/** public function index(): Response
* @return Response
*/
public function index()
{ {
return $this->response return $this->response
->setStatusCode(501) ->setStatusCode(501)

View File

@ -50,17 +50,11 @@ class AuthController extends BaseController
$this->auth = $auth; $this->auth = $auth;
} }
/**
* @return Response
*/
public function login(): Response public function login(): Response
{ {
return $this->showLogin(); return $this->showLogin();
} }
/**
* @return Response
*/
protected function showLogin(): Response protected function showLogin(): Response
{ {
return $this->response->withView( return $this->response->withView(
@ -72,7 +66,6 @@ class AuthController extends BaseController
/** /**
* Posted login form * Posted login form
* *
* @return Response
*/ */
public function postLogin(Request $request): Response public function postLogin(Request $request): Response
{ {
@ -92,10 +85,6 @@ class AuthController extends BaseController
return $this->loginUser($user); return $this->loginUser($user);
} }
/**
*
* @return Response
*/
public function loginUser(User $user): Response public function loginUser(User $user): Response
{ {
$previousPage = $this->session->get('previous_page'); $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 $this->redirect->to($previousPage ?: $this->config->get('home_site'));
} }
/**
* @return Response
*/
public function logout(): Response public function logout(): Response
{ {
$this->session->invalidate(); $this->session->invalidate();

View File

@ -16,7 +16,7 @@ abstract class BaseController
* *
* @return string[]|string[][] * @return string[]|string[][]
*/ */
public function getPermissions() public function getPermissions(): array
{ {
return $this->permissions; return $this->permissions;
} }

View File

@ -7,9 +7,6 @@ use DateTime;
trait ChecksArrivalsAndDepartures trait ChecksArrivalsAndDepartures
{ {
/**
* @return bool
*/
protected function isArrivalDateValid(?string $arrival, ?string $departure): bool protected function isArrivalDateValid(?string $arrival, ?string $departure): bool
{ {
$arrival_carbon = $this->toCarbon($arrival); $arrival_carbon = $this->toCarbon($arrival);
@ -26,9 +23,6 @@ trait ChecksArrivalsAndDepartures
return !$this->isBeforeBuildup($arrival_carbon) && !$this->isAfterTeardown($arrival_carbon); return !$this->isBeforeBuildup($arrival_carbon) && !$this->isAfterTeardown($arrival_carbon);
} }
/**
* @return bool
*/
protected function isDepartureDateValid(?string $arrival, ?string $departure): bool protected function isDepartureDateValid(?string $arrival, ?string $departure): bool
{ {
$arrival_carbon = $this->toCarbon($arrival); $arrival_carbon = $this->toCarbon($arrival);

View File

@ -24,10 +24,7 @@ class CreditsController extends BaseController
$this->version = $version; $this->version = $version;
} }
/** public function index(): Response
* @return Response
*/
public function index()
{ {
return $this->response->withView( return $this->response->withView(
'pages/credits.twig', 'pages/credits.twig',

View File

@ -26,9 +26,8 @@ class DesignController extends BaseController
/** /**
* Show the design overview page * Show the design overview page
* *
* @return Response
*/ */
public function index() public function index(): Response
{ {
$demoUser = (new User())->forceFill([ $demoUser = (new User())->forceFill([
'id' => 42, 'id' => 42,

View File

@ -34,9 +34,6 @@ class FaqController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
$text = $this->config->get('faq_text'); $text = $this->config->get('faq_text');

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Collection;
trait HasUserNotifications trait HasUserNotifications
{ {
protected function addNotification(string|array $value, string $type = 'messages') protected function addNotification(string|array $value, string $type = 'messages'): void
{ {
session()->set( session()->set(
$type, $type,

View File

@ -14,9 +14,6 @@ class HealthController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
return $this->response->withContent('Ok'); return $this->response->withContent('Ok');

View File

@ -25,9 +25,6 @@ class HomeController extends BaseController
$this->redirect = $redirect; $this->redirect = $redirect;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
return $this->redirect->to($this->auth->user() ? $this->config->get('home_site') : 'login'); return $this->redirect->to($this->auth->user() ? $this->config->get('home_site') : 'login');

View File

@ -59,9 +59,6 @@ class MessagesController extends BaseController
$this->user = $user; $this->user = $user;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
return $this->listConversations(); return $this->listConversations();
@ -127,11 +124,11 @@ class MessagesController extends BaseController
$otherUser = $this->user->findOrFail($userId); $otherUser = $this->user->findOrFail($userId);
$messages = $this->message $messages = $this->message
->where(function ($query) use ($currentUser, $otherUser) { ->where(function ($query) use ($currentUser, $otherUser): void {
$query->whereUserId($currentUser->id) $query->whereUserId($currentUser->id)
->whereReceiverId($otherUser->id); ->whereReceiverId($otherUser->id);
}) })
->orWhere(function ($query) use ($currentUser, $otherUser) { ->orWhere(function ($query) use ($currentUser, $otherUser): void {
$query->whereUserId($otherUser->id) $query->whereUserId($otherUser->id)
->whereReceiverId($currentUser->id); ->whereReceiverId($currentUser->id);
}) })
@ -235,16 +232,13 @@ class MessagesController extends BaseController
// then getting the full message objects for each ID. // then getting the full message objects for each ID.
return $this->message return $this->message
->joinSub($latestMessageIds, 'conversations', function ($join) { ->joinSub($latestMessageIds, 'conversations', function ($join): void {
$join->on('messages.id', '=', 'conversations.last_id'); $join->on('messages.id', '=', 'conversations.last_id');
}) })
->orderBy('created_at', 'DESC') ->orderBy('created_at', 'DESC')
->get(); ->get();
} }
/**
* @return QueryExpression
*/
protected function raw(mixed $value): QueryExpression protected function raw(mixed $value): QueryExpression
{ {
return $this->db->getConnection()->raw($value); return $this->db->getConnection()->raw($value);

View File

@ -47,10 +47,7 @@ class Controller extends BaseController
$this->version = $version; $this->version = $version;
} }
/** public function metrics(): Response
* @return Response
*/
public function metrics()
{ {
$now = microtime(true); $now = microtime(true);
$this->checkAuth(); $this->checkAuth();
@ -212,10 +209,7 @@ class Controller extends BaseController
->withContent($this->engine->get('/metrics', $data)); ->withContent($this->engine->get('/metrics', $data));
} }
/** public function stats(): Response
* @return Response
*/
public function stats()
{ {
$this->checkAuth(true); $this->checkAuth(true);
@ -235,7 +229,7 @@ class Controller extends BaseController
* Ensure that the if the request is authorized * 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'); $apiKey = $this->config->get('api_key');
if (empty($apiKey) || $this->request->get('api_key') == $apiKey) { if (empty($apiKey) || $this->request->get('api_key') == $apiKey) {

View File

@ -14,7 +14,6 @@ class MetricsEngine implements EngineInterface
* *
* @param mixed[] $data * @param mixed[] $data
* *
* @return string
* *
* @example $data = ['foo' => [['labels' => ['foo'=>'bar'], 'value'=>42]], 'bar'=>123] * @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/ * @see https://prometheus.io/docs/instrumenting/exposition_formats/
*/ */
protected function formatData(string $name, mixed $row): string protected function formatData(string $name, mixed $row): string
@ -152,11 +150,7 @@ class MetricsEngine implements EngineInterface
return '{' . implode(',', $labels) . '}'; return '{' . implode(',', $labels) . '}';
} }
/** protected function renderValue(mixed $row): mixed
*
* @return mixed
*/
protected function renderValue(mixed $row)
{ {
if (is_array($row)) { if (is_array($row)) {
$row = array_pop($row); $row = array_pop($row);
@ -165,11 +159,7 @@ class MetricsEngine implements EngineInterface
return $this->formatValue($row); return $this->formatValue($row);
} }
/** protected function formatValue(mixed $value): mixed
*
* @return mixed
*/
protected function formatValue(mixed $value)
{ {
if (is_bool($value)) { if (is_bool($value)) {
return (int)$value; return (int)$value;
@ -178,11 +168,7 @@ class MetricsEngine implements EngineInterface
return $this->escape($value); return $this->escape($value);
} }
/** protected function escape(mixed $value): mixed
*
* @return mixed
*/
protected function escape(mixed $value)
{ {
$replace = [ $replace = [
'\\' => '\\\\', '\\' => '\\\\',
@ -197,10 +183,6 @@ class MetricsEngine implements EngineInterface
); );
} }
/**
*
* @return bool
*/
public function canRender(string $path): bool public function canRender(string $path): bool
{ {
return $path == '/metrics'; return $path == '/metrics';

View File

@ -23,6 +23,7 @@ use Engelsystem\Models\User\State;
use Engelsystem\Models\User\User; use Engelsystem\Models\User\User;
use Engelsystem\Models\Worklog; use Engelsystem\Models\Worklog;
use Illuminate\Contracts\Database\Query\Builder as BuilderContract; use Illuminate\Contracts\Database\Query\Builder as BuilderContract;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression as QueryExpression; use Illuminate\Database\Query\Expression as QueryExpression;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -41,7 +42,6 @@ class Stats
* The number of not arrived users * The number of not arrived users
* *
* @param bool|null $working * @param bool|null $working
* @return int
*/ */
public function arrivedUsers(bool $working = null): int public function arrivedUsers(bool $working = null): int
{ {
@ -54,7 +54,7 @@ class Stats
->leftJoin('ShiftEntry', 'ShiftEntry.UID', '=', 'users_state.user_id') ->leftJoin('ShiftEntry', 'ShiftEntry.UID', '=', 'users_state.user_id')
->distinct(); ->distinct();
$query->where(function ($query) use ($working) { $query->where(function ($query) use ($working): void {
/** @var QueryBuilder $query */ /** @var QueryBuilder $query */
if ($working) { if ($working) {
$query $query
@ -77,33 +77,22 @@ class Stats
/** /**
* The number of not arrived users * The number of not arrived users
* *
* @return int
*/ */
public function newUsers(): int public function newUsers(): int
{ {
return State::whereArrived(false)->count(); return State::whereArrived(false)->count();
} }
/**
* @return int
*/
public function forceActiveUsers(): int public function forceActiveUsers(): int
{ {
return State::whereForceActive(true)->count(); return State::whereForceActive(true)->count();
} }
/**
* @return int
*/
public function usersPronouns(): int public function usersPronouns(): int
{ {
return PersonalData::where('pronoun', '!=', '')->count(); return PersonalData::where('pronoun', '!=', '')->count();
} }
/**
*
* @return int
*/
public function email(string $type): int public function email(string $type): int
{ {
switch ($type) { switch ($type) {
@ -130,7 +119,6 @@ class Stats
* The number of currently working users * The number of currently working users
* *
* @param bool|null $freeloaded * @param bool|null $freeloaded
* @return int
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function currentlyWorkingUsers(bool $freeloaded = null): int public function currentlyWorkingUsers(bool $freeloaded = null): int
@ -148,17 +136,11 @@ class Stats
return $query->count(); return $query->count();
} }
/** protected function vouchersQuery(): Builder
* @return QueryBuilder
*/
protected function vouchersQuery()
{ {
return State::query(); return State::query();
} }
/**
* @return int
*/
public function vouchers(): int public function vouchers(): int
{ {
return (int)$this->vouchersQuery()->sum('got_voucher'); return (int)$this->vouchersQuery()->sum('got_voucher');
@ -185,17 +167,11 @@ class Stats
return $return; return $return;
} }
/**
* @return int
*/
public function tshirts(): int public function tshirts(): int
{ {
return State::whereGotShirt(true)->count(); return State::whereGotShirt(true)->count();
} }
/**
* @return Collection
*/
public function tshirtSizes(): Collection public function tshirtSizes(): Collection
{ {
return PersonalData::query() return PersonalData::query()
@ -205,9 +181,6 @@ class Stats
->get(); ->get();
} }
/**
* @return Collection
*/
public function languages(): Collection public function languages(): Collection
{ {
return Settings::query() return Settings::query()
@ -216,9 +189,6 @@ class Stats
->get(); ->get();
} }
/**
* @return Collection
*/
public function themes(): Collection public function themes(): Collection
{ {
return Settings::query() return Settings::query()
@ -229,7 +199,6 @@ class Stats
/** /**
* @param string|null $vehicle * @param string|null $vehicle
* @return int
*/ */
public function licenses(string $vehicle): int public function licenses(string $vehicle): int
{ {
@ -254,7 +223,6 @@ class Stats
* @param bool|null $freeloaded * @param bool|null $freeloaded
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @return QueryBuilder
*/ */
protected function workSecondsQuery(bool $done = null, bool $freeloaded = null): QueryBuilder protected function workSecondsQuery(bool $done = null, bool $freeloaded = null): QueryBuilder
{ {
@ -279,7 +247,6 @@ class Stats
* @param bool|null $done * @param bool|null $done
* @param bool|null $freeloaded * @param bool|null $freeloaded
* *
* @return int
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function workSeconds(bool $done = null, bool $freeloaded = null): int public function workSeconds(bool $done = null, bool $freeloaded = null): int
@ -340,7 +307,6 @@ class Stats
} }
/** /**
* @return int
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function worklogSeconds(): int public function worklogSeconds(): int
@ -366,9 +332,6 @@ class Stats
); );
} }
/**
* @return int
*/
public function rooms(): int public function rooms(): int
{ {
return Room::query() return Room::query()
@ -376,7 +339,6 @@ class Stats
} }
/** /**
* @return int
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function shifts(): int public function shifts(): int
@ -388,7 +350,6 @@ class Stats
/** /**
* @param bool|null $meeting * @param bool|null $meeting
* @return int
*/ */
public function announcements(bool $meeting = null): int public function announcements(bool $meeting = null): int
{ {
@ -397,9 +358,6 @@ class Stats
return $query->count(); return $query->count();
} }
/**
* @return int
*/
public function comments(): int public function comments(): int
{ {
return NewsComment::query() return NewsComment::query()
@ -408,7 +366,6 @@ class Stats
/** /**
* @param bool|null $answered * @param bool|null $answered
* @return int
*/ */
public function questions(bool $answered = null): int public function questions(bool $answered = null): int
{ {
@ -424,25 +381,16 @@ class Stats
return $query->count(); return $query->count();
} }
/**
* @return int
*/
public function faq(): int public function faq(): int
{ {
return Faq::query()->count(); return Faq::query()->count();
} }
/**
* @return int
*/
public function messages(): int public function messages(): int
{ {
return Message::query()->count(); return Message::query()->count();
} }
/**
* @return int
*/
public function sessions(): int public function sessions(): int
{ {
return $this return $this
@ -450,9 +398,6 @@ class Stats
->count(); ->count();
} }
/**
* @return Collection
*/
public function oauth(): Collection public function oauth(): Collection
{ {
return OAuth::query() return OAuth::query()
@ -461,9 +406,6 @@ class Stats
->get(); ->get();
} }
/**
* @return float
*/
public function databaseRead(): float public function databaseRead(): float
{ {
$start = microtime(true); $start = microtime(true);
@ -473,9 +415,6 @@ class Stats
return microtime(true) - $start; return microtime(true) - $start;
} }
/**
* @return float
*/
public function databaseWrite(): float public function databaseWrite(): float
{ {
$config = (new EventConfig())->findOrNew('last_metrics'); $config = (new EventConfig())->findOrNew('last_metrics');
@ -492,7 +431,6 @@ class Stats
/** /**
* @param string|null $level * @param string|null $level
* @return int
*/ */
public function logEntries(string $level = null): int public function logEntries(string $level = null): int
{ {
@ -501,17 +439,11 @@ class Stats
return $query->count(); return $query->count();
} }
/**
* @return int
*/
public function passwordResets(): int public function passwordResets(): int
{ {
return PasswordReset::query()->count(); return PasswordReset::query()->count();
} }
/**
* @return QueryBuilder
*/
protected function getQuery(string $table): QueryBuilder protected function getQuery(string $table): QueryBuilder
{ {
return $this->db return $this->db
@ -519,9 +451,6 @@ class Stats
->table($table); ->table($table);
} }
/**
* @return QueryExpression
*/
protected function raw(mixed $value): QueryExpression protected function raw(mixed $value): QueryExpression
{ {
return $this->db->getConnection()->raw($value); return $this->db->getConnection()->raw($value);

View File

@ -68,25 +68,16 @@ class NewsController extends BaseController
$this->request = $request; $this->request = $request;
} }
/** public function index(): Response
* @return Response
*/
public function index()
{ {
return $this->showOverview(); return $this->showOverview();
} }
/**
* @return Response
*/
public function meetings(): Response public function meetings(): Response
{ {
return $this->showOverview(true); return $this->showOverview(true);
} }
/**
* @return Response
*/
public function show(Request $request): Response public function show(Request $request): Response
{ {
$newsId = (int)$request->getAttribute('news_id'); $newsId = (int)$request->getAttribute('news_id');
@ -99,9 +90,6 @@ class NewsController extends BaseController
return $this->renderView('pages/news/news.twig', ['news' => $news]); return $this->renderView('pages/news/news.twig', ['news' => $news]);
} }
/**
* @return Response
*/
public function comment(Request $request): Response public function comment(Request $request): Response
{ {
$newsId = (int)$request->getAttribute('news_id'); $newsId = (int)$request->getAttribute('news_id');
@ -131,10 +119,6 @@ class NewsController extends BaseController
return $this->redirect->back(); return $this->redirect->back();
} }
/**
*
* @return Response
*/
public function deleteComment(Request $request): Response public function deleteComment(Request $request): Response
{ {
$commentId = (int)$request->getAttribute('comment_id'); $commentId = (int)$request->getAttribute('comment_id');
@ -166,9 +150,6 @@ class NewsController extends BaseController
return $this->redirect->to('/news/' . $comment->news->id); return $this->redirect->to('/news/' . $comment->news->id);
} }
/**
* @return Response
*/
protected function showOverview(bool $onlyMeetings = false): Response protected function showOverview(bool $onlyMeetings = false): Response
{ {
$query = $this->news; $query = $this->news;
@ -203,7 +184,6 @@ class NewsController extends BaseController
/** /**
* @param array $data * @param array $data
* @return Response
*/ */
protected function renderView(string $page, array $data): Response protected function renderView(string $page, array $data): Response
{ {

View File

@ -69,10 +69,6 @@ class OAuthController extends BaseController
$this->url = $url; $this->url = $url;
} }
/**
*
* @return Response
*/
public function index(Request $request): Response public function index(Request $request): Response
{ {
$providerName = $request->getAttribute('provider'); $providerName = $request->getAttribute('provider');
@ -201,10 +197,6 @@ class OAuthController extends BaseController
return $response; return $response;
} }
/**
*
* @return Response
*/
public function connect(Request $request): Response public function connect(Request $request): Response
{ {
$providerName = $request->getAttribute('provider'); $providerName = $request->getAttribute('provider');
@ -216,10 +208,6 @@ class OAuthController extends BaseController
return $this->index($request); return $this->index($request);
} }
/**
*
* @return Response
*/
public function disconnect(Request $request): Response public function disconnect(Request $request): Response
{ {
$providerName = $request->getAttribute('provider'); $providerName = $request->getAttribute('provider');
@ -235,10 +223,6 @@ class OAuthController extends BaseController
return $this->redirector->back(); return $this->redirector->back();
} }
/**
*
* @return AbstractProvider
*/
protected function getProvider(string $name): AbstractProvider protected function getProvider(string $name): AbstractProvider
{ {
$this->requireProvider($name); $this->requireProvider($name);
@ -257,10 +241,7 @@ class OAuthController extends BaseController
); );
} }
/** protected function getId(string $providerName, ResourceOwner $resourceOwner): mixed
* @return mixed
*/
protected function getId(string $providerName, ResourceOwner $resourceOwner)
{ {
$config = $this->config->get('oauth')[$providerName]; $config = $this->config->get('oauth')[$providerName];
if (empty($config['nested_info'])) { if (empty($config['nested_info'])) {
@ -278,10 +259,6 @@ class OAuthController extends BaseController
} }
} }
/**
*
* @return bool
*/
protected function isValidProvider(string $name): bool protected function isValidProvider(string $name): bool
{ {
$config = $this->config->get('oauth'); $config = $this->config->get('oauth');
@ -339,7 +316,6 @@ class OAuthController extends BaseController
/** /**
* @param array $config * @param array $config
* *
* @return Response
*/ */
protected function redirectRegister( protected function redirectRegister(
string $providerName, string $providerName,

View File

@ -47,17 +47,11 @@ class PasswordResetController extends BaseController
$this->session = $session; $this->session = $session;
} }
/**
* @return Response
*/
public function reset(): Response public function reset(): Response
{ {
return $this->showView('pages/password/reset'); return $this->showView('pages/password/reset');
} }
/**
* @return Response
*/
public function postReset(Request $request): Response public function postReset(Request $request): Response
{ {
$data = $this->validate($request, [ $data = $this->validate($request, [
@ -88,9 +82,6 @@ class PasswordResetController extends BaseController
return $this->showView('pages/password/reset-success', ['type' => 'email']); return $this->showView('pages/password/reset-success', ['type' => 'email']);
} }
/**
* @return Response
*/
public function resetPassword(Request $request): Response public function resetPassword(Request $request): Response
{ {
$this->requireToken($request); $this->requireToken($request);
@ -101,9 +92,6 @@ class PasswordResetController extends BaseController
); );
} }
/**
* @return Response
*/
public function postResetPassword(Request $request): Response public function postResetPassword(Request $request): Response
{ {
$reset = $this->requireToken($request); $reset = $this->requireToken($request);
@ -127,7 +115,6 @@ class PasswordResetController extends BaseController
/** /**
* @param array $data * @param array $data
* @return Response
*/ */
protected function showView(string $view = 'pages/password/reset', array $data = []): 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 protected function requireToken(Request $request): PasswordReset
{ {
$token = $request->getAttribute('token'); $token = $request->getAttribute('token');

View File

@ -48,9 +48,6 @@ class QuestionsController extends BaseController
$this->response = $response; $this->response = $response;
} }
/**
* @return Response
*/
public function index(): Response public function index(): Response
{ {
$questions = $this->question $questions = $this->question
@ -65,9 +62,6 @@ class QuestionsController extends BaseController
); );
} }
/**
* @return Response
*/
public function add(): Response public function add(): Response
{ {
return $this->response->withView( return $this->response->withView(
@ -76,10 +70,6 @@ class QuestionsController extends BaseController
); );
} }
/**
*
* @return Response
*/
public function delete(Request $request): Response public function delete(Request $request): Response
{ {
$data = $this->validate( $data = $this->validate(
@ -103,10 +93,6 @@ class QuestionsController extends BaseController
return $this->redirect->to('/questions'); return $this->redirect->to('/questions');
} }
/**
*
* @return Response
*/
public function save(Request $request): Response public function save(Request $request): Response
{ {
$data = $this->validate( $data = $this->validate(

Some files were not shown because too many files have changed in this diff Show More