flatMap(fn (string $dir): array => File::allFiles(app_path($dir))) ->map(function ($file): string { $relative = Str::of($file->getPathname()) ->after(app_path().DIRECTORY_SEPARATOR) ->replace(DIRECTORY_SEPARATOR, '\\') ->replaceLast('.php', ''); return 'App\\'.$relative; }) ->filter(fn (string $class): bool => class_exists($class)) ->mapWithKeys(function (string $class): array { $timeout = (new ReflectionClass($class))->getDefaultProperties()['timeout'] ?? null; return [$class => $timeout]; }) ->filter(fn ($timeout): bool => is_int($timeout) && $timeout >= $retryAfter); expect($offenders->all())->toBe( [], 'These jobs have a $timeout >= retry_after ('.$retryAfter.'s); raise DB_QUEUE_RETRY_AFTER above the longest job timeout.' ); });