From f4cb3620ddbf20b21a9440c73803fbc48b9325de Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 21 Nov 2024 22:02:44 +0800 Subject: [PATCH] [10.x] PHP 8.4 Code Compatibility (#53612) * [10.x] PHP 8.4 Code Compatibility Signed-off-by: Mior Muhammad Zaki * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki --------- Signed-off-by: Mior Muhammad Zaki Co-authored-by: StyleCI Bot --- .styleci.yml | 2 ++ composer.json | 2 +- .../Auth/Access/AuthorizationException.php | 2 +- src/Illuminate/Auth/Access/Gate.php | 4 +-- .../Auth/Passwords/PasswordBroker.php | 2 +- src/Illuminate/Auth/RequestGuard.php | 2 +- src/Illuminate/Auth/SessionGuard.php | 4 +-- .../Broadcasting/BroadcastManager.php | 6 ++--- src/Illuminate/Bus/Batch.php | 2 +- src/Illuminate/Bus/Dispatcher.php | 2 +- src/Illuminate/Cache/RedisTagSet.php | 2 +- src/Illuminate/Collections/Arr.php | 4 +-- src/Illuminate/Collections/Collection.php | 6 ++--- src/Illuminate/Collections/Enumerable.php | 20 +++++++------- src/Illuminate/Collections/LazyCollection.php | 6 ++--- .../Collections/Traits/EnumeratesValues.php | 10 +++---- .../Conditionable/Traits/Conditionable.php | 4 +-- src/Illuminate/Container/Container.php | 8 +++--- src/Illuminate/Contracts/Auth/Access/Gate.php | 2 +- .../Contracts/Auth/PasswordBroker.php | 2 +- .../Contracts/Container/Container.php | 6 ++--- .../Contracts/Process/InvokedProcess.php | 2 +- .../Contracts/Process/ProcessResult.php | 4 +-- src/Illuminate/Database/Capsule/Manager.php | 2 +- .../Console/DatabaseInspectionCommand.php | 2 +- src/Illuminate/Database/Eloquent/Builder.php | 6 ++--- .../Database/Eloquent/Casts/Attribute.php | 4 +-- .../Concerns/QueriesRelationships.php | 26 +++++++++---------- src/Illuminate/Database/Eloquent/Model.php | 4 +-- .../Eloquent/Relations/BelongsToMany.php | 4 +-- .../Eloquent/Relations/HasManyThrough.php | 6 ++--- .../Database/Eloquent/Relations/Relation.php | 4 +-- .../Database/Migrations/Migrator.php | 2 +- src/Illuminate/Database/MySqlConnection.php | 2 +- .../Database/PostgresConnection.php | 2 +- src/Illuminate/Database/Query/Builder.php | 6 ++--- src/Illuminate/Database/SQLiteConnection.php | 2 +- src/Illuminate/Database/Schema/Blueprint.php | 2 +- src/Illuminate/Database/Schema/Builder.php | 2 +- .../Database/Schema/SchemaState.php | 2 +- .../Database/SqlServerConnection.php | 2 +- src/Illuminate/Events/Dispatcher.php | 2 +- .../Foundation/Console/AboutCommand.php | 6 ++--- .../Foundation/Http/FormRequest.php | 2 +- .../Concerns/InteractsWithContainer.php | 6 ++--- .../Validation/ValidatesRequests.php | 2 +- src/Illuminate/Http/Client/Factory.php | 2 +- src/Illuminate/Http/Client/PendingRequest.php | 4 +-- src/Illuminate/Http/Client/Pool.php | 2 +- .../Http/Concerns/InteractsWithInput.php | 6 ++--- .../Http/Exceptions/PostTooLargeException.php | 2 +- .../Exceptions/ThrottleRequestsException.php | 2 +- src/Illuminate/Http/RedirectResponse.php | 2 +- src/Illuminate/Http/Request.php | 2 +- src/Illuminate/Log/Logger.php | 2 +- src/Illuminate/Mail/Mailables/Address.php | 2 +- src/Illuminate/Mail/Mailables/Content.php | 2 +- src/Illuminate/Mail/Mailables/Envelope.php | 12 ++++----- src/Illuminate/Mail/Mailables/Headers.php | 2 +- src/Illuminate/Mail/Mailer.php | 2 +- .../Mail/Transport/ArrayTransport.php | 2 +- .../Mail/Transport/LogTransport.php | 2 +- .../Notifications/ChannelManager.php | 2 +- .../Notifications/NotificationSender.php | 2 +- .../Notifications/RoutesNotifications.php | 2 +- .../Notifications/SendQueuedNotifications.php | 2 +- src/Illuminate/Pipeline/Hub.php | 2 +- src/Illuminate/Pipeline/Pipeline.php | 2 +- src/Illuminate/Process/Factory.php | 2 +- src/Illuminate/Process/FakeInvokedProcess.php | 2 +- src/Illuminate/Process/FakeProcessResult.php | 4 +-- src/Illuminate/Process/InvokedProcess.php | 2 +- src/Illuminate/Process/PendingProcess.php | 4 +-- src/Illuminate/Process/ProcessResult.php | 4 +-- src/Illuminate/Queue/Capsule/Manager.php | 2 +- src/Illuminate/Queue/Worker.php | 2 +- .../Redis/Connections/PhpRedisConnection.php | 6 ++--- .../Limiters/ConcurrencyLimiterBuilder.php | 2 +- .../Redis/Limiters/DurationLimiterBuilder.php | 2 +- src/Illuminate/Routing/Router.php | 4 +-- .../Session/DatabaseSessionHandler.php | 2 +- .../Session/Middleware/StartSession.php | 4 +-- .../Session/SymfonySessionDecorator.php | 4 +-- src/Illuminate/Support/Composer.php | 4 +-- src/Illuminate/Support/Facades/Bus.php | 2 +- src/Illuminate/Support/Facades/Process.php | 2 +- src/Illuminate/Support/Str.php | 10 +++---- .../Support/Testing/Fakes/BusFake.php | 2 +- .../Testing/Fakes/NotificationFake.php | 2 +- src/Illuminate/Support/ValidatedInput.php | 6 ++--- src/Illuminate/Support/helpers.php | 4 +-- .../Testing/AssertableJsonString.php | 2 +- .../Testing/Fluent/AssertableJson.php | 4 +-- .../Testing/Fluent/Concerns/Debugging.php | 6 ++--- .../Testing/Fluent/Concerns/Has.php | 6 ++--- .../Testing/Fluent/Concerns/Interaction.php | 2 +- .../Testing/Fluent/Concerns/Matching.php | 4 +-- src/Illuminate/Testing/TestResponse.php | 2 +- .../Validation/Concerns/FormatsMessages.php | 2 +- src/Illuminate/Validation/Factory.php | 2 +- src/Illuminate/Validation/Validator.php | 4 +-- .../View/Compilers/BladeCompiler.php | 4 +-- .../View/Engines/CompilerEngine.php | 2 +- src/Illuminate/View/FileViewFinder.php | 2 +- src/Illuminate/View/View.php | 2 +- tests/Auth/AuthAccessGateTest.php | 8 +++--- .../ContainerResolveNonInstantiableTest.php | 2 +- tests/Container/ContextualBindingTest.php | 2 +- tests/Routing/RoutingRouteTest.php | 12 ++++----- tests/Support/SupportCarbonTest.php | 2 +- tests/Support/SupportReflectsClosuresTest.php | 2 +- 111 files changed, 207 insertions(+), 205 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 44f7cb91093b..e841dce2d3f5 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,6 +1,8 @@ php: preset: laravel version: 8.1 + enabled: + - nullable_type_declarations finder: not-name: - bad-syntax-strategy.php diff --git a/composer.json b/composer.json index 169bc9942622..38408548ed43 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ "nyholm/psr7": "^1.2", "orchestra/testbench-core": "^8.23.4", "pda/pheanstalk": "^4.0", - "phpstan/phpstan": "^1.4.7", + "phpstan/phpstan": "~1.11.11", "phpunit/phpunit": "^10.0.7", "predis/predis": "^2.0.2", "symfony/cache": "^6.2", diff --git a/src/Illuminate/Auth/Access/AuthorizationException.php b/src/Illuminate/Auth/Access/AuthorizationException.php index 17101b4d07d5..1454bde2a01d 100644 --- a/src/Illuminate/Auth/Access/AuthorizationException.php +++ b/src/Illuminate/Auth/Access/AuthorizationException.php @@ -29,7 +29,7 @@ class AuthorizationException extends Exception * @param \Throwable|null $previous * @return void */ - public function __construct($message = null, $code = null, Throwable $previous = null) + public function __construct($message = null, $code = null, ?Throwable $previous = null) { parent::__construct($message ?? 'This action is unauthorized.', 0, $previous); diff --git a/src/Illuminate/Auth/Access/Gate.php b/src/Illuminate/Auth/Access/Gate.php index 1f0a72007e9d..2f0c6c6c1151 100644 --- a/src/Illuminate/Auth/Access/Gate.php +++ b/src/Illuminate/Auth/Access/Gate.php @@ -100,7 +100,7 @@ public function __construct(Container $container, array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [], - callable $guessPolicyNamesUsingCallback = null) + ?callable $guessPolicyNamesUsingCallback = null) { $this->policies = $policies; $this->container = $container; @@ -224,7 +224,7 @@ public function define($ability, $callback) * @param array|null $abilities * @return $this */ - public function resource($name, $class, array $abilities = null) + public function resource($name, $class, ?array $abilities = null) { $abilities = $abilities ?: [ 'viewAny' => 'viewAny', diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index a0d1d194ba9c..eb213c498876 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -45,7 +45,7 @@ public function __construct(TokenRepositoryInterface $tokens, UserProvider $user * @param \Closure|null $callback * @return string */ - public function sendResetLink(array $credentials, Closure $callback = null) + public function sendResetLink(array $credentials, ?Closure $callback = null) { // First we will check to see if we found a user at the given credentials and // if we did not we will redirect back to this current URI with a piece of diff --git a/src/Illuminate/Auth/RequestGuard.php b/src/Illuminate/Auth/RequestGuard.php index d0af83cb4f4f..7c1dfdc553e0 100644 --- a/src/Illuminate/Auth/RequestGuard.php +++ b/src/Illuminate/Auth/RequestGuard.php @@ -33,7 +33,7 @@ class RequestGuard implements Guard * @param \Illuminate\Contracts\Auth\UserProvider|null $provider * @return void */ - public function __construct(callable $callback, Request $request, UserProvider $provider = null) + public function __construct(callable $callback, Request $request, ?UserProvider $provider = null) { $this->request = $request; $this->callback = $callback; diff --git a/src/Illuminate/Auth/SessionGuard.php b/src/Illuminate/Auth/SessionGuard.php index b475dbc6ca2e..d7f4872044b1 100644 --- a/src/Illuminate/Auth/SessionGuard.php +++ b/src/Illuminate/Auth/SessionGuard.php @@ -123,8 +123,8 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth public function __construct($name, UserProvider $provider, Session $session, - Request $request = null, - Timebox $timebox = null) + ?Request $request = null, + ?Timebox $timebox = null) { $this->name = $name; $this->session = $session; diff --git a/src/Illuminate/Broadcasting/BroadcastManager.php b/src/Illuminate/Broadcasting/BroadcastManager.php index 192cb3b2d639..ff044b33fe32 100644 --- a/src/Illuminate/Broadcasting/BroadcastManager.php +++ b/src/Illuminate/Broadcasting/BroadcastManager.php @@ -64,7 +64,7 @@ public function __construct($app) * @param array|null $attributes * @return void */ - public function routes(array $attributes = null) + public function routes(?array $attributes = null) { if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) { return; @@ -86,7 +86,7 @@ public function routes(array $attributes = null) * @param array|null $attributes * @return void */ - public function userRoutes(array $attributes = null) + public function userRoutes(?array $attributes = null) { if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) { return; @@ -110,7 +110,7 @@ public function userRoutes(array $attributes = null) * @param array|null $attributes * @return void */ - public function channelRoutes(array $attributes = null) + public function channelRoutes(?array $attributes = null) { $this->routes($attributes); } diff --git a/src/Illuminate/Bus/Batch.php b/src/Illuminate/Bus/Batch.php index e08b4a975ae4..a5d6fc63f941 100644 --- a/src/Illuminate/Bus/Batch.php +++ b/src/Illuminate/Bus/Batch.php @@ -450,7 +450,7 @@ public function delete() * @param \Throwable|null $e * @return void */ - protected function invokeHandlerCallback($handler, Batch $batch, Throwable $e = null) + protected function invokeHandlerCallback($handler, Batch $batch, ?Throwable $e = null) { try { return $handler($batch, $e); diff --git a/src/Illuminate/Bus/Dispatcher.php b/src/Illuminate/Bus/Dispatcher.php index 86b19dfea394..68fad13897c6 100644 --- a/src/Illuminate/Bus/Dispatcher.php +++ b/src/Illuminate/Bus/Dispatcher.php @@ -58,7 +58,7 @@ class Dispatcher implements QueueingDispatcher * @param \Closure|null $queueResolver * @return void */ - public function __construct(Container $container, Closure $queueResolver = null) + public function __construct(Container $container, ?Closure $queueResolver = null) { $this->container = $container; $this->queueResolver = $queueResolver; diff --git a/src/Illuminate/Cache/RedisTagSet.php b/src/Illuminate/Cache/RedisTagSet.php index b5fd0e2593bc..072a01bc2365 100644 --- a/src/Illuminate/Cache/RedisTagSet.php +++ b/src/Illuminate/Cache/RedisTagSet.php @@ -15,7 +15,7 @@ class RedisTagSet extends TagSet * @param string $updateWhen * @return void */ - public function addEntry(string $key, int $ttl = null, $updateWhen = null) + public function addEntry(string $key, ?int $ttl = null, $updateWhen = null) { $ttl = is_null($ttl) ? -1 : Carbon::now()->addSeconds($ttl)->getTimestamp(); diff --git a/src/Illuminate/Collections/Arr.php b/src/Illuminate/Collections/Arr.php index 361808418ffa..d83cf5f73505 100644 --- a/src/Illuminate/Collections/Arr.php +++ b/src/Illuminate/Collections/Arr.php @@ -185,7 +185,7 @@ public static function exists($array, $key) * @param mixed $default * @return mixed */ - public static function first($array, callable $callback = null, $default = null) + public static function first($array, ?callable $callback = null, $default = null) { if (is_null($callback)) { if (empty($array)) { @@ -216,7 +216,7 @@ public static function first($array, callable $callback = null, $default = null) * @param mixed $default * @return mixed */ - public static function last($array, callable $callback = null, $default = null) + public static function last($array, ?callable $callback = null, $default = null) { if (is_null($callback)) { return empty($array) ? value($default) : end($array); diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index d7369d686591..2f0c768f1450 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -382,7 +382,7 @@ public function except($keys) * @param (callable(TValue, TKey): bool)|null $callback * @return static */ - public function filter(callable $callback = null) + public function filter(?callable $callback = null) { if ($callback) { return new static(Arr::where($this->items, $callback)); @@ -400,7 +400,7 @@ public function filter(callable $callback = null) * @param TFirstDefault|(\Closure(): TFirstDefault) $default * @return TValue|TFirstDefault */ - public function first(callable $callback = null, $default = null) + public function first(?callable $callback = null, $default = null) { return Arr::first($this->items, $callback, $default); } @@ -748,7 +748,7 @@ public function keys() * @param TLastDefault|(\Closure(): TLastDefault) $default * @return TValue|TLastDefault */ - public function last(callable $callback = null, $default = null) + public function last(?callable $callback = null, $default = null) { return Arr::last($this->items, $callback, $default); } diff --git a/src/Illuminate/Collections/Enumerable.php b/src/Illuminate/Collections/Enumerable.php index 918f64758e66..806a6923f612 100644 --- a/src/Illuminate/Collections/Enumerable.php +++ b/src/Illuminate/Collections/Enumerable.php @@ -38,7 +38,7 @@ public static function make($items = []); * @param callable|null $callback * @return static */ - public static function times($number, callable $callback = null); + public static function times($number, ?callable $callback = null); /** * Create a collection with the given range. @@ -296,7 +296,7 @@ public function except($keys); * @param (callable(TValue): bool)|null $callback * @return static */ - public function filter(callable $callback = null); + public function filter(?callable $callback = null); /** * Apply the callback if the given "value" is (or resolves to) truthy. @@ -308,7 +308,7 @@ public function filter(callable $callback = null); * @param (callable($this): TWhenReturnType)|null $default * @return $this|TWhenReturnType */ - public function when($value, callable $callback = null, callable $default = null); + public function when($value, ?callable $callback = null, ?callable $default = null); /** * Apply the callback if the collection is empty. @@ -319,7 +319,7 @@ public function when($value, callable $callback = null, callable $default = null * @param (callable($this): TWhenEmptyReturnType)|null $default * @return $this|TWhenEmptyReturnType */ - public function whenEmpty(callable $callback, callable $default = null); + public function whenEmpty(callable $callback, ?callable $default = null); /** * Apply the callback if the collection is not empty. @@ -330,7 +330,7 @@ public function whenEmpty(callable $callback, callable $default = null); * @param (callable($this): TWhenNotEmptyReturnType)|null $default * @return $this|TWhenNotEmptyReturnType */ - public function whenNotEmpty(callable $callback, callable $default = null); + public function whenNotEmpty(callable $callback, ?callable $default = null); /** * Apply the callback if the given "value" is (or resolves to) truthy. @@ -342,7 +342,7 @@ public function whenNotEmpty(callable $callback, callable $default = null); * @param (callable($this): TUnlessReturnType)|null $default * @return $this|TUnlessReturnType */ - public function unless($value, callable $callback, callable $default = null); + public function unless($value, callable $callback, ?callable $default = null); /** * Apply the callback unless the collection is empty. @@ -353,7 +353,7 @@ public function unless($value, callable $callback, callable $default = null); * @param (callable($this): TUnlessEmptyReturnType)|null $default * @return $this|TUnlessEmptyReturnType */ - public function unlessEmpty(callable $callback, callable $default = null); + public function unlessEmpty(callable $callback, ?callable $default = null); /** * Apply the callback unless the collection is not empty. @@ -364,7 +364,7 @@ public function unlessEmpty(callable $callback, callable $default = null); * @param (callable($this): TUnlessNotEmptyReturnType)|null $default * @return $this|TUnlessNotEmptyReturnType */ - public function unlessNotEmpty(callable $callback, callable $default = null); + public function unlessNotEmpty(callable $callback, ?callable $default = null); /** * Filter items by the given key value pair. @@ -476,7 +476,7 @@ public function whereInstanceOf($type); * @param TFirstDefault|(\Closure(): TFirstDefault) $default * @return TValue|TFirstDefault */ - public function first(callable $callback = null, $default = null); + public function first(?callable $callback = null, $default = null); /** * Get the first item by the given key value pair. @@ -618,7 +618,7 @@ public function keys(); * @param TLastDefault|(\Closure(): TLastDefault) $default * @return TValue|TLastDefault */ - public function last(callable $callback = null, $default = null); + public function last(?callable $callback = null, $default = null); /** * Run a map over each of the items. diff --git a/src/Illuminate/Collections/LazyCollection.php b/src/Illuminate/Collections/LazyCollection.php index 84b22ebf9257..cd268b73d3a6 100644 --- a/src/Illuminate/Collections/LazyCollection.php +++ b/src/Illuminate/Collections/LazyCollection.php @@ -428,7 +428,7 @@ public function except($keys) * @param (callable(TValue, TKey): bool)|null $callback * @return static */ - public function filter(callable $callback = null) + public function filter(?callable $callback = null) { if (is_null($callback)) { $callback = fn ($value) => (bool) $value; @@ -452,7 +452,7 @@ public function filter(callable $callback = null) * @param TFirstDefault|(\Closure(): TFirstDefault) $default * @return TValue|TFirstDefault */ - public function first(callable $callback = null, $default = null) + public function first(?callable $callback = null, $default = null) { $iterator = $this->getIterator(); @@ -732,7 +732,7 @@ public function keys() * @param TLastDefault|(\Closure(): TLastDefault) $default * @return TValue|TLastDefault */ - public function last(callable $callback = null, $default = null) + public function last(?callable $callback = null, $default = null) { $needle = $placeholder = new stdClass; diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index dd4d5ab292a2..9718f5bc530c 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -164,7 +164,7 @@ public static function empty() * @param (callable(int): TTimesValue)|null $callback * @return static */ - public static function times($number, callable $callback = null) + public static function times($number, ?callable $callback = null) { if ($number < 1) { return new static; @@ -534,7 +534,7 @@ public function sum($callback = null) * @param (callable($this): TWhenEmptyReturnType)|null $default * @return $this|TWhenEmptyReturnType */ - public function whenEmpty(callable $callback, callable $default = null) + public function whenEmpty(callable $callback, ?callable $default = null) { return $this->when($this->isEmpty(), $callback, $default); } @@ -548,7 +548,7 @@ public function whenEmpty(callable $callback, callable $default = null) * @param (callable($this): TWhenNotEmptyReturnType)|null $default * @return $this|TWhenNotEmptyReturnType */ - public function whenNotEmpty(callable $callback, callable $default = null) + public function whenNotEmpty(callable $callback, ?callable $default = null) { return $this->when($this->isNotEmpty(), $callback, $default); } @@ -562,7 +562,7 @@ public function whenNotEmpty(callable $callback, callable $default = null) * @param (callable($this): TUnlessEmptyReturnType)|null $default * @return $this|TUnlessEmptyReturnType */ - public function unlessEmpty(callable $callback, callable $default = null) + public function unlessEmpty(callable $callback, ?callable $default = null) { return $this->whenNotEmpty($callback, $default); } @@ -576,7 +576,7 @@ public function unlessEmpty(callable $callback, callable $default = null) * @param (callable($this): TUnlessNotEmptyReturnType)|null $default * @return $this|TUnlessNotEmptyReturnType */ - public function unlessNotEmpty(callable $callback, callable $default = null) + public function unlessNotEmpty(callable $callback, ?callable $default = null) { return $this->whenEmpty($callback, $default); } diff --git a/src/Illuminate/Conditionable/Traits/Conditionable.php b/src/Illuminate/Conditionable/Traits/Conditionable.php index 19307437cbaa..5e3194bbcb6a 100644 --- a/src/Illuminate/Conditionable/Traits/Conditionable.php +++ b/src/Illuminate/Conditionable/Traits/Conditionable.php @@ -18,7 +18,7 @@ trait Conditionable * @param (callable($this, TWhenParameter): TWhenReturnType)|null $default * @return $this|TWhenReturnType */ - public function when($value = null, callable $callback = null, callable $default = null) + public function when($value = null, ?callable $callback = null, ?callable $default = null) { $value = $value instanceof Closure ? $value($this) : $value; @@ -50,7 +50,7 @@ public function when($value = null, callable $callback = null, callable $default * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $default * @return $this|TUnlessReturnType */ - public function unless($value = null, callable $callback = null, callable $default = null) + public function unless($value = null, ?callable $callback = null, ?callable $default = null) { $value = $value instanceof Closure ? $value($this) : $value; diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index adb73bb51f86..874f49f69c99 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -1148,7 +1148,7 @@ protected function unresolvablePrimitive(ReflectionParameter $parameter) * @param \Closure|null $callback * @return void */ - public function beforeResolving($abstract, Closure $callback = null) + public function beforeResolving($abstract, ?Closure $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); @@ -1168,7 +1168,7 @@ public function beforeResolving($abstract, Closure $callback = null) * @param \Closure|null $callback * @return void */ - public function resolving($abstract, Closure $callback = null) + public function resolving($abstract, ?Closure $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); @@ -1188,7 +1188,7 @@ public function resolving($abstract, Closure $callback = null) * @param \Closure|null $callback * @return void */ - public function afterResolving($abstract, Closure $callback = null) + public function afterResolving($abstract, ?Closure $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); @@ -1427,7 +1427,7 @@ public static function getInstance() * @param \Illuminate\Contracts\Container\Container|null $container * @return \Illuminate\Contracts\Container\Container|static */ - public static function setInstance(ContainerContract $container = null) + public static function setInstance(?ContainerContract $container = null) { return static::$instance = $container; } diff --git a/src/Illuminate/Contracts/Auth/Access/Gate.php b/src/Illuminate/Contracts/Auth/Access/Gate.php index eb605d8279fd..4bafab3f4dc5 100644 --- a/src/Illuminate/Contracts/Auth/Access/Gate.php +++ b/src/Illuminate/Contracts/Auth/Access/Gate.php @@ -29,7 +29,7 @@ public function define($ability, $callback); * @param array|null $abilities * @return $this */ - public function resource($name, $class, array $abilities = null); + public function resource($name, $class, ?array $abilities = null); /** * Define a policy class for a given class type. diff --git a/src/Illuminate/Contracts/Auth/PasswordBroker.php b/src/Illuminate/Contracts/Auth/PasswordBroker.php index bbbe9b508688..c6b202329e39 100644 --- a/src/Illuminate/Contracts/Auth/PasswordBroker.php +++ b/src/Illuminate/Contracts/Auth/PasswordBroker.php @@ -48,7 +48,7 @@ interface PasswordBroker * @param \Closure|null $callback * @return string */ - public function sendResetLink(array $credentials, Closure $callback = null); + public function sendResetLink(array $credentials, ?Closure $callback = null); /** * Reset the password for the given token. diff --git a/src/Illuminate/Contracts/Container/Container.php b/src/Illuminate/Contracts/Container/Container.php index 1472a2e5fc71..47c5f8b55278 100644 --- a/src/Illuminate/Contracts/Container/Container.php +++ b/src/Illuminate/Contracts/Container/Container.php @@ -197,7 +197,7 @@ public function resolved($abstract); * @param \Closure|null $callback * @return void */ - public function beforeResolving($abstract, Closure $callback = null); + public function beforeResolving($abstract, ?Closure $callback = null); /** * Register a new resolving callback. @@ -206,7 +206,7 @@ public function beforeResolving($abstract, Closure $callback = null); * @param \Closure|null $callback * @return void */ - public function resolving($abstract, Closure $callback = null); + public function resolving($abstract, ?Closure $callback = null); /** * Register a new after resolving callback. @@ -215,5 +215,5 @@ public function resolving($abstract, Closure $callback = null); * @param \Closure|null $callback * @return void */ - public function afterResolving($abstract, Closure $callback = null); + public function afterResolving($abstract, ?Closure $callback = null); } diff --git a/src/Illuminate/Contracts/Process/InvokedProcess.php b/src/Illuminate/Contracts/Process/InvokedProcess.php index d272d377296b..87a92c047704 100644 --- a/src/Illuminate/Contracts/Process/InvokedProcess.php +++ b/src/Illuminate/Contracts/Process/InvokedProcess.php @@ -60,5 +60,5 @@ public function latestErrorOutput(); * @param callable|null $output * @return \Illuminate\Console\Process\ProcessResult */ - public function wait(callable $output = null); + public function wait(?callable $output = null); } diff --git a/src/Illuminate/Contracts/Process/ProcessResult.php b/src/Illuminate/Contracts/Process/ProcessResult.php index 702701ea1aa8..cf9adcced9b5 100644 --- a/src/Illuminate/Contracts/Process/ProcessResult.php +++ b/src/Illuminate/Contracts/Process/ProcessResult.php @@ -52,7 +52,7 @@ public function errorOutput(); * @param callable|null $callback * @return $this */ - public function throw(callable $callback = null); + public function throw(?callable $callback = null); /** * Throw an exception if the process failed and the given condition is true. @@ -61,5 +61,5 @@ public function throw(callable $callback = null); * @param callable|null $callback * @return $this */ - public function throwIf(bool $condition, callable $callback = null); + public function throwIf(bool $condition, ?callable $callback = null); } diff --git a/src/Illuminate/Database/Capsule/Manager.php b/src/Illuminate/Database/Capsule/Manager.php index b877e7c6d20d..cfc47eb5abcf 100755 --- a/src/Illuminate/Database/Capsule/Manager.php +++ b/src/Illuminate/Database/Capsule/Manager.php @@ -27,7 +27,7 @@ class Manager * @param \Illuminate\Container\Container|null $container * @return void */ - public function __construct(Container $container = null) + public function __construct(?Container $container = null) { $this->setupContainer($container ?: new Container); diff --git a/src/Illuminate/Database/Console/DatabaseInspectionCommand.php b/src/Illuminate/Database/Console/DatabaseInspectionCommand.php index 42568fc2c02d..8bcf1f82a0ff 100644 --- a/src/Illuminate/Database/Console/DatabaseInspectionCommand.php +++ b/src/Illuminate/Database/Console/DatabaseInspectionCommand.php @@ -54,7 +54,7 @@ abstract class DatabaseInspectionCommand extends Command * @param \Illuminate\Support\Composer|null $composer * @return void */ - public function __construct(Composer $composer = null) + public function __construct(?Composer $composer = null) { parent::__construct(); diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index 8ed9229e0894..b695b338dd1d 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -203,7 +203,7 @@ public function withoutGlobalScope($scope) * @param array|null $scopes * @return $this */ - public function withoutGlobalScopes(array $scopes = null) + public function withoutGlobalScopes(?array $scopes = null) { if (! is_array($scopes)) { $scopes = array_keys($this->scopes); @@ -525,7 +525,7 @@ public function findOrNew($id, $columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|mixed */ - public function findOr($id, $columns = ['*'], Closure $callback = null) + public function findOr($id, $columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; @@ -628,7 +628,7 @@ public function firstOrFail($columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|static|mixed */ - public function firstOr($columns = ['*'], Closure $callback = null) + public function firstOr($columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; diff --git a/src/Illuminate/Database/Eloquent/Casts/Attribute.php b/src/Illuminate/Database/Eloquent/Casts/Attribute.php index 3f9fd19e2bd7..4fe2d807b690 100644 --- a/src/Illuminate/Database/Eloquent/Casts/Attribute.php +++ b/src/Illuminate/Database/Eloquent/Casts/Attribute.php @@ -39,7 +39,7 @@ class Attribute * @param callable|null $set * @return void */ - public function __construct(callable $get = null, callable $set = null) + public function __construct(?callable $get = null, ?callable $set = null) { $this->get = $get; $this->set = $set; @@ -52,7 +52,7 @@ public function __construct(callable $get = null, callable $set = null) * @param callable|null $set * @return static */ - public static function make(callable $get = null, callable $set = null): static + public static function make(?callable $get = null, ?callable $set = null): static { return new static($get, $set); } diff --git a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php index de43f9839824..4322327cb472 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -29,7 +29,7 @@ trait QueriesRelationships * * @throws \RuntimeException */ - public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) + public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null) { if (is_string($relation)) { if (str_contains($relation, '.')) { @@ -122,7 +122,7 @@ public function orHas($relation, $operator = '>=', $count = 1) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function doesntHave($relation, $boolean = 'and', Closure $callback = null) + public function doesntHave($relation, $boolean = 'and', ?Closure $callback = null) { return $this->has($relation, '<', 1, $boolean, $callback); } @@ -147,7 +147,7 @@ public function orDoesntHave($relation) * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ - public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + public function whereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1) { return $this->has($relation, $operator, $count, 'and', $callback); } @@ -163,7 +163,7 @@ public function whereHas($relation, Closure $callback = null, $operator = '>=', * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ - public function withWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + public function withWhereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1) { return $this->whereHas(Str::before($relation, ':'), $callback, $operator, $count) ->with($callback ? [$relation => fn ($query) => $callback($query)] : $relation); @@ -178,7 +178,7 @@ public function withWhereHas($relation, Closure $callback = null, $operator = '> * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ - public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + public function orWhereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1) { return $this->has($relation, $operator, $count, 'or', $callback); } @@ -190,7 +190,7 @@ public function orWhereHas($relation, Closure $callback = null, $operator = '>=' * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function whereDoesntHave($relation, Closure $callback = null) + public function whereDoesntHave($relation, ?Closure $callback = null) { return $this->doesntHave($relation, 'and', $callback); } @@ -202,7 +202,7 @@ public function whereDoesntHave($relation, Closure $callback = null) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function orWhereDoesntHave($relation, Closure $callback = null) + public function orWhereDoesntHave($relation, ?Closure $callback = null) { return $this->doesntHave($relation, 'or', $callback); } @@ -218,7 +218,7 @@ public function orWhereDoesntHave($relation, Closure $callback = null) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) + public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null) { if (is_string($relation)) { $relation = $this->getRelationWithoutConstraints($relation); @@ -301,7 +301,7 @@ public function orHasMorph($relation, $types, $operator = '>=', $count = 1) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function doesntHaveMorph($relation, $types, $boolean = 'and', Closure $callback = null) + public function doesntHaveMorph($relation, $types, $boolean = 'and', ?Closure $callback = null) { return $this->hasMorph($relation, $types, '<', 1, $boolean, $callback); } @@ -328,7 +328,7 @@ public function orDoesntHaveMorph($relation, $types) * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ - public function whereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + public function whereHasMorph($relation, $types, ?Closure $callback = null, $operator = '>=', $count = 1) { return $this->hasMorph($relation, $types, $operator, $count, 'and', $callback); } @@ -343,7 +343,7 @@ public function whereHasMorph($relation, $types, Closure $callback = null, $oper * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ - public function orWhereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + public function orWhereHasMorph($relation, $types, ?Closure $callback = null, $operator = '>=', $count = 1) { return $this->hasMorph($relation, $types, $operator, $count, 'or', $callback); } @@ -356,7 +356,7 @@ public function orWhereHasMorph($relation, $types, Closure $callback = null, $op * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function whereDoesntHaveMorph($relation, $types, Closure $callback = null) + public function whereDoesntHaveMorph($relation, $types, ?Closure $callback = null) { return $this->doesntHaveMorph($relation, $types, 'and', $callback); } @@ -369,7 +369,7 @@ public function whereDoesntHaveMorph($relation, $types, Closure $callback = null * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ - public function orWhereDoesntHaveMorph($relation, $types, Closure $callback = null) + public function orWhereDoesntHaveMorph($relation, $types, ?Closure $callback = null) { return $this->doesntHaveMorph($relation, $types, 'or', $callback); } diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index 48618cbbd61f..8444d8251324 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -1718,7 +1718,7 @@ public function refresh() * @param array|null $except * @return static */ - public function replicate(array $except = null) + public function replicate(?array $except = null) { $defaults = array_values(array_filter([ $this->getKeyName(), @@ -1746,7 +1746,7 @@ public function replicate(array $except = null) * @param array|null $except * @return static */ - public function replicateQuietly(array $except = null) + public function replicateQuietly(?array $except = null) { return static::withoutEvents(fn () => $this->replicate($except)); } diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php index 0f93ee7e390c..238fe2dc8390 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -753,7 +753,7 @@ public function findOrFail($id, $columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed */ - public function findOr($id, $columns = ['*'], Closure $callback = null) + public function findOr($id, $columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; @@ -827,7 +827,7 @@ public function firstOrFail($columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|static|mixed */ - public function firstOr($columns = ['*'], Closure $callback = null) + public function firstOr($columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; diff --git a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php index 20c34749efba..db21219391d5 100644 --- a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php +++ b/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php @@ -122,7 +122,7 @@ public function addConstraints() * @param \Illuminate\Database\Eloquent\Builder|null $query * @return void */ - protected function performJoin(Builder $query = null) + protected function performJoin(?Builder $query = null) { $query = $query ?: $this->query; @@ -363,7 +363,7 @@ public function firstOrFail($columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|static|mixed */ - public function firstOr($columns = ['*'], Closure $callback = null) + public function firstOr($columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; @@ -450,7 +450,7 @@ public function findOrFail($id, $columns = ['*']) * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed */ - public function findOr($id, $columns = ['*'], Closure $callback = null) + public function findOr($id, $columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; diff --git a/src/Illuminate/Database/Eloquent/Relations/Relation.php b/src/Illuminate/Database/Eloquent/Relations/Relation.php index 7fea6b70d95b..b5e8864f0937 100755 --- a/src/Illuminate/Database/Eloquent/Relations/Relation.php +++ b/src/Illuminate/Database/Eloquent/Relations/Relation.php @@ -461,7 +461,7 @@ public static function enforceMorphMap(array $map, $merge = true) * @param bool $merge * @return array */ - public static function morphMap(array $map = null, $merge = true) + public static function morphMap(?array $map = null, $merge = true) { $map = static::buildMorphMapFromModels($map); @@ -479,7 +479,7 @@ public static function morphMap(array $map = null, $merge = true) * @param string[]|null $models * @return array|null */ - protected static function buildMorphMapFromModels(array $models = null) + protected static function buildMorphMapFromModels(?array $models = null) { if (is_null($models) || ! array_is_list($models)) { return $models; diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index 4f6ec5247a04..ff18a26d60b5 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -92,7 +92,7 @@ class Migrator public function __construct(MigrationRepositoryInterface $repository, Resolver $resolver, Filesystem $files, - Dispatcher $dispatcher = null) + ?Dispatcher $dispatcher = null) { $this->files = $files; $this->events = $dispatcher; diff --git a/src/Illuminate/Database/MySqlConnection.php b/src/Illuminate/Database/MySqlConnection.php index 9db946ab11e0..5a494b8ef5fc 100755 --- a/src/Illuminate/Database/MySqlConnection.php +++ b/src/Illuminate/Database/MySqlConnection.php @@ -139,7 +139,7 @@ protected function getDefaultSchemaGrammar() * @param callable|null $processFactory * @return \Illuminate\Database\Schema\MySqlSchemaState */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new MySqlSchemaState($this, $files, $processFactory); } diff --git a/src/Illuminate/Database/PostgresConnection.php b/src/Illuminate/Database/PostgresConnection.php index c3e22a928801..b13db7013211 100755 --- a/src/Illuminate/Database/PostgresConnection.php +++ b/src/Illuminate/Database/PostgresConnection.php @@ -93,7 +93,7 @@ protected function getDefaultSchemaGrammar() * @param callable|null $processFactory * @return \Illuminate\Database\Schema\PostgresSchemaState */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new PostgresSchemaState($this, $files, $processFactory); } diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 52b38a6d2902..948693b3ea96 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -239,8 +239,8 @@ class Builder implements BuilderContract * @return void */ public function __construct(ConnectionInterface $connection, - Grammar $grammar = null, - Processor $processor = null) + ?Grammar $grammar = null, + ?Processor $processor = null) { $this->connection = $connection; $this->grammar = $grammar ?: $connection->getQueryGrammar(); @@ -2832,7 +2832,7 @@ public function find($id, $columns = ['*']) * @param \Closure|null $callback * @return mixed|static */ - public function findOr($id, $columns = ['*'], Closure $callback = null) + public function findOr($id, $columns = ['*'], ?Closure $callback = null) { if ($columns instanceof Closure) { $callback = $columns; diff --git a/src/Illuminate/Database/SQLiteConnection.php b/src/Illuminate/Database/SQLiteConnection.php index ad7c1486d2d2..806e581de259 100755 --- a/src/Illuminate/Database/SQLiteConnection.php +++ b/src/Illuminate/Database/SQLiteConnection.php @@ -107,7 +107,7 @@ protected function getDefaultSchemaGrammar() * * @throws \RuntimeException */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new SqliteSchemaState($this, $files, $processFactory); } diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index 26f6ee5c4a7a..2b796b097257 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -87,7 +87,7 @@ class Blueprint * @param string $prefix * @return void */ - public function __construct($table, Closure $callback = null, $prefix = '') + public function __construct($table, ?Closure $callback = null, $prefix = '') { $this->table = $table; $this->prefix = $prefix; diff --git a/src/Illuminate/Database/Schema/Builder.php b/src/Illuminate/Database/Schema/Builder.php index 4a8839442951..6c705c066a44 100755 --- a/src/Illuminate/Database/Schema/Builder.php +++ b/src/Illuminate/Database/Schema/Builder.php @@ -609,7 +609,7 @@ protected function build(Blueprint $blueprint) * @param \Closure|null $callback * @return \Illuminate\Database\Schema\Blueprint */ - protected function createBlueprint($table, Closure $callback = null) + protected function createBlueprint($table, ?Closure $callback = null) { $prefix = $this->connection->getConfig('prefix_indexes') ? $this->connection->getConfig('prefix') diff --git a/src/Illuminate/Database/Schema/SchemaState.php b/src/Illuminate/Database/Schema/SchemaState.php index b7fa34c168c9..2b2236af8801 100644 --- a/src/Illuminate/Database/Schema/SchemaState.php +++ b/src/Illuminate/Database/Schema/SchemaState.php @@ -51,7 +51,7 @@ abstract class SchemaState * @param callable|null $processFactory * @return void */ - public function __construct(Connection $connection, Filesystem $files = null, callable $processFactory = null) + public function __construct(Connection $connection, ?Filesystem $files = null, ?callable $processFactory = null) { $this->connection = $connection; diff --git a/src/Illuminate/Database/SqlServerConnection.php b/src/Illuminate/Database/SqlServerConnection.php index e376e6fa6c38..ab43cfc89b1c 100755 --- a/src/Illuminate/Database/SqlServerConnection.php +++ b/src/Illuminate/Database/SqlServerConnection.php @@ -125,7 +125,7 @@ protected function getDefaultSchemaGrammar() * * @throws \RuntimeException */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { throw new RuntimeException('Schema dumping is not supported when using SQL Server.'); } diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index 22993c36f94f..c418fc4d06b8 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -72,7 +72,7 @@ class Dispatcher implements DispatcherContract * @param \Illuminate\Contracts\Container\Container|null $container * @return void */ - public function __construct(ContainerContract $container = null) + public function __construct(?ContainerContract $container = null) { $this->container = $container ?: new Container; } diff --git a/src/Illuminate/Foundation/Console/AboutCommand.php b/src/Illuminate/Foundation/Console/AboutCommand.php index 20c24e8e7c11..1a078a68f5df 100644 --- a/src/Illuminate/Foundation/Console/AboutCommand.php +++ b/src/Illuminate/Foundation/Console/AboutCommand.php @@ -232,7 +232,7 @@ protected function hasPhpFiles(string $path): bool * @param string|null $value * @return void */ - public static function add(string $section, $data, string $value = null) + public static function add(string $section, $data, ?string $value = null) { static::$customDataResolvers[] = fn () => static::addToSection($section, $data, $value); } @@ -245,7 +245,7 @@ public static function add(string $section, $data, string $value = null) * @param string|null $value * @return void */ - protected static function addToSection(string $section, $data, string $value = null) + protected static function addToSection(string $section, $data, ?string $value = null) { if (is_array($data)) { foreach ($data as $key => $value) { @@ -279,7 +279,7 @@ protected function sections() * @param (\Closure(mixed):(mixed))|null $json * @return \Closure(bool):mixed */ - public static function format($value, Closure $console = null, Closure $json = null) + public static function format($value, ?Closure $console = null, ?Closure $json = null) { return function ($isJson) use ($value, $console, $json) { if ($isJson === true && $json instanceof Closure) { diff --git a/src/Illuminate/Foundation/Http/FormRequest.php b/src/Illuminate/Foundation/Http/FormRequest.php index 4824c27c1799..87a1e2048555 100644 --- a/src/Illuminate/Foundation/Http/FormRequest.php +++ b/src/Illuminate/Foundation/Http/FormRequest.php @@ -226,7 +226,7 @@ protected function failedAuthorization() * @param array|null $keys * @return \Illuminate\Support\ValidatedInput|array */ - public function safe(array $keys = null) + public function safe(?array $keys = null) { return is_array($keys) ? $this->validator->safe()->only($keys) diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php index 6c517d336ebf..b4aad547cc38 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php @@ -58,7 +58,7 @@ protected function instance($abstract, $instance) * @param \Closure|null $mock * @return \Mockery\MockInterface */ - protected function mock($abstract, Closure $mock = null) + protected function mock($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))); } @@ -70,7 +70,7 @@ protected function mock($abstract, Closure $mock = null) * @param \Closure|null $mock * @return \Mockery\MockInterface */ - protected function partialMock($abstract, Closure $mock = null) + protected function partialMock($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial()); } @@ -82,7 +82,7 @@ protected function partialMock($abstract, Closure $mock = null) * @param \Closure|null $mock * @return \Mockery\MockInterface */ - protected function spy($abstract, Closure $mock = null) + protected function spy($abstract, ?Closure $mock = null) { return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args()))); } diff --git a/src/Illuminate/Foundation/Validation/ValidatesRequests.php b/src/Illuminate/Foundation/Validation/ValidatesRequests.php index bf2aecdd3986..4d7aad2a65d1 100644 --- a/src/Illuminate/Foundation/Validation/ValidatesRequests.php +++ b/src/Illuminate/Foundation/Validation/ValidatesRequests.php @@ -18,7 +18,7 @@ trait ValidatesRequests * * @throws \Illuminate\Validation\ValidationException */ - public function validateWith($validator, Request $request = null) + public function validateWith($validator, ?Request $request = null) { $request = $request ?: request(); diff --git a/src/Illuminate/Http/Client/Factory.php b/src/Illuminate/Http/Client/Factory.php index 4bcd13d21b09..b75fe41b3349 100644 --- a/src/Illuminate/Http/Client/Factory.php +++ b/src/Illuminate/Http/Client/Factory.php @@ -84,7 +84,7 @@ class Factory * @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher * @return void */ - public function __construct(Dispatcher $dispatcher = null) + public function __construct(?Dispatcher $dispatcher = null) { $this->dispatcher = $dispatcher; diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 7eb8b0e47b6c..b4cf927c7858 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -222,7 +222,7 @@ class PendingRequest * @param array $middleware * @return void */ - public function __construct(Factory $factory = null, $middleware = []) + public function __construct(?Factory $factory = null, $middleware = []) { $this->factory = $factory; $this->middleware = new Collection($middleware); @@ -690,7 +690,7 @@ public function beforeSending($callback) * @param callable|null $callback * @return $this */ - public function throw(callable $callback = null) + public function throw(?callable $callback = null) { $this->throwCallback = $callback ?: fn () => null; diff --git a/src/Illuminate/Http/Client/Pool.php b/src/Illuminate/Http/Client/Pool.php index 0704df33226a..b5f00258fbab 100644 --- a/src/Illuminate/Http/Client/Pool.php +++ b/src/Illuminate/Http/Client/Pool.php @@ -36,7 +36,7 @@ class Pool * @param \Illuminate\Http\Client\Factory|null $factory * @return void */ - public function __construct(Factory $factory = null) + public function __construct(?Factory $factory = null) { $this->factory = $factory ?: new Factory(); $this->handler = Utils::chooseHandler(); diff --git a/src/Illuminate/Http/Concerns/InteractsWithInput.php b/src/Illuminate/Http/Concerns/InteractsWithInput.php index 36dcec2fef4f..4c60ed4f1f9c 100644 --- a/src/Illuminate/Http/Concerns/InteractsWithInput.php +++ b/src/Illuminate/Http/Concerns/InteractsWithInput.php @@ -120,7 +120,7 @@ public function hasAny($keys) * @param callable|null $default * @return $this|mixed */ - public function whenHas($key, callable $callback, callable $default = null) + public function whenHas($key, callable $callback, ?callable $default = null) { if ($this->has($key)) { return $callback(data_get($this->all(), $key)) ?: $this; @@ -198,7 +198,7 @@ public function anyFilled($keys) * @param callable|null $default * @return $this|mixed */ - public function whenFilled($key, callable $callback, callable $default = null) + public function whenFilled($key, callable $callback, ?callable $default = null) { if ($this->filled($key)) { return $callback(data_get($this->all(), $key)) ?: $this; @@ -232,7 +232,7 @@ public function missing($key) * @param callable|null $default * @return $this|mixed */ - public function whenMissing($key, callable $callback, callable $default = null) + public function whenMissing($key, callable $callback, ?callable $default = null) { if ($this->missing($key)) { return $callback(data_get($this->all(), $key)) ?: $this; diff --git a/src/Illuminate/Http/Exceptions/PostTooLargeException.php b/src/Illuminate/Http/Exceptions/PostTooLargeException.php index d5bbc60dc44c..560b8af411b0 100644 --- a/src/Illuminate/Http/Exceptions/PostTooLargeException.php +++ b/src/Illuminate/Http/Exceptions/PostTooLargeException.php @@ -16,7 +16,7 @@ class PostTooLargeException extends HttpException * @param int $code * @return void */ - public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0) + public function __construct($message = '', ?Throwable $previous = null, array $headers = [], $code = 0) { parent::__construct(413, $message, $previous, $headers, $code); } diff --git a/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php b/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php index d6c6e336806a..98dc78ddbd3e 100644 --- a/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php +++ b/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php @@ -16,7 +16,7 @@ class ThrottleRequestsException extends TooManyRequestsHttpException * @param int $code * @return void */ - public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0) + public function __construct($message = '', ?Throwable $previous = null, array $headers = [], $code = 0) { parent::__construct(null, $message, $previous, $code, $headers); } diff --git a/src/Illuminate/Http/RedirectResponse.php b/src/Illuminate/Http/RedirectResponse.php index 6edd57efe9a5..5c506ba6b00b 100755 --- a/src/Illuminate/Http/RedirectResponse.php +++ b/src/Illuminate/Http/RedirectResponse.php @@ -71,7 +71,7 @@ public function withCookies(array $cookies) * @param array|null $input * @return $this */ - public function withInput(array $input = null) + public function withInput(?array $input = null) { $this->session->flashInput($this->removeFilesFromInput( ! is_null($input) ? $input : $this->request->input() diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index d7c8745f719b..d38c7d1c8b0d 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -499,7 +499,7 @@ public static function createFromBase(SymfonyRequest $request) * * @return static */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static + public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null): static { return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server); } diff --git a/src/Illuminate/Log/Logger.php b/src/Illuminate/Log/Logger.php index 1dd9ff4443ab..799228a65045 100755 --- a/src/Illuminate/Log/Logger.php +++ b/src/Illuminate/Log/Logger.php @@ -43,7 +43,7 @@ class Logger implements LoggerInterface * @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher * @return void */ - public function __construct(LoggerInterface $logger, Dispatcher $dispatcher = null) + public function __construct(LoggerInterface $logger, ?Dispatcher $dispatcher = null) { $this->logger = $logger; $this->dispatcher = $dispatcher; diff --git a/src/Illuminate/Mail/Mailables/Address.php b/src/Illuminate/Mail/Mailables/Address.php index be54a24a7413..7a9ed2aa66cd 100644 --- a/src/Illuminate/Mail/Mailables/Address.php +++ b/src/Illuminate/Mail/Mailables/Address.php @@ -25,7 +25,7 @@ class Address * @param string|null $name * @return void */ - public function __construct(string $address, string $name = null) + public function __construct(string $address, ?string $name = null) { $this->address = $address; $this->name = $name; diff --git a/src/Illuminate/Mail/Mailables/Content.php b/src/Illuminate/Mail/Mailables/Content.php index 182b2b5b6bf1..80826243d04c 100644 --- a/src/Illuminate/Mail/Mailables/Content.php +++ b/src/Illuminate/Mail/Mailables/Content.php @@ -64,7 +64,7 @@ class Content * * @named-arguments-supported */ - public function __construct(string $view = null, string $html = null, string $text = null, $markdown = null, array $with = [], string $htmlString = null) + public function __construct(?string $view = null, ?string $html = null, ?string $text = null, $markdown = null, array $with = [], ?string $htmlString = null) { $this->view = $view; $this->html = $html; diff --git a/src/Illuminate/Mail/Mailables/Envelope.php b/src/Illuminate/Mail/Mailables/Envelope.php index c5126f5ff2e4..b41d5c07973c 100644 --- a/src/Illuminate/Mail/Mailables/Envelope.php +++ b/src/Illuminate/Mail/Mailables/Envelope.php @@ -89,7 +89,7 @@ class Envelope * * @named-arguments-supported */ - public function __construct(Address|string $from = null, $to = [], $cc = [], $bcc = [], $replyTo = [], string $subject = null, array $tags = [], array $metadata = [], Closure|array $using = []) + public function __construct(Address|string|null $from = null, $to = [], $cc = [], $bcc = [], $replyTo = [], ?string $subject = null, array $tags = [], array $metadata = [], Closure|array $using = []) { $this->from = is_string($from) ? new Address($from) : $from; $this->to = $this->normalizeAddresses($to); @@ -266,7 +266,7 @@ public function using(Closure $callback) * @param string|null $name * @return bool */ - public function isFrom(string $address, string $name = null) + public function isFrom(string $address, ?string $name = null) { if (is_null($name)) { return $this->from->address === $address; @@ -283,7 +283,7 @@ public function isFrom(string $address, string $name = null) * @param string|null $name * @return bool */ - public function hasTo(string $address, string $name = null) + public function hasTo(string $address, ?string $name = null) { return $this->hasRecipient($this->to, $address, $name); } @@ -295,7 +295,7 @@ public function hasTo(string $address, string $name = null) * @param string|null $name * @return bool */ - public function hasCc(string $address, string $name = null) + public function hasCc(string $address, ?string $name = null) { return $this->hasRecipient($this->cc, $address, $name); } @@ -307,7 +307,7 @@ public function hasCc(string $address, string $name = null) * @param string|null $name * @return bool */ - public function hasBcc(string $address, string $name = null) + public function hasBcc(string $address, ?string $name = null) { return $this->hasRecipient($this->bcc, $address, $name); } @@ -319,7 +319,7 @@ public function hasBcc(string $address, string $name = null) * @param string|null $name * @return bool */ - public function hasReplyTo(string $address, string $name = null) + public function hasReplyTo(string $address, ?string $name = null) { return $this->hasRecipient($this->replyTo, $address, $name); } diff --git a/src/Illuminate/Mail/Mailables/Headers.php b/src/Illuminate/Mail/Mailables/Headers.php index 87cee52b4768..0428f250416b 100644 --- a/src/Illuminate/Mail/Mailables/Headers.php +++ b/src/Illuminate/Mail/Mailables/Headers.php @@ -40,7 +40,7 @@ class Headers * * @named-arguments-supported */ - public function __construct(string $messageId = null, array $references = [], array $text = []) + public function __construct(?string $messageId = null, array $references = [], array $text = []) { $this->messageId = $messageId; $this->references = $references; diff --git a/src/Illuminate/Mail/Mailer.php b/src/Illuminate/Mail/Mailer.php index 132d95683754..f9196bd1b1ca 100755 --- a/src/Illuminate/Mail/Mailer.php +++ b/src/Illuminate/Mail/Mailer.php @@ -97,7 +97,7 @@ class Mailer implements MailerContract, MailQueueContract * @param \Illuminate\Contracts\Events\Dispatcher|null $events * @return void */ - public function __construct(string $name, Factory $views, TransportInterface $transport, Dispatcher $events = null) + public function __construct(string $name, Factory $views, TransportInterface $transport, ?Dispatcher $events = null) { $this->name = $name; $this->views = $views; diff --git a/src/Illuminate/Mail/Transport/ArrayTransport.php b/src/Illuminate/Mail/Transport/ArrayTransport.php index dc26ed69d90b..02ba21d90c70 100644 --- a/src/Illuminate/Mail/Transport/ArrayTransport.php +++ b/src/Illuminate/Mail/Transport/ArrayTransport.php @@ -30,7 +30,7 @@ public function __construct() /** * {@inheritdoc} */ - public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage + public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage { return $this->messages[] = new SentMessage($message, $envelope ?? Envelope::create($message)); } diff --git a/src/Illuminate/Mail/Transport/LogTransport.php b/src/Illuminate/Mail/Transport/LogTransport.php index 682169e3eaa7..c428de85230f 100644 --- a/src/Illuminate/Mail/Transport/LogTransport.php +++ b/src/Illuminate/Mail/Transport/LogTransport.php @@ -32,7 +32,7 @@ public function __construct(LoggerInterface $logger) /** * {@inheritdoc} */ - public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage + public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage { $string = Str::of($message->toString()); diff --git a/src/Illuminate/Notifications/ChannelManager.php b/src/Illuminate/Notifications/ChannelManager.php index 8eb9c251024d..0ad7dae671a8 100644 --- a/src/Illuminate/Notifications/ChannelManager.php +++ b/src/Illuminate/Notifications/ChannelManager.php @@ -47,7 +47,7 @@ public function send($notifiables, $notification) * @param array|null $channels * @return void */ - public function sendNow($notifiables, $notification, array $channels = null) + public function sendNow($notifiables, $notification, ?array $channels = null) { (new NotificationSender( $this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) diff --git a/src/Illuminate/Notifications/NotificationSender.php b/src/Illuminate/Notifications/NotificationSender.php index 698d19dcb95f..f82f02279372 100644 --- a/src/Illuminate/Notifications/NotificationSender.php +++ b/src/Illuminate/Notifications/NotificationSender.php @@ -87,7 +87,7 @@ public function send($notifiables, $notification) * @param array|null $channels * @return void */ - public function sendNow($notifiables, $notification, array $channels = null) + public function sendNow($notifiables, $notification, ?array $channels = null) { $notifiables = $this->formatNotifiables($notifiables); diff --git a/src/Illuminate/Notifications/RoutesNotifications.php b/src/Illuminate/Notifications/RoutesNotifications.php index 15aa673ff137..2744f3161127 100644 --- a/src/Illuminate/Notifications/RoutesNotifications.php +++ b/src/Illuminate/Notifications/RoutesNotifications.php @@ -25,7 +25,7 @@ public function notify($instance) * @param array|null $channels * @return void */ - public function notifyNow($instance, array $channels = null) + public function notifyNow($instance, ?array $channels = null) { app(Dispatcher::class)->sendNow($this, $instance, $channels); } diff --git a/src/Illuminate/Notifications/SendQueuedNotifications.php b/src/Illuminate/Notifications/SendQueuedNotifications.php index f63d7bf9afe4..3eca3cccea90 100644 --- a/src/Illuminate/Notifications/SendQueuedNotifications.php +++ b/src/Illuminate/Notifications/SendQueuedNotifications.php @@ -73,7 +73,7 @@ class SendQueuedNotifications implements ShouldQueue * @param array|null $channels * @return void */ - public function __construct($notifiables, $notification, array $channels = null) + public function __construct($notifiables, $notification, ?array $channels = null) { $this->channels = $channels; $this->notification = $notification; diff --git a/src/Illuminate/Pipeline/Hub.php b/src/Illuminate/Pipeline/Hub.php index 91e9b3f306b8..54b380b038a1 100644 --- a/src/Illuminate/Pipeline/Hub.php +++ b/src/Illuminate/Pipeline/Hub.php @@ -28,7 +28,7 @@ class Hub implements HubContract * @param \Illuminate\Contracts\Container\Container|null $container * @return void */ - public function __construct(Container $container = null) + public function __construct(?Container $container = null) { $this->container = $container; } diff --git a/src/Illuminate/Pipeline/Pipeline.php b/src/Illuminate/Pipeline/Pipeline.php index 0f32b6121125..ccae5189deeb 100644 --- a/src/Illuminate/Pipeline/Pipeline.php +++ b/src/Illuminate/Pipeline/Pipeline.php @@ -47,7 +47,7 @@ class Pipeline implements PipelineContract * @param \Illuminate\Contracts\Container\Container|null $container * @return void */ - public function __construct(Container $container = null) + public function __construct(?Container $container = null) { $this->container = $container; } diff --git a/src/Illuminate/Process/Factory.php b/src/Illuminate/Process/Factory.php index 9db688237667..08fb0390c3a4 100644 --- a/src/Illuminate/Process/Factory.php +++ b/src/Illuminate/Process/Factory.php @@ -85,7 +85,7 @@ public function sequence(array $processes = []) * @param \Closure|array|null $callback * @return $this */ - public function fake(Closure|array $callback = null) + public function fake(Closure|array|null $callback = null) { $this->recording = true; diff --git a/src/Illuminate/Process/FakeInvokedProcess.php b/src/Illuminate/Process/FakeInvokedProcess.php index ac6c4f3de1e9..5c43e0503fea 100644 --- a/src/Illuminate/Process/FakeInvokedProcess.php +++ b/src/Illuminate/Process/FakeInvokedProcess.php @@ -258,7 +258,7 @@ public function latestErrorOutput() * @param callable|null $output * @return \Illuminate\Contracts\Process\ProcessResult */ - public function wait(callable $output = null) + public function wait(?callable $output = null) { $this->outputHandler = $output ?: $this->outputHandler; diff --git a/src/Illuminate/Process/FakeProcessResult.php b/src/Illuminate/Process/FakeProcessResult.php index 73efc697f14e..72342b078aa9 100644 --- a/src/Illuminate/Process/FakeProcessResult.php +++ b/src/Illuminate/Process/FakeProcessResult.php @@ -175,7 +175,7 @@ public function seeInErrorOutput(string $output) * * @throws \Illuminate\Process\Exceptions\ProcessFailedException */ - public function throw(callable $callback = null) + public function throw(?callable $callback = null) { if ($this->successful()) { return $this; @@ -199,7 +199,7 @@ public function throw(callable $callback = null) * * @throws \Throwable */ - public function throwIf(bool $condition, callable $callback = null) + public function throwIf(bool $condition, ?callable $callback = null) { if ($condition) { return $this->throw($callback); diff --git a/src/Illuminate/Process/InvokedProcess.php b/src/Illuminate/Process/InvokedProcess.php index f0d3feb7bfa3..6f2a67095b0b 100644 --- a/src/Illuminate/Process/InvokedProcess.php +++ b/src/Illuminate/Process/InvokedProcess.php @@ -108,7 +108,7 @@ public function latestErrorOutput() * * @throws \Illuminate\Process\Exceptions\ProcessTimedOutException */ - public function wait(callable $output = null) + public function wait(?callable $output = null) { try { $this->process->wait($output); diff --git a/src/Illuminate/Process/PendingProcess.php b/src/Illuminate/Process/PendingProcess.php index 53ffdd130def..48a28f6b335a 100644 --- a/src/Illuminate/Process/PendingProcess.php +++ b/src/Illuminate/Process/PendingProcess.php @@ -241,7 +241,7 @@ public function options(array $options) * @throws \Illuminate\Process\Exceptions\ProcessTimedOutException * @throws \RuntimeException */ - public function run(array|string $command = null, callable $output = null) + public function run(array|string|null $command = null, ?callable $output = null) { $this->command = $command ?: $this->command; @@ -271,7 +271,7 @@ public function run(array|string $command = null, callable $output = null) * * @throws \RuntimeException */ - public function start(array|string $command = null, callable $output = null) + public function start(array|string|null $command = null, ?callable $output = null) { $this->command = $command ?: $this->command; diff --git a/src/Illuminate/Process/ProcessResult.php b/src/Illuminate/Process/ProcessResult.php index 2d17d822afa5..9bbf9c4aacc5 100644 --- a/src/Illuminate/Process/ProcessResult.php +++ b/src/Illuminate/Process/ProcessResult.php @@ -116,7 +116,7 @@ public function seeInErrorOutput(string $output) * * @throws \Illuminate\Process\Exceptions\ProcessFailedException */ - public function throw(callable $callback = null) + public function throw(?callable $callback = null) { if ($this->successful()) { return $this; @@ -140,7 +140,7 @@ public function throw(callable $callback = null) * * @throws \Throwable */ - public function throwIf(bool $condition, callable $callback = null) + public function throwIf(bool $condition, ?callable $callback = null) { if ($condition) { return $this->throw($callback); diff --git a/src/Illuminate/Queue/Capsule/Manager.php b/src/Illuminate/Queue/Capsule/Manager.php index c5ceb872666f..f6c263d17c6b 100644 --- a/src/Illuminate/Queue/Capsule/Manager.php +++ b/src/Illuminate/Queue/Capsule/Manager.php @@ -28,7 +28,7 @@ class Manager * @param \Illuminate\Container\Container|null $container * @return void */ - public function __construct(Container $container = null) + public function __construct(?Container $container = null) { $this->setupContainer($container ?: new Container); diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 2e7474f71c1e..c9f335a66467 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -111,7 +111,7 @@ public function __construct(QueueManager $manager, Dispatcher $events, ExceptionHandler $exceptions, callable $isDownForMaintenance, - callable $resetScope = null) + ?callable $resetScope = null) { $this->events = $events; $this->manager = $manager; diff --git a/src/Illuminate/Redis/Connections/PhpRedisConnection.php b/src/Illuminate/Redis/Connections/PhpRedisConnection.php index f3f99a346a75..d33b3cea660d 100644 --- a/src/Illuminate/Redis/Connections/PhpRedisConnection.php +++ b/src/Illuminate/Redis/Connections/PhpRedisConnection.php @@ -36,7 +36,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract * @param array $config * @return void */ - public function __construct($client, callable $connector = null, array $config = []) + public function __construct($client, ?callable $connector = null, array $config = []) { $this->client = $client; $this->config = $config; @@ -396,7 +396,7 @@ public function sscan($key, $cursor, $options = []) * @param callable|null $callback * @return \Redis|array */ - public function pipeline(callable $callback = null) + public function pipeline(?callable $callback = null) { $pipeline = $this->client()->pipeline(); @@ -411,7 +411,7 @@ public function pipeline(callable $callback = null) * @param callable|null $callback * @return \Redis|array */ - public function transaction(callable $callback = null) + public function transaction(?callable $callback = null) { $transaction = $this->client()->multi(); diff --git a/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php b/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php index fd2bf1215af1..8ff02768297f 100644 --- a/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php +++ b/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php @@ -125,7 +125,7 @@ public function sleep($sleep) * * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException */ - public function then(callable $callback, callable $failure = null) + public function then(callable $callback, ?callable $failure = null) { try { return (new ConcurrencyLimiter( diff --git a/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php b/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php index ddb321848fbf..8eedc1177c58 100644 --- a/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php +++ b/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php @@ -125,7 +125,7 @@ public function sleep($sleep) * * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException */ - public function then(callable $callback, callable $failure = null) + public function then(callable $callback, ?callable $failure = null) { try { return (new DurationLimiter( diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 4ddc0cc76c35..dac895dad212 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -140,7 +140,7 @@ class Router implements BindingRegistrar, RegistrarContract * @param \Illuminate\Container\Container|null $container * @return void */ - public function __construct(Dispatcher $events, Container $container = null) + public function __construct(Dispatcher $events, ?Container $container = null) { $this->events = $events; $this->routes = new RouteCollection; @@ -1161,7 +1161,7 @@ public function bind($key, $binder) * @param \Closure|null $callback * @return void */ - public function model($key, $class, Closure $callback = null) + public function model($key, $class, ?Closure $callback = null) { $this->bind($key, RouteBinding::forModel($this->container, $class, $callback)); } diff --git a/src/Illuminate/Session/DatabaseSessionHandler.php b/src/Illuminate/Session/DatabaseSessionHandler.php index 12aa3efe8cd1..0770c22f46e9 100644 --- a/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/src/Illuminate/Session/DatabaseSessionHandler.php @@ -59,7 +59,7 @@ class DatabaseSessionHandler implements ExistenceAwareInterface, SessionHandlerI * @param \Illuminate\Contracts\Container\Container|null $container * @return void */ - public function __construct(ConnectionInterface $connection, $table, $minutes, Container $container = null) + public function __construct(ConnectionInterface $connection, $table, $minutes, ?Container $container = null) { $this->table = $table; $this->minutes = $minutes; diff --git a/src/Illuminate/Session/Middleware/StartSession.php b/src/Illuminate/Session/Middleware/StartSession.php index 5077cf6f5b90..f4671adef07a 100644 --- a/src/Illuminate/Session/Middleware/StartSession.php +++ b/src/Illuminate/Session/Middleware/StartSession.php @@ -35,7 +35,7 @@ class StartSession * @param callable|null $cacheFactoryResolver * @return void */ - public function __construct(SessionManager $manager, callable $cacheFactoryResolver = null) + public function __construct(SessionManager $manager, ?callable $cacheFactoryResolver = null) { $this->manager = $manager; $this->cacheFactoryResolver = $cacheFactoryResolver; @@ -286,7 +286,7 @@ protected function sessionConfigured() * @param array|null $config * @return bool */ - protected function sessionIsPersistent(array $config = null) + protected function sessionIsPersistent(?array $config = null) { $config = $config ?: $this->manager->getSessionConfig(); diff --git a/src/Illuminate/Session/SymfonySessionDecorator.php b/src/Illuminate/Session/SymfonySessionDecorator.php index 02034910bb9e..1dd8455df252 100644 --- a/src/Illuminate/Session/SymfonySessionDecorator.php +++ b/src/Illuminate/Session/SymfonySessionDecorator.php @@ -75,7 +75,7 @@ public function setName(string $name) /** * {@inheritdoc} */ - public function invalidate(int $lifetime = null): bool + public function invalidate(?int $lifetime = null): bool { $this->store->invalidate(); @@ -85,7 +85,7 @@ public function invalidate(int $lifetime = null): bool /** * {@inheritdoc} */ - public function migrate(bool $destroy = false, int $lifetime = null): bool + public function migrate(bool $destroy = false, ?int $lifetime = null): bool { $this->store->migrate($destroy); diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 93da9b5eeced..ad976c0d8edf 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -63,7 +63,7 @@ protected function hasPackage($package) * @param string|null $composerBinary * @return bool */ - public function requirePackages(array $packages, bool $dev = false, Closure|OutputInterface $output = null, $composerBinary = null) + public function requirePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, $composerBinary = null) { $command = collect([ ...$this->findComposer($composerBinary), @@ -92,7 +92,7 @@ public function requirePackages(array $packages, bool $dev = false, Closure|Outp * @param string|null $composerBinary * @return bool */ - public function removePackages(array $packages, bool $dev = false, Closure|OutputInterface $output = null, $composerBinary = null) + public function removePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, $composerBinary = null) { $command = collect([ ...$this->findComposer($composerBinary), diff --git a/src/Illuminate/Support/Facades/Bus.php b/src/Illuminate/Support/Facades/Bus.php index 13fe1c9fedfc..6c22e027ea79 100644 --- a/src/Illuminate/Support/Facades/Bus.php +++ b/src/Illuminate/Support/Facades/Bus.php @@ -60,7 +60,7 @@ class Bus extends Facade * @param \Illuminate\Bus\BatchRepository|null $batchRepository * @return \Illuminate\Support\Testing\Fakes\BusFake */ - public static function fake($jobsToFake = [], BatchRepository $batchRepository = null) + public static function fake($jobsToFake = [], ?BatchRepository $batchRepository = null) { $actualDispatcher = static::isFake() ? static::getFacadeRoot()->dispatcher diff --git a/src/Illuminate/Support/Facades/Process.php b/src/Illuminate/Support/Facades/Process.php index 43b5b93a6578..4f3546d07c00 100644 --- a/src/Illuminate/Support/Facades/Process.php +++ b/src/Illuminate/Support/Facades/Process.php @@ -65,7 +65,7 @@ protected static function getFacadeAccessor() * @param \Closure|array|null $callback * @return \Illuminate\Process\Factory */ - public static function fake(Closure|array $callback = null) + public static function fake(Closure|array|null $callback = null) { return tap(static::getFacadeRoot(), function ($fake) use ($callback) { static::swap($fake->fake($callback)); diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 6217bb33ef82..d614ac62864c 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -959,7 +959,7 @@ public static function random($length = 16) * @param callable|null $factory * @return void */ - public static function createRandomStringsUsing(callable $factory = null) + public static function createRandomStringsUsing(?callable $factory = null) { static::$randomStringFactory = $factory; } @@ -1665,7 +1665,7 @@ public static function orderedUuid() * @param callable|null $factory * @return void */ - public static function createUuidsUsing(callable $factory = null) + public static function createUuidsUsing(?callable $factory = null) { static::$uuidFactory = $factory; } @@ -1710,7 +1710,7 @@ public static function createUuidsUsingSequence(array $sequence, $whenMissing = * @param \Closure|null $callback * @return \Ramsey\Uuid\UuidInterface */ - public static function freezeUuids(Closure $callback = null) + public static function freezeUuids(?Closure $callback = null) { $uuid = Str::uuid(); @@ -1772,7 +1772,7 @@ public static function createUlidsNormally() * @param callable|null $factory * @return void */ - public static function createUlidsUsing(callable $factory = null) + public static function createUlidsUsing(?callable $factory = null) { static::$ulidFactory = $factory; } @@ -1817,7 +1817,7 @@ public static function createUlidsUsingSequence(array $sequence, $whenMissing = * @param Closure|null $callback * @return Ulid */ - public static function freezeUlids(Closure $callback = null) + public static function freezeUlids(?Closure $callback = null) { $ulid = Str::ulid(); diff --git a/src/Illuminate/Support/Testing/Fakes/BusFake.php b/src/Illuminate/Support/Testing/Fakes/BusFake.php index e62fac4b08a8..780b2929c3bf 100644 --- a/src/Illuminate/Support/Testing/Fakes/BusFake.php +++ b/src/Illuminate/Support/Testing/Fakes/BusFake.php @@ -88,7 +88,7 @@ class BusFake implements Fake, QueueingDispatcher * @param \Illuminate\Bus\BatchRepository|null $batchRepository * @return void */ - public function __construct(QueueingDispatcher $dispatcher, $jobsToFake = [], BatchRepository $batchRepository = null) + public function __construct(QueueingDispatcher $dispatcher, $jobsToFake = [], ?BatchRepository $batchRepository = null) { $this->dispatcher = $dispatcher; $this->jobsToFake = Arr::wrap($jobsToFake); diff --git a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php index ee610a401069..526c111c38b2 100644 --- a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php +++ b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php @@ -296,7 +296,7 @@ public function send($notifiables, $notification) * @param array|null $channels * @return void */ - public function sendNow($notifiables, $notification, array $channels = null) + public function sendNow($notifiables, $notification, ?array $channels = null) { if (! $notifiables instanceof Collection && ! is_array($notifiables)) { $notifiables = [$notifiables]; diff --git a/src/Illuminate/Support/ValidatedInput.php b/src/Illuminate/Support/ValidatedInput.php index 70bc6c3d2e8c..0ed273772b23 100644 --- a/src/Illuminate/Support/ValidatedInput.php +++ b/src/Illuminate/Support/ValidatedInput.php @@ -280,7 +280,7 @@ public function hasAny($keys) * @param callable|null $default * @return $this|mixed */ - public function whenHas($key, callable $callback, callable $default = null) + public function whenHas($key, callable $callback, ?callable $default = null) { if ($this->has($key)) { return $callback(data_get($this->all(), $key)) ?: $this; @@ -358,7 +358,7 @@ public function anyFilled($keys) * @param callable|null $default * @return $this|mixed */ - public function whenFilled($key, callable $callback, callable $default = null) + public function whenFilled($key, callable $callback, ?callable $default = null) { if ($this->filled($key)) { return $callback(data_get($this->all(), $key)) ?: $this; @@ -379,7 +379,7 @@ public function whenFilled($key, callable $callback, callable $default = null) * @param callable|null $default * @return $this|mixed */ - public function whenMissing($key, callable $callback, callable $default = null) + public function whenMissing($key, callable $callback, ?callable $default = null) { if ($this->missing($key)) { return $callback(data_get($this->all(), $key)) ?: $this; diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 991f403f32d9..cdcf52f1546a 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -187,7 +187,7 @@ function object_get($object, $key, $default = null) * @param callable|null $callback * @return mixed */ - function optional($value = null, callable $callback = null) + function optional($value = null, ?callable $callback = null) { if (is_null($callback)) { return new Optional($value); @@ -427,7 +427,7 @@ function windows_os() * @param (callable(TValue): (TReturn))|null $callback * @return ($callback is null ? TValue : TReturn) */ - function with($value, callable $callback = null) + function with($value, ?callable $callback = null) { return is_null($callback) ? $value : $callback($value); } diff --git a/src/Illuminate/Testing/AssertableJsonString.php b/src/Illuminate/Testing/AssertableJsonString.php index 12f8f47f7e33..4be1299180b3 100644 --- a/src/Illuminate/Testing/AssertableJsonString.php +++ b/src/Illuminate/Testing/AssertableJsonString.php @@ -267,7 +267,7 @@ public function assertPathCanonicalizing($path, $expect) * @param array|null $responseData * @return $this */ - public function assertStructure(array $structure = null, $responseData = null) + public function assertStructure(?array $structure = null, $responseData = null) { if (is_null($structure)) { return $this->assertSimilar($this->decoded); diff --git a/src/Illuminate/Testing/Fluent/AssertableJson.php b/src/Illuminate/Testing/Fluent/AssertableJson.php index 5fd76d9a7de3..9afc94c7fd36 100644 --- a/src/Illuminate/Testing/Fluent/AssertableJson.php +++ b/src/Illuminate/Testing/Fluent/AssertableJson.php @@ -42,7 +42,7 @@ class AssertableJson implements Arrayable * @param string|null $path * @return void */ - protected function __construct(array $props, string $path = null) + protected function __construct(array $props, ?string $path = null) { $this->path = $path; $this->props = $props; @@ -69,7 +69,7 @@ protected function dotPath(string $key = ''): string * @param string|null $key * @return mixed */ - protected function prop(string $key = null) + protected function prop(?string $key = null) { return Arr::get($this->props, $key); } diff --git a/src/Illuminate/Testing/Fluent/Concerns/Debugging.php b/src/Illuminate/Testing/Fluent/Concerns/Debugging.php index e655556cf939..a2d69bf3e65a 100644 --- a/src/Illuminate/Testing/Fluent/Concerns/Debugging.php +++ b/src/Illuminate/Testing/Fluent/Concerns/Debugging.php @@ -10,7 +10,7 @@ trait Debugging * @param string|null $prop * @return $this */ - public function dump(string $prop = null): self + public function dump(?string $prop = null): self { dump($this->prop($prop)); @@ -23,7 +23,7 @@ public function dump(string $prop = null): self * @param string|null $prop * @return never */ - public function dd(string $prop = null): void + public function dd(?string $prop = null): void { dd($this->prop($prop)); } @@ -34,5 +34,5 @@ public function dd(string $prop = null): void * @param string|null $key * @return mixed */ - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); } diff --git a/src/Illuminate/Testing/Fluent/Concerns/Has.php b/src/Illuminate/Testing/Fluent/Concerns/Has.php index 7765f4a061a5..20bfe9d189e3 100644 --- a/src/Illuminate/Testing/Fluent/Concerns/Has.php +++ b/src/Illuminate/Testing/Fluent/Concerns/Has.php @@ -15,7 +15,7 @@ trait Has * @param int|null $length * @return $this */ - public function count($key, int $length = null): self + public function count($key, ?int $length = null): self { if (is_null($length)) { $path = $this->dotPath(); @@ -48,7 +48,7 @@ public function count($key, int $length = null): self * @param \Closure|null $callback * @return $this */ - public function has($key, $length = null, Closure $callback = null): self + public function has($key, $length = null, ?Closure $callback = null): self { $prop = $this->prop(); @@ -185,7 +185,7 @@ abstract protected function interactsWith(string $key): void; * @param string|null $key * @return mixed */ - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); /** * Instantiate a new "scope" at the path of the given key. diff --git a/src/Illuminate/Testing/Fluent/Concerns/Interaction.php b/src/Illuminate/Testing/Fluent/Concerns/Interaction.php index 15e7e9508f55..fc811fd95dd7 100644 --- a/src/Illuminate/Testing/Fluent/Concerns/Interaction.php +++ b/src/Illuminate/Testing/Fluent/Concerns/Interaction.php @@ -63,5 +63,5 @@ public function etc(): self * @param string|null $key * @return mixed */ - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); } diff --git a/src/Illuminate/Testing/Fluent/Concerns/Matching.php b/src/Illuminate/Testing/Fluent/Concerns/Matching.php index 9ff7a31823ea..cab4cb11dd70 100644 --- a/src/Illuminate/Testing/Fluent/Concerns/Matching.php +++ b/src/Illuminate/Testing/Fluent/Concerns/Matching.php @@ -224,7 +224,7 @@ abstract protected function dotPath(string $key = ''): string; * @param \Closure|null $scope * @return $this */ - abstract public function has(string $key, $value = null, Closure $scope = null); + abstract public function has(string $key, $value = null, ?Closure $scope = null); /** * Retrieve a prop within the current scope using "dot" notation. @@ -232,5 +232,5 @@ abstract public function has(string $key, $value = null, Closure $scope = null); * @param string|null $key * @return mixed */ - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); } diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 6a583f13b651..79e6a3256208 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -799,7 +799,7 @@ public function assertJsonMissingPath(string $path) * @param array|null $responseData * @return $this */ - public function assertJsonStructure(array $structure = null, $responseData = null) + public function assertJsonStructure(?array $structure = null, $responseData = null) { $this->decodeResponseJson()->assertStructure($structure, $responseData); diff --git a/src/Illuminate/Validation/Concerns/FormatsMessages.php b/src/Illuminate/Validation/Concerns/FormatsMessages.php index 2d68828d1b3a..39b68f9c61ce 100644 --- a/src/Illuminate/Validation/Concerns/FormatsMessages.php +++ b/src/Illuminate/Validation/Concerns/FormatsMessages.php @@ -361,7 +361,7 @@ protected function replacePositionPlaceholder($message, $attribute) * @param \Closure|null $modifier * @return string */ - protected function replaceIndexOrPositionPlaceholder($message, $attribute, $placeholder, Closure $modifier = null) + protected function replaceIndexOrPositionPlaceholder($message, $attribute, $placeholder, ?Closure $modifier = null) { $segments = explode('.', $attribute); diff --git a/src/Illuminate/Validation/Factory.php b/src/Illuminate/Validation/Factory.php index fcb669e176f6..6ebfcac50d2d 100755 --- a/src/Illuminate/Validation/Factory.php +++ b/src/Illuminate/Validation/Factory.php @@ -87,7 +87,7 @@ class Factory implements FactoryContract * @param \Illuminate\Contracts\Container\Container|null $container * @return void */ - public function __construct(Translator $translator, Container $container = null) + public function __construct(Translator $translator, ?Container $container = null) { $this->container = $container; $this->translator = $translator; diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index ed5028e322e4..91d3b6a2e67c 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -561,7 +561,7 @@ public function validateWithBag(string $errorBag) * @param array|null $keys * @return \Illuminate\Support\ValidatedInput|array */ - public function safe(array $keys = null) + public function safe(?array $keys = null) { return is_array($keys) ? (new ValidatedInput($this->validated()))->only($keys) @@ -1428,7 +1428,7 @@ public function addCustomAttributes(array $attributes) * @param callable|null $formatter * @return $this */ - public function setImplicitAttributesFormatter(callable $formatter = null) + public function setImplicitAttributesFormatter(?callable $formatter = null) { $this->implicitAttributesFormatter = $formatter; diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index c006bbd0f5c2..a7bb59e2bc51 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -808,7 +808,7 @@ public function getClassComponentAliases() * @param string|null $prefix * @return void */ - public function anonymousComponentPath(string $path, string $prefix = null) + public function anonymousComponentPath(string $path, ?string $prefix = null) { $prefixHash = md5($prefix ?: $path); @@ -830,7 +830,7 @@ public function anonymousComponentPath(string $path, string $prefix = null) * @param string|null $prefix * @return void */ - public function anonymousComponentNamespace(string $directory, string $prefix = null) + public function anonymousComponentNamespace(string $directory, ?string $prefix = null) { $prefix ??= $directory; diff --git a/src/Illuminate/View/Engines/CompilerEngine.php b/src/Illuminate/View/Engines/CompilerEngine.php index c69eab4acb75..d5447220138a 100755 --- a/src/Illuminate/View/Engines/CompilerEngine.php +++ b/src/Illuminate/View/Engines/CompilerEngine.php @@ -39,7 +39,7 @@ class CompilerEngine extends PhpEngine * @param \Illuminate\Filesystem\Filesystem|null $files * @return void */ - public function __construct(CompilerInterface $compiler, Filesystem $files = null) + public function __construct(CompilerInterface $compiler, ?Filesystem $files = null) { parent::__construct($files ?: new Filesystem); diff --git a/src/Illuminate/View/FileViewFinder.php b/src/Illuminate/View/FileViewFinder.php index 5502fe5ae870..107bf7c36bdc 100755 --- a/src/Illuminate/View/FileViewFinder.php +++ b/src/Illuminate/View/FileViewFinder.php @@ -50,7 +50,7 @@ class FileViewFinder implements ViewFinderInterface * @param array|null $extensions * @return void */ - public function __construct(Filesystem $files, array $paths, array $extensions = null) + public function __construct(Filesystem $files, array $paths, ?array $extensions = null) { $this->files = $files; $this->paths = array_map([$this, 'resolvePath'], $paths); diff --git a/src/Illuminate/View/View.php b/src/Illuminate/View/View.php index cdc6f8dfb5ba..676c40ef6333 100755 --- a/src/Illuminate/View/View.php +++ b/src/Illuminate/View/View.php @@ -153,7 +153,7 @@ protected function allFragments() * * @throws \Throwable */ - public function render(callable $callback = null) + public function render(?callable $callback = null) { try { $contents = $this->renderContents(); diff --git a/tests/Auth/AuthAccessGateTest.php b/tests/Auth/AuthAccessGateTest.php index ad817dc3d374..cc851c4fa7d3 100644 --- a/tests/Auth/AuthAccessGateTest.php +++ b/tests/Auth/AuthAccessGateTest.php @@ -786,7 +786,7 @@ public function testAllowIfAuthorizesCallbackResponseAllowed() public function testAllowsIfCallbackAcceptsGuestsWhenAuthenticated() { - $response = $this->getBasicGate()->allowIf(function (stdClass $user = null) { + $response = $this->getBasicGate()->allowIf(function (?stdClass $user = null) { return $user !== null; }); @@ -797,7 +797,7 @@ public function testAllowIfCallbackAcceptsGuestsWhenUnauthenticated() { $gate = $this->getBasicGate()->forUser(null); - $response = $gate->allowIf(function (stdClass $user = null) { + $response = $gate->allowIf(function (?stdClass $user = null) { return $user === null; }); @@ -924,7 +924,7 @@ public function testDenyIfAuthorizesCallbackResponseAllowed() public function testDenyIfCallbackAcceptsGuestsWhenAuthenticated() { - $response = $this->getBasicGate()->denyIf(function (stdClass $user = null) { + $response = $this->getBasicGate()->denyIf(function (?stdClass $user = null) { return $user === null; }); @@ -935,7 +935,7 @@ public function testDenyIfCallbackAcceptsGuestsWhenUnauthenticated() { $gate = $this->getBasicGate()->forUser(null); - $response = $gate->denyIf(function (stdClass $user = null) { + $response = $gate->denyIf(function (?stdClass $user = null) { return $user !== null; }); diff --git a/tests/Container/ContainerResolveNonInstantiableTest.php b/tests/Container/ContainerResolveNonInstantiableTest.php index 28f8f18fc923..5d568cb10e8e 100644 --- a/tests/Container/ContainerResolveNonInstantiableTest.php +++ b/tests/Container/ContainerResolveNonInstantiableTest.php @@ -44,7 +44,7 @@ class ParentClass */ public $i; - public function __construct(TestInterface $testObject = null, int $i = 0) + public function __construct(?TestInterface $testObject = null, int $i = 0) { $this->i = $i; } diff --git a/tests/Container/ContextualBindingTest.php b/tests/Container/ContextualBindingTest.php index 24de4287c6d2..3aa14cfedd19 100644 --- a/tests/Container/ContextualBindingTest.php +++ b/tests/Container/ContextualBindingTest.php @@ -581,7 +581,7 @@ class ContainerTestContextWithOptionalInnerDependency { public $inner; - public function __construct(ContainerTestContextInjectOne $inner = null) + public function __construct(?ContainerTestContextInjectOne $inner = null) { $this->inner = $inner; } diff --git a/tests/Routing/RoutingRouteTest.php b/tests/Routing/RoutingRouteTest.php index d75f92be6dd9..3811b6fd350f 100644 --- a/tests/Routing/RoutingRouteTest.php +++ b/tests/Routing/RoutingRouteTest.php @@ -1874,7 +1874,7 @@ public function testImplicitBindingsWithOptionalParameterWithExistingKeyInUri() $router = $this->getRouter(); $router->get('foo/{bar?}', [ 'middleware' => SubstituteBindings::class, - 'uses' => function (RoutingTestUserModel $bar = null) { + 'uses' => function (?RoutingTestUserModel $bar = null) { $this->assertInstanceOf(RoutingTestUserModel::class, $bar); return $bar->value; @@ -1888,7 +1888,7 @@ public function testImplicitBindingsWithMissingModelHandledByMissing() $router = $this->getRouter(); $router->get('foo/{bar}', [ 'middleware' => SubstituteBindings::class, - 'uses' => function (RouteModelBindingNullStub $bar = null) { + 'uses' => function (?RouteModelBindingNullStub $bar = null) { $this->assertInstanceOf(RouteModelBindingNullStub::class, $bar); return $bar->first(); @@ -1912,7 +1912,7 @@ public function testImplicitBindingsWithMissingModelHandledByMissingOnGroupLevel ->group(function () use ($router) { $router->get('foo/{bar}', [ 'middleware' => SubstituteBindings::class, - 'uses' => function (RouteModelBindingNullStub $bar = null) { + 'uses' => function (?RouteModelBindingNullStub $bar = null) { $this->assertInstanceOf(RouteModelBindingNullStub::class, $bar); return $bar->first(); @@ -1932,7 +1932,7 @@ public function testImplicitBindingsWithOptionalParameterWithNoKeyInUri() $router = $this->getRouter(); $router->get('foo/{bar?}', [ 'middleware' => SubstituteBindings::class, - 'uses' => function (RoutingTestUserModel $bar = null) { + 'uses' => function (?RoutingTestUserModel $bar = null) { $this->assertNull($bar); }, ]); @@ -1960,7 +1960,7 @@ public function testImplicitBindingsWithOptionalParameterWithNonExistingKeyInUri $router = $this->getRouter(); $router->get('foo/{bar?}', [ 'middleware' => SubstituteBindings::class, - 'uses' => function (RoutingTestNonExistingUserModel $bar = null) { + 'uses' => function (?RoutingTestNonExistingUserModel $bar = null) { $this->fail('ModelNotFoundException was expected.'); }, ]); @@ -2338,7 +2338,7 @@ public function reversedArguments($two, $one) // } - public function withModels(Request $request, RoutingTestUserModel $user, $defaultNull = null, RoutingTestTeamModel $team = null) + public function withModels(Request $request, RoutingTestUserModel $user, $defaultNull = null, ?RoutingTestTeamModel $team = null) { // } diff --git a/tests/Support/SupportCarbonTest.php b/tests/Support/SupportCarbonTest.php index 46bf5a2a468f..6244192916fe 100644 --- a/tests/Support/SupportCarbonTest.php +++ b/tests/Support/SupportCarbonTest.php @@ -41,7 +41,7 @@ public function testInstance() public function testCarbonIsMacroableWhenNotCalledStatically() { - Carbon::macro('diffInDecades', function (Carbon $dt = null, $abs = true) { + Carbon::macro('diffInDecades', function (?Carbon $dt = null, $abs = true) { return (int) ($this->diffInYears($dt, $abs) / 10); }); diff --git a/tests/Support/SupportReflectsClosuresTest.php b/tests/Support/SupportReflectsClosuresTest.php index 0cbd1340f833..49cf3aa753de 100644 --- a/tests/Support/SupportReflectsClosuresTest.php +++ b/tests/Support/SupportReflectsClosuresTest.php @@ -23,7 +23,7 @@ public function testReflectsClosures() // }); - $this->assertParameterTypes([null, ExampleParameter::class], function ($one, ExampleParameter $two = null) { + $this->assertParameterTypes([null, ExampleParameter::class], function ($one, ?ExampleParameter $two = null) { // });