diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index e168d676..ffa9f6cd 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -4,6 +4,7 @@ use PhpCsFixer\Config; use PhpCsFixer\Finder; $rules = [ + 'nullable_type_declaration_for_default_null_value' => true, 'single_line_empty_body' => true, 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => [ diff --git a/src/Commands/Install.php b/src/Commands/Install.php index c7041a72..09e720bb 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -74,12 +74,12 @@ class Install extends Command */ protected function step( string $name, - Closure $task = null, + ?Closure $task = null, bool $unless = false, - string $warning = null, - string $file = null, - string $tag = null, - array $files = null, + ?string $warning = null, + ?string $file = null, + ?string $tag = null, + ?array $files = null, bool $newLineBefore = false, bool $newLineAfter = false, ): void { diff --git a/src/Controllers/TenantAssetController.php b/src/Controllers/TenantAssetController.php index add14545..6133c4ce 100644 --- a/src/Controllers/TenantAssetController.php +++ b/src/Controllers/TenantAssetController.php @@ -42,7 +42,7 @@ class TenantAssetController implements HasMiddleware /** * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ - public function __invoke(Request $request, string $path = null): BinaryFileResponse + public function __invoke(Request $request, ?string $path = null): BinaryFileResponse { $this->validatePath($path); diff --git a/src/Features/UserImpersonation.php b/src/Features/UserImpersonation.php index ce6687b0..e2a0e69f 100644 --- a/src/Features/UserImpersonation.php +++ b/src/Features/UserImpersonation.php @@ -30,7 +30,7 @@ class UserImpersonation implements Feature } /** Impersonate a user and get an HTTP redirect response. */ - public static function makeResponse(string|ImpersonationToken $token, int $ttl = null): RedirectResponse + public static function makeResponse(string|ImpersonationToken $token, ?int $ttl = null): RedirectResponse { /** @var ImpersonationToken $token */ $token = $token instanceof ImpersonationToken ? $token : ImpersonationToken::findOrFail($token); diff --git a/src/Tenancy.php b/src/Tenancy.php index e30c490f..8b30aa39 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -151,7 +151,7 @@ class Tenancy /** * Try to find a tenant using an ID. */ - public static function find(int|string $id, string $column = null, bool $withRelations = false): (Tenant&Model)|null + public static function find(int|string $id, ?string $column = null, bool $withRelations = false): (Tenant&Model)|null { /** @var (Tenant&Model)|null $tenant */ $tenant = static::model()->with($withRelations ? static::$findWith : [])->firstWhere($column ?? static::model()->getTenantKeyName(), $id); diff --git a/src/helpers.php b/src/helpers.php index 333c2829..e42c45c5 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -20,7 +20,7 @@ if (! function_exists('tenant')) { * * @return Tenant|null|mixed */ - function tenant(string $key = null): mixed + function tenant(?string $key = null): mixed { if (! app()->bound(Tenant::class)) { return null;