mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-05-07 20:32:26 +00:00
Added php-cs-fixer rule void_return
This commit is contained in:
committed by
Gregor Vostrak
parent
a820d8540f
commit
2e8da98287
@@ -82,7 +82,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
}
|
||||
$user = 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([
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
|
||||
@@ -38,7 +38,7 @@ class AddOrganizationMember implements AddsTeamMembers
|
||||
|
||||
AddingTeamMember::dispatch($organization, $newOrganizationMember);
|
||||
|
||||
DB::transaction(function () use ($organization, $newOrganizationMember, $role) {
|
||||
DB::transaction(function () use ($organization, $newOrganizationMember, $role): void {
|
||||
$organization->users()->attach(
|
||||
$newOrganizationMember, ['role' => $role]
|
||||
);
|
||||
@@ -93,7 +93,7 @@ class AddOrganizationMember implements AddsTeamMembers
|
||||
*/
|
||||
protected function ensureUserIsNotAlreadyOnTeam(Organization $team, string $email): Closure
|
||||
{
|
||||
return function ($validator) use ($team, $email) {
|
||||
return function ($validator) use ($team, $email): void {
|
||||
$validator->errors()->addIf(
|
||||
$team->hasRealUserWithEmail($email),
|
||||
'email',
|
||||
|
||||
@@ -54,7 +54,7 @@ class TimeEntrySendStillRunningMailsCommand extends Command
|
||||
$query->where('is_placeholder', '=', false);
|
||||
})
|
||||
->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 */
|
||||
foreach ($timeEntries as $timeEntry) {
|
||||
$user = $timeEntry->user;
|
||||
|
||||
@@ -27,7 +27,7 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
$this->reportable(function (Throwable $e): void {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class OrganizationResource extends Resource
|
||||
->persistent()
|
||||
->send();
|
||||
|
||||
return response()->streamDownload(function () use ($file) {
|
||||
return response()->streamDownload(function () use ($file): void {
|
||||
echo Storage::disk(config('filesystems.private'))->get($file);
|
||||
}, 'export.zip');
|
||||
} catch (\Exception $exception) {
|
||||
@@ -137,7 +137,7 @@ class OrganizationResource extends Resource
|
||||
}),
|
||||
Action::make('Import')
|
||||
->icon('heroicon-o-inbox-arrow-down')
|
||||
->action(function (Organization $record, array $data) {
|
||||
->action(function (Organization $record, array $data): void {
|
||||
try {
|
||||
$file = Storage::disk(config('filament.default_filesystem_disk'))->get($data['file']);
|
||||
if ($file === null) {
|
||||
|
||||
@@ -81,10 +81,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
// Scramble
|
||||
Scramble::extendOpenApi(function (OpenApi $openApi) {
|
||||
Scramble::extendOpenApi(function (OpenApi $openApi): void {
|
||||
$openApi->secure(
|
||||
SecurityScheme::oauth2()
|
||||
->flow('authorizationCode', function (OAuthFlow $flow) {
|
||||
->flow('authorizationCode', function (OAuthFlow $flow): void {
|
||||
$flow
|
||||
->authorizationUrl('https://solidtime.test/oauth/authorize');
|
||||
})
|
||||
|
||||
@@ -37,9 +37,9 @@ class RouteServiceProvider extends ServiceProvider
|
||||
: Limit::perMinute(60)->by($request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
$this->routes(function (): void {
|
||||
Route::middleware('health-check')
|
||||
->group(function () {
|
||||
->group(function (): void {
|
||||
Route::get('health-check/up', [HealthCheckController::class, 'up']);
|
||||
Route::get('health-check/debug', [HealthCheckController::class, 'debug']);
|
||||
});
|
||||
|
||||
@@ -28,9 +28,9 @@ class BillableRateService
|
||||
->where('billable', '=', true)
|
||||
->where('organization_id', '=', $project->organization_id)
|
||||
->whereBelongsTo($project, 'project')
|
||||
->whereDoesntHave('member', function (Builder $query) use ($project) {
|
||||
->whereDoesntHave('member', function (Builder $query) use ($project): void {
|
||||
/** @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 */
|
||||
$query->whereBelongsTo($project, 'project')
|
||||
->whereNotNull('billable_rate');
|
||||
@@ -62,7 +62,7 @@ class BillableRateService
|
||||
TimeEntry::query()
|
||||
->where('billable', '=', true)
|
||||
->where('organization_id', '=', $organization->getKey())
|
||||
->whereDoesntHave('member', function (Builder $builder) {
|
||||
->whereDoesntHave('member', function (Builder $builder): void {
|
||||
/** @var Builder<Member> $builder */
|
||||
$builder->whereNotNull('billable_rate');
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@ class DeletionService
|
||||
public function deleteOrganization(Organization $organization, bool $inTransaction = true, ?User $ignoreUser = null): void
|
||||
{
|
||||
if ($inTransaction) {
|
||||
DB::transaction(function () use ($organization) {
|
||||
DB::transaction(function () use ($organization): void {
|
||||
$this->deleteOrganization($organization, false);
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ class DeletionService
|
||||
public function deleteUser(User $user, bool $inTransaction = true): void
|
||||
{
|
||||
if ($inTransaction) {
|
||||
DB::transaction(function () use ($user) {
|
||||
DB::transaction(function () use ($user): void {
|
||||
$this->deleteUser($user, false);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class ImportService
|
||||
$lock = Cache::lock('import:'.$organization->getKey(), config('octane.max_execution_time', 60) + 1);
|
||||
|
||||
if ($lock->get()) {
|
||||
DB::transaction(function () use (&$importer, &$data, &$timezone) {
|
||||
DB::transaction(function () use (&$importer, &$data, &$timezone): void {
|
||||
$importer->importData($data, $timezone);
|
||||
});
|
||||
$lock->release();
|
||||
|
||||
@@ -113,7 +113,7 @@ abstract class DefaultImporter implements ImporterContract
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
], beforeSave: function (Project $project) {
|
||||
], beforeSave: function (Project $project): void {
|
||||
if ($project->billable_rate === 0) {
|
||||
$project->billable_rate = null;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ abstract class DefaultImporter implements ImporterContract
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
], beforeSave: function (ProjectMember $projectMember) {
|
||||
], beforeSave: function (ProjectMember $projectMember): void {
|
||||
if ($projectMember->billable_rate === 0) {
|
||||
$projectMember->billable_rate = null;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class MemberFactory extends Factory
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class UserFactory extends Factory
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
Schema::create('users', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->text('two_factor_secret')
|
||||
->after('password')
|
||||
->nullable();
|
||||
@@ -36,7 +36,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->dropColumn(array_merge([
|
||||
'two_factor_secret',
|
||||
'two_factor_recovery_codes',
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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->foreignUuid('user_id')->index();
|
||||
$table->uuid('client_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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->foreignUuid('user_id')->nullable()->index();
|
||||
$table->uuid('client_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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('access_token_id', 100)->index();
|
||||
$table->boolean('revoked');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('oauth_clients', function (Blueprint $table) {
|
||||
Schema::create('oauth_clients', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('user_id')->nullable()->index();
|
||||
$table->string('name');
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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->uuid('client_id');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
||||
}
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
$schema->create('telescope_entries', function (Blueprint $table) {
|
||||
$schema->create('telescope_entries', function (Blueprint $table): void {
|
||||
$table->bigIncrements('sequence');
|
||||
$table->uuid('uuid');
|
||||
$table->uuid('batch_id');
|
||||
@@ -43,7 +43,7 @@ return new class extends Migration
|
||||
$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->string('tag');
|
||||
|
||||
@@ -56,7 +56,7 @@ return new class extends Migration
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
$schema->create('telescope_monitoring', function (Blueprint $table) {
|
||||
$schema->create('telescope_monitoring', function (Blueprint $table): void {
|
||||
$table->string('tag')->primary();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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('uuid')->unique();
|
||||
$table->text('connection');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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->morphs('tokenable');
|
||||
$table->string('name');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('organizations', function (Blueprint $table) {
|
||||
Schema::create('organizations', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('user_id')->index();
|
||||
$table->string('name');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('organization_user', function (Blueprint $table) {
|
||||
Schema::create('organization_user', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('organization_id');
|
||||
$table->foreignUuid('user_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('organization_invitations', function (Blueprint $table) {
|
||||
Schema::create('organization_invitations', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->foreignUuid('organization_id')
|
||||
->constrained()
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
Schema::create('sessions', function (Blueprint $table): void {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignUuid('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('clients', function (Blueprint $table) {
|
||||
Schema::create('clients', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('name', 255);
|
||||
$table->uuid('organization_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('projects', function (Blueprint $table) {
|
||||
Schema::create('projects', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('name', 255);
|
||||
$table->string('color', 16);
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tasks', function (Blueprint $table) {
|
||||
Schema::create('tasks', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('name', 500);
|
||||
$table->uuid('project_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
Schema::create('tags', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('name', 255);
|
||||
$table->uuid('organization_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('time_entries', function (Blueprint $table) {
|
||||
Schema::create('time_entries', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('description', 500);
|
||||
$table->dateTime('start');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_members', function (Blueprint $table) {
|
||||
Schema::create('project_members', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->integer('billable_rate')->unsigned()->nullable();
|
||||
$table->uuid('project_id');
|
||||
|
||||
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
Schema::create('jobs', function (Blueprint $table): void {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
|
||||
@@ -13,13 +13,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
Schema::create('cache', function (Blueprint $table): void {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
Schema::create('cache_locks', function (Blueprint $table): void {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
Schema::table('time_entries', function (Blueprint $table): void {
|
||||
$table->foreignUuid('client_id')
|
||||
->nullable()
|
||||
->constrained('clients')
|
||||
@@ -35,7 +35,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
Schema::table('time_entries', function (Blueprint $table): void {
|
||||
$table->dropForeign(['client_id']);
|
||||
$table->dropColumn('client_id');
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('projects', function (Blueprint $table) {
|
||||
Schema::table('projects', function (Blueprint $table): void {
|
||||
$table->boolean('is_billable')->default(false);
|
||||
});
|
||||
DB::statement('
|
||||
@@ -22,7 +22,7 @@ return new class extends Migration
|
||||
set is_billable = true
|
||||
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();
|
||||
});
|
||||
}
|
||||
@@ -32,7 +32,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('projects', function (Blueprint $table) {
|
||||
Schema::table('projects', function (Blueprint $table): void {
|
||||
$table->dropColumn('is_billable');
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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);
|
||||
});
|
||||
}
|
||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
Schema::table('time_entries', function (Blueprint $table): void {
|
||||
$table->dropColumn('is_imported');
|
||||
});
|
||||
}
|
||||
|
||||
+6
-6
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
Schema::table('time_entries', function (Blueprint $table): void {
|
||||
$table->dropForeign(['member_id']);
|
||||
$table->foreign('member_id')
|
||||
->references('id')
|
||||
@@ -27,7 +27,7 @@ return new class extends Migration
|
||||
->restrictOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
});
|
||||
Schema::table('project_members', function (Blueprint $table) {
|
||||
Schema::table('project_members', function (Blueprint $table): void {
|
||||
$table->dropForeign(['member_id']);
|
||||
$table->foreign('member_id')
|
||||
->references('id')
|
||||
@@ -35,7 +35,7 @@ return new class extends Migration
|
||||
->restrictOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
});
|
||||
Schema::table('organization_invitations', function (Blueprint $table) {
|
||||
Schema::table('organization_invitations', function (Blueprint $table): void {
|
||||
$table->dropForeign(['organization_id']);
|
||||
$table->foreign('organization_id')
|
||||
->references('id')
|
||||
@@ -50,7 +50,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
Schema::table('time_entries', function (Blueprint $table): void {
|
||||
$table->dropForeign(['member_id']);
|
||||
$table->foreign('member_id')
|
||||
->references('id')
|
||||
@@ -64,7 +64,7 @@ return new class extends Migration
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
});
|
||||
Schema::table('project_members', function (Blueprint $table) {
|
||||
Schema::table('project_members', function (Blueprint $table): void {
|
||||
$table->dropForeign(['member_id']);
|
||||
$table->foreign('member_id')
|
||||
->references('id')
|
||||
@@ -72,7 +72,7 @@ return new class extends Migration
|
||||
->cascadeOnDelete()
|
||||
->cascadeOnUpdate();
|
||||
});
|
||||
Schema::table('organization_invitations', function (Blueprint $table) {
|
||||
Schema::table('organization_invitations', function (Blueprint $table): void {
|
||||
$table->dropForeign(['organization_id']);
|
||||
$table->foreign('organization_id')
|
||||
->references('id')
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ return new class extends Migration
|
||||
*/
|
||||
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();
|
||||
});
|
||||
}
|
||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
||||
*/
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class CreateAuditsTable extends Migration
|
||||
$connection = config('audit.drivers.database.connection', config('database.default'));
|
||||
$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');
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"declare_strict_types": true,
|
||||
"strict_comparison": true,
|
||||
"strict_param": true,
|
||||
"no_unused_imports": true
|
||||
"no_unused_imports": true,
|
||||
"void_return": true
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -33,15 +33,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
Route::middleware([
|
||||
'auth:api',
|
||||
'verified',
|
||||
])->prefix('v1')->name('v1.')->group(static function () {
|
||||
])->prefix('v1')->name('v1.')->group(static function (): void {
|
||||
// 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::put('/organizations/{organization}', [OrganizationController::class, 'update'])->name('update')->middleware('check-organization-blocked');
|
||||
});
|
||||
|
||||
// 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::put('/organizations/{organization}/members/{member}', [MemberController::class, 'update'])->name('update');
|
||||
Route::delete('/organizations/{organization}/members/{member}', [MemberController::class, 'destroy'])->name('destroy');
|
||||
@@ -50,17 +50,17 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// User routes
|
||||
Route::name('users.')->group(static function () {
|
||||
Route::name('users.')->group(static function (): void {
|
||||
Route::get('/users/me', [UserController::class, 'me'])->name('me');
|
||||
});
|
||||
|
||||
// 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');
|
||||
});
|
||||
|
||||
// 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::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');
|
||||
@@ -68,7 +68,7 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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/{project}', [ProjectController::class, 'show'])->name('show');
|
||||
Route::post('/organizations/{organization}/projects', [ProjectController::class, 'store'])->name('store')->middleware('check-organization-blocked');
|
||||
@@ -77,7 +77,7 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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::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');
|
||||
@@ -85,7 +85,7 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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/aggregate', [TimeEntryController::class, 'aggregate'])->name('aggregate');
|
||||
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::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');
|
||||
});
|
||||
|
||||
// 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::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');
|
||||
@@ -107,7 +107,7 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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::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');
|
||||
@@ -115,7 +115,7 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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::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');
|
||||
@@ -123,13 +123,13 @@ Route::middleware([
|
||||
});
|
||||
|
||||
// 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::post('/organizations/{organization}/import', [ImportController::class, 'import'])->name('import')->middleware('check-organization-blocked');
|
||||
});
|
||||
|
||||
// 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');
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ Route::middleware([
|
||||
'auth:web',
|
||||
config('jetstream.auth_session'),
|
||||
'verified',
|
||||
])->group(function () {
|
||||
])->group(function (): void {
|
||||
Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');
|
||||
|
||||
Route::get('/time', function () {
|
||||
|
||||
@@ -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
|
||||
{
|
||||
// Arrange
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock) {
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock): void {
|
||||
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
|
||||
'America/New_York',
|
||||
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
|
||||
{
|
||||
// Arrange
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock) {
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock): void {
|
||||
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
|
||||
'America/New_York',
|
||||
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
|
||||
{
|
||||
// Arrange
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock) {
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock): void {
|
||||
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
|
||||
'America/New_York',
|
||||
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
|
||||
{
|
||||
// Arrange
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock) {
|
||||
$this->mock(IpLookupServiceContract::class, function ($mock): void {
|
||||
$mock->shouldReceive('lookup')->andReturn(new IpLookupResponseDto(
|
||||
'America/New_York',
|
||||
Weekday::Sunday,
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ abstract class TestCase extends BaseTestCase
|
||||
parent::setUp();
|
||||
Mail::fake();
|
||||
LogFake::bind();
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock) {
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('hasSubscription')->andReturn(false);
|
||||
$mock->shouldReceive('hasTrial')->andReturn(false);
|
||||
$mock->shouldReceive('getTrialUntil')->andReturn(null);
|
||||
|
||||
@@ -16,7 +16,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
|
||||
#[UsesClass(ImportController::class)]
|
||||
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
|
||||
$data = $this->createUserWithPermission();
|
||||
@@ -30,7 +30,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
|
||||
$response->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_index_returns_importers_if_user_has_permission()
|
||||
public function test_index_returns_importers_if_user_has_permission(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
@@ -58,7 +58,7 @@ class ImportEndpointTest extends ApiEndpointTestAbstract
|
||||
$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
|
||||
$data = $this->createUserWithPermission();
|
||||
|
||||
@@ -118,7 +118,7 @@ class MemberEndpointTest extends ApiEndpointTestAbstract
|
||||
$data = $this->createUserWithPermission([
|
||||
'members:update',
|
||||
]);
|
||||
$this->mock(BillableRateService::class, function (MockInterface $mock) use ($data) {
|
||||
$this->mock(BillableRateService::class, function (MockInterface $mock) use ($data): void {
|
||||
$mock->shouldReceive('updateTimeEntriesBillableRateForMember')
|
||||
->once()
|
||||
->withArgs(fn (Member $memberArg) => $memberArg->is($data->member) && $memberArg->billable_rate === 10001);
|
||||
|
||||
@@ -131,7 +131,7 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
$billableRate = 111;
|
||||
$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')
|
||||
->once()
|
||||
->withArgs(fn (Organization $organization) => $organization->is($data->organization) && $organization->billable_rate === $billableRate);
|
||||
|
||||
@@ -42,7 +42,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
|
||||
// Arrange
|
||||
$user = $this->createUserWithPermission();
|
||||
$this->createTestRoute();
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock) {
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('isBlocked')->andReturn(true)->once();
|
||||
});
|
||||
Passport::actingAs($user->user);
|
||||
@@ -60,7 +60,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
|
||||
// Arrange
|
||||
$user = $this->createUserWithPermission();
|
||||
$this->createTestRoute();
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock) {
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('isBlocked')->never();
|
||||
});
|
||||
Passport::actingAs($user->user);
|
||||
@@ -77,7 +77,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
|
||||
// Arrange
|
||||
$user = $this->createUserWithPermission();
|
||||
$route = $this->createTestRouteNoModelBinding();
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock) {
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('isBlocked')->never();
|
||||
});
|
||||
Passport::actingAs($user->user);
|
||||
@@ -94,7 +94,7 @@ class CheckOrganizationBlockedMiddlewareTest extends MiddlewareTestAbstract
|
||||
// Arrange
|
||||
$user = $this->createUserWithPermission();
|
||||
$this->createTestRoute();
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock) {
|
||||
$this->mock(BillingContract::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('isBlocked')->andReturn(false)->once();
|
||||
});
|
||||
Passport::actingAs($user->user);
|
||||
|
||||
Reference in New Issue
Block a user