Added php-cs-fixer rule void_return

This commit is contained in:
Constantin Graf
2024-07-02 16:37:05 +02:00
committed by Gregor Vostrak
parent a820d8540f
commit 2e8da98287
51 changed files with 96 additions and 95 deletions

View File

@@ -82,7 +82,7 @@ class CreateNewUser implements CreatesNewUsers
} }
$user = null; $user = null;
$organization = null; $organization = null;
DB::transaction(function () use (&$user, &$organization, $input, $timezone, $startOfWeek, $currency) { DB::transaction(function () use (&$user, &$organization, $input, $timezone, $startOfWeek, $currency): void {
$user = User::create([ $user = User::create([
'name' => $input['name'], 'name' => $input['name'],
'email' => $input['email'], 'email' => $input['email'],

View File

@@ -38,7 +38,7 @@ class AddOrganizationMember implements AddsTeamMembers
AddingTeamMember::dispatch($organization, $newOrganizationMember); AddingTeamMember::dispatch($organization, $newOrganizationMember);
DB::transaction(function () use ($organization, $newOrganizationMember, $role) { DB::transaction(function () use ($organization, $newOrganizationMember, $role): void {
$organization->users()->attach( $organization->users()->attach(
$newOrganizationMember, ['role' => $role] $newOrganizationMember, ['role' => $role]
); );
@@ -93,7 +93,7 @@ class AddOrganizationMember implements AddsTeamMembers
*/ */
protected function ensureUserIsNotAlreadyOnTeam(Organization $team, string $email): Closure protected function ensureUserIsNotAlreadyOnTeam(Organization $team, string $email): Closure
{ {
return function ($validator) use ($team, $email) { return function ($validator) use ($team, $email): void {
$validator->errors()->addIf( $validator->errors()->addIf(
$team->hasRealUserWithEmail($email), $team->hasRealUserWithEmail($email),
'email', 'email',

View File

@@ -54,7 +54,7 @@ class TimeEntrySendStillRunningMailsCommand extends Command
$query->where('is_placeholder', '=', false); $query->where('is_placeholder', '=', false);
}) })
->orderBy('created_at', 'asc') ->orderBy('created_at', 'asc')
->chunk(500, function (Collection $timeEntries) use ($dryRun, &$sentMails) { ->chunk(500, function (Collection $timeEntries) use ($dryRun, &$sentMails): void {
/** @var Collection<int, TimeEntry> $timeEntries */ /** @var Collection<int, TimeEntry> $timeEntries */
foreach ($timeEntries as $timeEntry) { foreach ($timeEntries as $timeEntry) {
$user = $timeEntry->user; $user = $timeEntry->user;

View File

@@ -27,7 +27,7 @@ class Handler extends ExceptionHandler
*/ */
public function register(): void public function register(): void
{ {
$this->reportable(function (Throwable $e) { $this->reportable(function (Throwable $e): void {
// //
}); });
} }

View File

@@ -122,7 +122,7 @@ class OrganizationResource extends Resource
->persistent() ->persistent()
->send(); ->send();
return response()->streamDownload(function () use ($file) { return response()->streamDownload(function () use ($file): void {
echo Storage::disk(config('filesystems.private'))->get($file); echo Storage::disk(config('filesystems.private'))->get($file);
}, 'export.zip'); }, 'export.zip');
} catch (\Exception $exception) { } catch (\Exception $exception) {
@@ -137,7 +137,7 @@ class OrganizationResource extends Resource
}), }),
Action::make('Import') Action::make('Import')
->icon('heroicon-o-inbox-arrow-down') ->icon('heroicon-o-inbox-arrow-down')
->action(function (Organization $record, array $data) { ->action(function (Organization $record, array $data): void {
try { try {
$file = Storage::disk(config('filament.default_filesystem_disk'))->get($data['file']); $file = Storage::disk(config('filament.default_filesystem_disk'))->get($data['file']);
if ($file === null) { if ($file === null) {

View File

@@ -81,10 +81,10 @@ class AppServiceProvider extends ServiceProvider
}); });
// Scramble // Scramble
Scramble::extendOpenApi(function (OpenApi $openApi) { Scramble::extendOpenApi(function (OpenApi $openApi): void {
$openApi->secure( $openApi->secure(
SecurityScheme::oauth2() SecurityScheme::oauth2()
->flow('authorizationCode', function (OAuthFlow $flow) { ->flow('authorizationCode', function (OAuthFlow $flow): void {
$flow $flow
->authorizationUrl('https://solidtime.test/oauth/authorize'); ->authorizationUrl('https://solidtime.test/oauth/authorize');
}) })

View File

@@ -37,9 +37,9 @@ class RouteServiceProvider extends ServiceProvider
: Limit::perMinute(60)->by($request->ip()); : Limit::perMinute(60)->by($request->ip());
}); });
$this->routes(function () { $this->routes(function (): void {
Route::middleware('health-check') Route::middleware('health-check')
->group(function () { ->group(function (): void {
Route::get('health-check/up', [HealthCheckController::class, 'up']); Route::get('health-check/up', [HealthCheckController::class, 'up']);
Route::get('health-check/debug', [HealthCheckController::class, 'debug']); Route::get('health-check/debug', [HealthCheckController::class, 'debug']);
}); });

View File

@@ -28,9 +28,9 @@ class BillableRateService
->where('billable', '=', true) ->where('billable', '=', true)
->where('organization_id', '=', $project->organization_id) ->where('organization_id', '=', $project->organization_id)
->whereBelongsTo($project, 'project') ->whereBelongsTo($project, 'project')
->whereDoesntHave('member', function (Builder $query) use ($project) { ->whereDoesntHave('member', function (Builder $query) use ($project): void {
/** @var Builder<Member> $query */ /** @var Builder<Member> $query */
$query->whereHas('projectMembers', function (Builder $query) use ($project) { $query->whereHas('projectMembers', function (Builder $query) use ($project): void {
/** @var Builder<ProjectMember> $query */ /** @var Builder<ProjectMember> $query */
$query->whereBelongsTo($project, 'project') $query->whereBelongsTo($project, 'project')
->whereNotNull('billable_rate'); ->whereNotNull('billable_rate');
@@ -62,7 +62,7 @@ class BillableRateService
TimeEntry::query() TimeEntry::query()
->where('billable', '=', true) ->where('billable', '=', true)
->where('organization_id', '=', $organization->getKey()) ->where('organization_id', '=', $organization->getKey())
->whereDoesntHave('member', function (Builder $builder) { ->whereDoesntHave('member', function (Builder $builder): void {
/** @var Builder<Member> $builder */ /** @var Builder<Member> $builder */
$builder->whereNotNull('billable_rate'); $builder->whereNotNull('billable_rate');
}) })

View File

@@ -35,7 +35,7 @@ class DeletionService
public function deleteOrganization(Organization $organization, bool $inTransaction = true, ?User $ignoreUser = null): void public function deleteOrganization(Organization $organization, bool $inTransaction = true, ?User $ignoreUser = null): void
{ {
if ($inTransaction) { if ($inTransaction) {
DB::transaction(function () use ($organization) { DB::transaction(function () use ($organization): void {
$this->deleteOrganization($organization, false); $this->deleteOrganization($organization, false);
}); });
@@ -123,7 +123,7 @@ class DeletionService
public function deleteUser(User $user, bool $inTransaction = true): void public function deleteUser(User $user, bool $inTransaction = true): void
{ {
if ($inTransaction) { if ($inTransaction) {
DB::transaction(function () use ($user) { DB::transaction(function () use ($user): void {
$this->deleteUser($user, false); $this->deleteUser($user, false);
}); });

View File

@@ -31,7 +31,7 @@ class ImportService
$lock = Cache::lock('import:'.$organization->getKey(), config('octane.max_execution_time', 60) + 1); $lock = Cache::lock('import:'.$organization->getKey(), config('octane.max_execution_time', 60) + 1);
if ($lock->get()) { if ($lock->get()) {
DB::transaction(function () use (&$importer, &$data, &$timezone) { DB::transaction(function () use (&$importer, &$data, &$timezone): void {
$importer->importData($data, $timezone); $importer->importData($data, $timezone);
}); });
$lock->release(); $lock->release();

View File

@@ -113,7 +113,7 @@ abstract class DefaultImporter implements ImporterContract
'nullable', 'nullable',
'integer', 'integer',
], ],
], beforeSave: function (Project $project) { ], beforeSave: function (Project $project): void {
if ($project->billable_rate === 0) { if ($project->billable_rate === 0) {
$project->billable_rate = null; $project->billable_rate = null;
} }
@@ -126,7 +126,7 @@ abstract class DefaultImporter implements ImporterContract
'nullable', 'nullable',
'integer', 'integer',
], ],
], beforeSave: function (ProjectMember $projectMember) { ], beforeSave: function (ProjectMember $projectMember): void {
if ($projectMember->billable_rate === 0) { if ($projectMember->billable_rate === 0) {
$projectMember->billable_rate = null; $projectMember->billable_rate = null;
} }

View File

@@ -85,7 +85,7 @@ class MemberFactory extends Factory
public function attachToOrganization(Organization $organization, array $pivot = []): static public function attachToOrganization(Organization $organization, array $pivot = []): static
{ {
return $this->afterCreating(function (User $user) use ($organization, $pivot) { return $this->afterCreating(function (User $user) use ($organization, $pivot): void {
$user->organizations()->attach($organization, $pivot); $user->organizations()->attach($organization, $pivot);
}); });
} }

View File

@@ -82,7 +82,7 @@ class UserFactory extends Factory
public function attachToOrganization(Organization $organization, array $pivot = []): static public function attachToOrganization(Organization $organization, array $pivot = []): static
{ {
return $this->afterCreating(function (User $user) use ($organization, $pivot) { return $this->afterCreating(function (User $user) use ($organization, $pivot): void {
$user->organizations()->attach($organization, $pivot); $user->organizations()->attach($organization, $pivot);
}); });
} }

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('name'); $table->string('name');
$table->string('email'); $table->string('email');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('password_reset_tokens', function (Blueprint $table) { Schema::create('password_reset_tokens', function (Blueprint $table): void {
$table->string('email')->primary(); $table->string('email')->primary();
$table->string('token'); $table->string('token');
$table->timestamp('created_at')->nullable(); $table->timestamp('created_at')->nullable();

View File

@@ -14,7 +14,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table): void {
$table->text('two_factor_secret') $table->text('two_factor_secret')
->after('password') ->after('password')
->nullable(); ->nullable();
@@ -36,7 +36,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table): void {
$table->dropColumn(array_merge([ $table->dropColumn(array_merge([
'two_factor_secret', 'two_factor_secret',
'two_factor_recovery_codes', 'two_factor_recovery_codes',

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('oauth_auth_codes', function (Blueprint $table) { Schema::create('oauth_auth_codes', function (Blueprint $table): void {
$table->string('id', 100)->primary(); $table->string('id', 100)->primary();
$table->foreignUuid('user_id')->index(); $table->foreignUuid('user_id')->index();
$table->uuid('client_id'); $table->uuid('client_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('oauth_access_tokens', function (Blueprint $table) { Schema::create('oauth_access_tokens', function (Blueprint $table): void {
$table->string('id', 100)->primary(); $table->string('id', 100)->primary();
$table->foreignUuid('user_id')->nullable()->index(); $table->foreignUuid('user_id')->nullable()->index();
$table->uuid('client_id'); $table->uuid('client_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('oauth_refresh_tokens', function (Blueprint $table) { Schema::create('oauth_refresh_tokens', function (Blueprint $table): void {
$table->string('id', 100)->primary(); $table->string('id', 100)->primary();
$table->string('access_token_id', 100)->index(); $table->string('access_token_id', 100)->index();
$table->boolean('revoked'); $table->boolean('revoked');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('oauth_clients', function (Blueprint $table) { Schema::create('oauth_clients', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('user_id')->nullable()->index(); $table->foreignUuid('user_id')->nullable()->index();
$table->string('name'); $table->string('name');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('oauth_personal_access_clients', function (Blueprint $table) { Schema::create('oauth_personal_access_clients', function (Blueprint $table): void {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->uuid('client_id'); $table->uuid('client_id');
$table->timestamps(); $table->timestamps();

View File

@@ -26,7 +26,7 @@ return new class extends Migration
} }
$schema = Schema::connection($this->getConnection()); $schema = Schema::connection($this->getConnection());
$schema->create('telescope_entries', function (Blueprint $table) { $schema->create('telescope_entries', function (Blueprint $table): void {
$table->bigIncrements('sequence'); $table->bigIncrements('sequence');
$table->uuid('uuid'); $table->uuid('uuid');
$table->uuid('batch_id'); $table->uuid('batch_id');
@@ -43,7 +43,7 @@ return new class extends Migration
$table->index(['type', 'should_display_on_index']); $table->index(['type', 'should_display_on_index']);
}); });
$schema->create('telescope_entries_tags', function (Blueprint $table) { $schema->create('telescope_entries_tags', function (Blueprint $table): void {
$table->uuid('entry_uuid'); $table->uuid('entry_uuid');
$table->string('tag'); $table->string('tag');
@@ -56,7 +56,7 @@ return new class extends Migration
->onDelete('cascade'); ->onDelete('cascade');
}); });
$schema->create('telescope_monitoring', function (Blueprint $table) { $schema->create('telescope_monitoring', function (Blueprint $table): void {
$table->string('tag')->primary(); $table->string('tag')->primary();
}); });
} }

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('failed_jobs', function (Blueprint $table) { Schema::create('failed_jobs', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->uuid('uuid')->unique(); $table->uuid('uuid')->unique();
$table->text('connection'); $table->text('connection');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('personal_access_tokens', function (Blueprint $table) { Schema::create('personal_access_tokens', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->morphs('tokenable'); $table->morphs('tokenable');
$table->string('name'); $table->string('name');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('organizations', function (Blueprint $table) { Schema::create('organizations', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('user_id')->index(); $table->foreignUuid('user_id')->index();
$table->string('name'); $table->string('name');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('organization_user', function (Blueprint $table) { Schema::create('organization_user', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('organization_id'); $table->foreignUuid('organization_id');
$table->foreignUuid('user_id'); $table->foreignUuid('user_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('organization_invitations', function (Blueprint $table) { Schema::create('organization_invitations', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('organization_id') $table->foreignUuid('organization_id')
->constrained() ->constrained()

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('sessions', function (Blueprint $table) { Schema::create('sessions', function (Blueprint $table): void {
$table->string('id')->primary(); $table->string('id')->primary();
$table->foreignUuid('user_id')->nullable()->index(); $table->foreignUuid('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable(); $table->string('ip_address', 45)->nullable();

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('clients', function (Blueprint $table) { Schema::create('clients', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('name', 255); $table->string('name', 255);
$table->uuid('organization_id'); $table->uuid('organization_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('projects', function (Blueprint $table) { Schema::create('projects', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('name', 255); $table->string('name', 255);
$table->string('color', 16); $table->string('color', 16);

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('tasks', function (Blueprint $table) { Schema::create('tasks', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('name', 500); $table->string('name', 500);
$table->uuid('project_id'); $table->uuid('project_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('tags', function (Blueprint $table) { Schema::create('tags', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('name', 255); $table->string('name', 255);
$table->uuid('organization_id'); $table->uuid('organization_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('time_entries', function (Blueprint $table) { Schema::create('time_entries', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->string('description', 500); $table->string('description', 500);
$table->dateTime('start'); $table->dateTime('start');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('project_members', function (Blueprint $table) { Schema::create('project_members', function (Blueprint $table): void {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->integer('billable_rate')->unsigned()->nullable(); $table->integer('billable_rate')->unsigned()->nullable();
$table->uuid('project_id'); $table->uuid('project_id');

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('jobs', function (Blueprint $table) { Schema::create('jobs', function (Blueprint $table): void {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->string('queue')->index(); $table->string('queue')->index();
$table->longText('payload'); $table->longText('payload');

View File

@@ -13,13 +13,13 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('cache', function (Blueprint $table) { Schema::create('cache', function (Blueprint $table): void {
$table->string('key')->primary(); $table->string('key')->primary();
$table->mediumText('value'); $table->mediumText('value');
$table->integer('expiration'); $table->integer('expiration');
}); });
Schema::create('cache_locks', function (Blueprint $table) { Schema::create('cache_locks', function (Blueprint $table): void {
$table->string('key')->primary(); $table->string('key')->primary();
$table->string('owner'); $table->string('owner');
$table->integer('expiration'); $table->integer('expiration');

View File

@@ -14,7 +14,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->foreignUuid('client_id') $table->foreignUuid('client_id')
->nullable() ->nullable()
->constrained('clients') ->constrained('clients')
@@ -35,7 +35,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dropForeign(['client_id']); $table->dropForeign(['client_id']);
$table->dropColumn('client_id'); $table->dropColumn('client_id');
}); });

View File

@@ -14,7 +14,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('projects', function (Blueprint $table) { Schema::table('projects', function (Blueprint $table): void {
$table->boolean('is_billable')->default(false); $table->boolean('is_billable')->default(false);
}); });
DB::statement(' DB::statement('
@@ -22,7 +22,7 @@ return new class extends Migration
set is_billable = true set is_billable = true
where projects.billable_rate is not null and projects.billable_rate > 0 where projects.billable_rate is not null and projects.billable_rate > 0
'); ');
Schema::table('projects', function (Blueprint $table) { Schema::table('projects', function (Blueprint $table): void {
$table->boolean('is_billable')->default(null)->change(); $table->boolean('is_billable')->default(null)->change();
}); });
} }
@@ -32,7 +32,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('projects', function (Blueprint $table) { Schema::table('projects', function (Blueprint $table): void {
$table->dropColumn('is_billable'); $table->dropColumn('is_billable');
}); });
} }

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->boolean('is_imported')->default(false); $table->boolean('is_imported')->default(false);
}); });
} }
@@ -23,7 +23,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dropColumn('is_imported'); $table->dropColumn('is_imported');
}); });
} }

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dropForeign(['member_id']); $table->dropForeign(['member_id']);
$table->foreign('member_id') $table->foreign('member_id')
->references('id') ->references('id')
@@ -27,7 +27,7 @@ return new class extends Migration
->restrictOnDelete() ->restrictOnDelete()
->cascadeOnUpdate(); ->cascadeOnUpdate();
}); });
Schema::table('project_members', function (Blueprint $table) { Schema::table('project_members', function (Blueprint $table): void {
$table->dropForeign(['member_id']); $table->dropForeign(['member_id']);
$table->foreign('member_id') $table->foreign('member_id')
->references('id') ->references('id')
@@ -35,7 +35,7 @@ return new class extends Migration
->restrictOnDelete() ->restrictOnDelete()
->cascadeOnUpdate(); ->cascadeOnUpdate();
}); });
Schema::table('organization_invitations', function (Blueprint $table) { Schema::table('organization_invitations', function (Blueprint $table): void {
$table->dropForeign(['organization_id']); $table->dropForeign(['organization_id']);
$table->foreign('organization_id') $table->foreign('organization_id')
->references('id') ->references('id')
@@ -50,7 +50,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dropForeign(['member_id']); $table->dropForeign(['member_id']);
$table->foreign('member_id') $table->foreign('member_id')
->references('id') ->references('id')
@@ -64,7 +64,7 @@ return new class extends Migration
->cascadeOnDelete() ->cascadeOnDelete()
->cascadeOnUpdate(); ->cascadeOnUpdate();
}); });
Schema::table('project_members', function (Blueprint $table) { Schema::table('project_members', function (Blueprint $table): void {
$table->dropForeign(['member_id']); $table->dropForeign(['member_id']);
$table->foreign('member_id') $table->foreign('member_id')
->references('id') ->references('id')
@@ -72,7 +72,7 @@ return new class extends Migration
->cascadeOnDelete() ->cascadeOnDelete()
->cascadeOnUpdate(); ->cascadeOnUpdate();
}); });
Schema::table('organization_invitations', function (Blueprint $table) { Schema::table('organization_invitations', function (Blueprint $table): void {
$table->dropForeign(['organization_id']); $table->dropForeign(['organization_id']);
$table->foreign('organization_id') $table->foreign('organization_id')
->references('id') ->references('id')

View File

@@ -13,7 +13,7 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dateTime('still_active_email_sent_at')->nullable(); $table->dateTime('still_active_email_sent_at')->nullable();
}); });
} }
@@ -23,7 +23,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::table('time_entries', function (Blueprint $table) { Schema::table('time_entries', function (Blueprint $table): void {
$table->dropColumn('still_active_email_sent_at'); $table->dropColumn('still_active_email_sent_at');
}); });
} }

View File

@@ -16,7 +16,7 @@ class CreateAuditsTable extends Migration
$connection = config('audit.drivers.database.connection', config('database.default')); $connection = config('audit.drivers.database.connection', config('database.default'));
$table = config('audit.drivers.database.table', 'audits'); $table = config('audit.drivers.database.table', 'audits');
Schema::connection($connection)->create($table, function (Blueprint $table) { Schema::connection($connection)->create($table, function (Blueprint $table): void {
$morphPrefix = config('audit.user.morph_prefix', 'user'); $morphPrefix = config('audit.user.morph_prefix', 'user');

View File

@@ -4,6 +4,7 @@
"declare_strict_types": true, "declare_strict_types": true,
"strict_comparison": true, "strict_comparison": true,
"strict_param": true, "strict_param": true,
"no_unused_imports": true "no_unused_imports": true,
"void_return": true
} }
} }

View File

@@ -33,15 +33,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
Route::middleware([ Route::middleware([
'auth:api', 'auth:api',
'verified', 'verified',
])->prefix('v1')->name('v1.')->group(static function () { ])->prefix('v1')->name('v1.')->group(static function (): void {
// Organization routes // Organization routes
Route::name('organizations.')->group(static function () { Route::name('organizations.')->group(static function (): void {
Route::get('/organizations/{organization}', [OrganizationController::class, 'show'])->name('show'); Route::get('/organizations/{organization}', [OrganizationController::class, 'show'])->name('show');
Route::put('/organizations/{organization}', [OrganizationController::class, 'update'])->name('update')->middleware('check-organization-blocked'); Route::put('/organizations/{organization}', [OrganizationController::class, 'update'])->name('update')->middleware('check-organization-blocked');
}); });
// Member routes // Member routes
Route::name('members.')->group(static function () { Route::name('members.')->group(static function (): void {
Route::get('/organizations/{organization}/members', [MemberController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/members', [MemberController::class, 'index'])->name('index');
Route::put('/organizations/{organization}/members/{member}', [MemberController::class, 'update'])->name('update'); Route::put('/organizations/{organization}/members/{member}', [MemberController::class, 'update'])->name('update');
Route::delete('/organizations/{organization}/members/{member}', [MemberController::class, 'destroy'])->name('destroy'); Route::delete('/organizations/{organization}/members/{member}', [MemberController::class, 'destroy'])->name('destroy');
@@ -50,17 +50,17 @@ Route::middleware([
}); });
// User routes // User routes
Route::name('users.')->group(static function () { Route::name('users.')->group(static function (): void {
Route::get('/users/me', [UserController::class, 'me'])->name('me'); Route::get('/users/me', [UserController::class, 'me'])->name('me');
}); });
// User Member routes // User Member routes
Route::name('users.memberships.')->group(static function () { Route::name('users.memberships.')->group(static function (): void {
Route::get('/users/me/memberships', [UserMembershipController::class, 'myMemberships'])->name('my-memberships'); Route::get('/users/me/memberships', [UserMembershipController::class, 'myMemberships'])->name('my-memberships');
}); });
// Invitation routes // Invitation routes
Route::name('invitations.')->group(static function () { Route::name('invitations.')->group(static function (): void {
Route::get('/organizations/{organization}/invitations', [InvitationController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/invitations', [InvitationController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/invitations', [InvitationController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/invitations', [InvitationController::class, 'store'])->name('store')->middleware('check-organization-blocked');
Route::post('/organizations/{organization}/invitations/{invitation}/resend', [InvitationController::class, 'resend'])->name('resend')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/invitations/{invitation}/resend', [InvitationController::class, 'resend'])->name('resend')->middleware('check-organization-blocked');
@@ -68,7 +68,7 @@ Route::middleware([
}); });
// Project routes // Project routes
Route::name('projects.')->group(static function () { Route::name('projects.')->group(static function (): void {
Route::get('/organizations/{organization}/projects', [ProjectController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/projects', [ProjectController::class, 'index'])->name('index');
Route::get('/organizations/{organization}/projects/{project}', [ProjectController::class, 'show'])->name('show'); Route::get('/organizations/{organization}/projects/{project}', [ProjectController::class, 'show'])->name('show');
Route::post('/organizations/{organization}/projects', [ProjectController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/projects', [ProjectController::class, 'store'])->name('store')->middleware('check-organization-blocked');
@@ -77,7 +77,7 @@ Route::middleware([
}); });
// Project member routes // Project member routes
Route::name('project-members.')->group(static function () { Route::name('project-members.')->group(static function (): void {
Route::get('/organizations/{organization}/projects/{project}/project-members', [ProjectMemberController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/projects/{project}/project-members', [ProjectMemberController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/projects/{project}/project-members', [ProjectMemberController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/projects/{project}/project-members', [ProjectMemberController::class, 'store'])->name('store')->middleware('check-organization-blocked');
Route::put('/organizations/{organization}/project-members/{projectMember}', [ProjectMemberController::class, 'update'])->name('update')->middleware('check-organization-blocked'); Route::put('/organizations/{organization}/project-members/{projectMember}', [ProjectMemberController::class, 'update'])->name('update')->middleware('check-organization-blocked');
@@ -85,7 +85,7 @@ Route::middleware([
}); });
// Time entry routes // Time entry routes
Route::name('time-entries.')->group(static function () { Route::name('time-entries.')->group(static function (): void {
Route::get('/organizations/{organization}/time-entries', [TimeEntryController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/time-entries', [TimeEntryController::class, 'index'])->name('index');
Route::get('/organizations/{organization}/time-entries/aggregate', [TimeEntryController::class, 'aggregate'])->name('aggregate'); Route::get('/organizations/{organization}/time-entries/aggregate', [TimeEntryController::class, 'aggregate'])->name('aggregate');
Route::post('/organizations/{organization}/time-entries', [TimeEntryController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/time-entries', [TimeEntryController::class, 'store'])->name('store')->middleware('check-organization-blocked');
@@ -94,12 +94,12 @@ Route::middleware([
Route::delete('/organizations/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'destroy'])->name('destroy'); Route::delete('/organizations/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'destroy'])->name('destroy');
}); });
Route::name('users.time-entries.')->group(static function () { Route::name('users.time-entries.')->group(static function (): void {
Route::get('/users/me/time-entries/active', [UserTimeEntryController::class, 'myActive'])->name('my-active'); Route::get('/users/me/time-entries/active', [UserTimeEntryController::class, 'myActive'])->name('my-active');
}); });
// Tag routes // Tag routes
Route::name('tags.')->group(static function () { Route::name('tags.')->group(static function (): void {
Route::get('/organizations/{organization}/tags', [TagController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/tags', [TagController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/tags', [TagController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/tags', [TagController::class, 'store'])->name('store')->middleware('check-organization-blocked');
Route::put('/organizations/{organization}/tags/{tag}', [TagController::class, 'update'])->name('update')->middleware('check-organization-blocked'); Route::put('/organizations/{organization}/tags/{tag}', [TagController::class, 'update'])->name('update')->middleware('check-organization-blocked');
@@ -107,7 +107,7 @@ Route::middleware([
}); });
// Client routes // Client routes
Route::name('clients.')->group(static function () { Route::name('clients.')->group(static function (): void {
Route::get('/organizations/{organization}/clients', [ClientController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/clients', [ClientController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/clients', [ClientController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/clients', [ClientController::class, 'store'])->name('store')->middleware('check-organization-blocked');
Route::put('/organizations/{organization}/clients/{client}', [ClientController::class, 'update'])->name('update')->middleware('check-organization-blocked'); Route::put('/organizations/{organization}/clients/{client}', [ClientController::class, 'update'])->name('update')->middleware('check-organization-blocked');
@@ -115,7 +115,7 @@ Route::middleware([
}); });
// Task routes // Task routes
Route::name('tasks.')->group(static function () { Route::name('tasks.')->group(static function (): void {
Route::get('/organizations/{organization}/tasks', [TaskController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/tasks', [TaskController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/tasks', [TaskController::class, 'store'])->name('store')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/tasks', [TaskController::class, 'store'])->name('store')->middleware('check-organization-blocked');
Route::put('/organizations/{organization}/tasks/{task}', [TaskController::class, 'update'])->name('update')->middleware('check-organization-blocked'); Route::put('/organizations/{organization}/tasks/{task}', [TaskController::class, 'update'])->name('update')->middleware('check-organization-blocked');
@@ -123,13 +123,13 @@ Route::middleware([
}); });
// Import routes // Import routes
Route::name('import.')->group(static function () { Route::name('import.')->group(static function (): void {
Route::get('/organizations/{organization}/importers', [ImportController::class, 'index'])->name('index'); Route::get('/organizations/{organization}/importers', [ImportController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/import', [ImportController::class, 'import'])->name('import')->middleware('check-organization-blocked'); Route::post('/organizations/{organization}/import', [ImportController::class, 'import'])->name('import')->middleware('check-organization-blocked');
}); });
// Export routes // Export routes
Route::name('export.')->prefix('/organizations/{organization}')->group(static function () { Route::name('export.')->prefix('/organizations/{organization}')->group(static function (): void {
Route::post('/export', [ExportController::class, 'export'])->name('export'); Route::post('/export', [ExportController::class, 'export'])->name('export');
}); });
}); });

View File

@@ -25,7 +25,7 @@ Route::middleware([
'auth:web', 'auth:web',
config('jetstream.auth_session'), config('jetstream.auth_session'),
'verified', 'verified',
])->group(function () { ])->group(function (): void {
Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard'); Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');
Route::get('/time', function () { Route::get('/time', function () {

View File

@@ -112,7 +112,7 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_currency_and_start_of_week(): void public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_currency_and_start_of_week(): void
{ {
// Arrange // Arrange
$this->mock(IpLookupServiceContract::class, function ($mock) { $this->mock(IpLookupServiceContract::class, function ($mock): void {
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto( $mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
'America/New_York', 'America/New_York',
Weekday::Sunday, Weekday::Sunday,
@@ -143,7 +143,7 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_timezone_if_client_did_not_send_one(): void public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_timezone_if_client_did_not_send_one(): void
{ {
// Arrange // Arrange
$this->mock(IpLookupServiceContract::class, function ($mock) { $this->mock(IpLookupServiceContract::class, function ($mock): void {
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto( $mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
'America/New_York', 'America/New_York',
Weekday::Sunday, Weekday::Sunday,
@@ -174,7 +174,7 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_timezone_if_client_sends_invalid_one(): void public function test_new_users_can_register_and_uses_ip_lookup_service_to_get_information_about_timezone_if_client_sends_invalid_one(): void
{ {
// Arrange // Arrange
$this->mock(IpLookupServiceContract::class, function ($mock) { $this->mock(IpLookupServiceContract::class, function ($mock): void {
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto( $mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
'America/New_York', 'America/New_York',
Weekday::Sunday, Weekday::Sunday,
@@ -205,7 +205,7 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register_and_legacy_timezone_from_client_is_mapped_to_new_timezone(): void public function test_new_users_can_register_and_legacy_timezone_from_client_is_mapped_to_new_timezone(): void
{ {
// Arrange // Arrange
$this->mock(IpLookupServiceContract::class, function ($mock) { $this->mock(IpLookupServiceContract::class, function ($mock): void {
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto( $mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
'America/New_York', 'America/New_York',
Weekday::Sunday, Weekday::Sunday,

View File

@@ -25,7 +25,7 @@ abstract class TestCase extends BaseTestCase
parent::setUp(); parent::setUp();
Mail::fake(); Mail::fake();
LogFake::bind(); LogFake::bind();
$this->mock(BillingContract::class, function (MockInterface $mock) { $this->mock(BillingContract::class, function (MockInterface $mock): void {
$mock->shouldReceive('hasSubscription')->andReturn(false); $mock->shouldReceive('hasSubscription')->andReturn(false);
$mock->shouldReceive('hasTrial')->andReturn(false); $mock->shouldReceive('hasTrial')->andReturn(false);
$mock->shouldReceive('getTrialUntil')->andReturn(null); $mock->shouldReceive('getTrialUntil')->andReturn(null);

View File

@@ -16,7 +16,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
#[UsesClass(ImportController::class)] #[UsesClass(ImportController::class)]
class ImportEndpointTest extends ApiEndpointTestAbstract class ImportEndpointTest extends ApiEndpointTestAbstract
{ {
public function test_index_fails_if_user_does_not_have_permission() public function test_index_fails_if_user_does_not_have_permission(): void
{ {
// Arrange // Arrange
$data = $this->createUserWithPermission(); $data = $this->createUserWithPermission();
@@ -30,7 +30,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
$response->assertForbidden(); $response->assertForbidden();
} }
public function test_index_returns_importers_if_user_has_permission() public function test_index_returns_importers_if_user_has_permission(): void
{ {
// Arrange // Arrange
$data = $this->createUserWithPermission([ $data = $this->createUserWithPermission([
@@ -58,7 +58,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
$this->assertSame(__('importer.toggl_time_entries.description'), $toggleTimeEntries['description']); $this->assertSame(__('importer.toggl_time_entries.description'), $toggleTimeEntries['description']);
} }
public function test_import_fails_if_user_does_not_have_permission() public function test_import_fails_if_user_does_not_have_permission(): void
{ {
// Arrange // Arrange
$data = $this->createUserWithPermission(); $data = $this->createUserWithPermission();

View File

@@ -118,7 +118,7 @@ class MemberEndpointTest extends ApiEndpointTestAbstract
$data = $this->createUserWithPermission([ $data = $this->createUserWithPermission([
'members:update', 'members:update',
]); ]);
$this->mock(BillableRateService::class, function (MockInterface $mock) use ($data) { $this->mock(BillableRateService::class, function (MockInterface $mock) use ($data): void {
$mock->shouldReceive('updateTimeEntriesBillableRateForMember') $mock->shouldReceive('updateTimeEntriesBillableRateForMember')
->once() ->once()
->withArgs(fn (Member $memberArg) => $memberArg->is($data->member) && $memberArg->billable_rate === 10001); ->withArgs(fn (Member $memberArg) => $memberArg->is($data->member) && $memberArg->billable_rate === 10001);

View File

@@ -131,7 +131,7 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
]); ]);
$billableRate = 111; $billableRate = 111;
$organizationFake = Organization::factory()->billableRate($billableRate)->make(); $organizationFake = Organization::factory()->billableRate($billableRate)->make();
$this->mock(BillableRateService::class, function (MockInterface $mock) use ($data, $billableRate) { $this->mock(BillableRateService::class, function (MockInterface $mock) use ($data, $billableRate): void {
$mock->shouldReceive('updateTimeEntriesBillableRateForOrganization') $mock->shouldReceive('updateTimeEntriesBillableRateForOrganization')
->once() ->once()
->withArgs(fn (Organization $organization) => $organization->is($data->organization) && $organization->billable_rate === $billableRate); ->withArgs(fn (Organization $organization) => $organization->is($data->organization) && $organization->billable_rate === $billableRate);

View File

@@ -42,7 +42,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
// Arrange // Arrange
$user = $this->createUserWithPermission(); $user = $this->createUserWithPermission();
$this->createTestRoute(); $this->createTestRoute();
$this->mock(BillingContract::class, function (MockInterface $mock) { $this->mock(BillingContract::class, function (MockInterface $mock): void {
$mock->shouldReceive('isBlocked')->andReturn(true)->once(); $mock->shouldReceive('isBlocked')->andReturn(true)->once();
}); });
Passport::actingAs($user->user); Passport::actingAs($user->user);
@@ -60,7 +60,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
// Arrange // Arrange
$user = $this->createUserWithPermission(); $user = $this->createUserWithPermission();
$this->createTestRoute(); $this->createTestRoute();
$this->mock(BillingContract::class, function (MockInterface $mock) { $this->mock(BillingContract::class, function (MockInterface $mock): void {
$mock->shouldReceive('isBlocked')->never(); $mock->shouldReceive('isBlocked')->never();
}); });
Passport::actingAs($user->user); Passport::actingAs($user->user);
@@ -77,7 +77,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
// Arrange // Arrange
$user = $this->createUserWithPermission(); $user = $this->createUserWithPermission();
$route = $this->createTestRouteNoModelBinding(); $route = $this->createTestRouteNoModelBinding();
$this->mock(BillingContract::class, function (MockInterface $mock) { $this->mock(BillingContract::class, function (MockInterface $mock): void {
$mock->shouldReceive('isBlocked')->never(); $mock->shouldReceive('isBlocked')->never();
}); });
Passport::actingAs($user->user); Passport::actingAs($user->user);
@@ -94,7 +94,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
// Arrange // Arrange
$user = $this->createUserWithPermission(); $user = $this->createUserWithPermission();
$this->createTestRoute(); $this->createTestRoute();
$this->mock(BillingContract::class, function (MockInterface $mock) { $this->mock(BillingContract::class, function (MockInterface $mock): void {
$mock->shouldReceive('isBlocked')->andReturn(false)->once(); $mock->shouldReceive('isBlocked')->andReturn(false)->once();
}); });
Passport::actingAs($user->user); Passport::actingAs($user->user);