Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Explicit nullable parameter declarations to fix PHP 8.4 deprecation #50921

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@
"doctrine/dbal": "^3.5.1",
"fakerphp/faker": "^1.21",
"guzzlehttp/guzzle": "^7.5",
"laravel/pint": "^1.15.1",
"league/flysystem-aws-s3-v3": "^3.0",
"league/flysystem-ftp": "^3.0",
"league/flysystem-path-prefixing": "^3.3",
133 changes: 133 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"rules": {
"array_indentation": false,
"array_syntax": false,
"binary_operator_spaces": false,
"blank_line_after_namespace": false,
"blank_line_after_opening_tag": false,
"blank_line_before_statement": false,
"blank_line_between_import_groups": false,
"blank_lines_before_namespace": false,
"braces_position": false,
"cast_spaces": false,
"class_attributes_separation": false,
"class_definition": false,
"clean_namespace": false,
"compact_nullable_type_declaration": false,
"concat_space": false,
"constant_case": false,
"control_structure_braces": false,
"control_structure_continuation_position": false,
"declare_equal_normalize": false,
"declare_parentheses": false,
"elseif": false,
"encoding": false,
"full_opening_tag": false,
"fully_qualified_strict_types": false,
"function_declaration": false,
"general_phpdoc_tag_rename": false,
"heredoc_to_nowdoc": false,
"include": false,
"increment_style": false,
"indentation_type": false,
"integer_literal_case": false,
"lambda_not_used_import": false,
"line_ending": false,
"linebreak_after_opening_tag": false,
"list_syntax": false,
"lowercase_cast": false,
"lowercase_keywords": false,
"lowercase_static_reference": false,
"magic_constant_casing": false,
"magic_method_casing": false,
"method_argument_space": false,
"method_chaining_indentation": false,
"multiline_whitespace_before_semicolons": false,
"native_function_casing": false,
"native_type_declaration_casing": false,
"no_alias_functions": false,
"no_alias_language_construct_call": false,
"no_alternative_syntax": false,
"no_binary_string": false,
"no_blank_lines_after_class_opening": false,
"no_blank_lines_after_phpdoc": false,
"no_closing_tag": false,
"no_empty_phpdoc": false,
"no_empty_statement": false,
"no_extra_blank_lines": false,
"no_leading_import_slash": false,
"no_leading_namespace_whitespace": false,
"no_mixed_echo_print": false,
"no_multiline_whitespace_around_double_arrow": false,
"no_multiple_statements_per_line": false,
"no_short_bool_cast": false,
"no_singleline_whitespace_before_semicolons": false,
"no_space_around_double_colon": false,
"no_spaces_after_function_name": false,
"no_spaces_around_offset": false,
"no_superfluous_phpdoc_tags": false,
"no_trailing_comma_in_singleline": false,
"no_trailing_whitespace": false,
"no_trailing_whitespace_in_comment": false,
"no_unneeded_control_parentheses": false,
"no_unneeded_braces": false,
"no_unreachable_default_argument_value": false,
"no_unset_cast": false,
"no_unused_imports": false,
"no_useless_return": false,
"no_whitespace_before_comma_in_array": false,
"no_whitespace_in_blank_line": false,
"normalize_index_brace": false,
"not_operator_with_successor_space": false,
"nullable_type_declaration": false,
"nullable_type_declaration_for_default_null_value": true,
"object_operator_without_whitespace": false,
"ordered_imports": false,
"ordered_interfaces": false,
"ordered_traits": false,
"phpdoc_align": false,
"phpdoc_indent": false,
"phpdoc_inline_tag_normalizer": false,
"phpdoc_no_access": false,
"phpdoc_no_package": false,
"phpdoc_no_useless_inheritdoc": false,
"phpdoc_order": false,
"phpdoc_scalar": false,
"phpdoc_separation": false,
"phpdoc_single_line_var_spacing": false,
"phpdoc_summary": false,
"phpdoc_tag_type": false,
"phpdoc_to_comment": false,
"phpdoc_trim": false,
"phpdoc_types": false,
"phpdoc_var_without_name": false,
"psr_autoloading": false,
"return_type_declaration": false,
"self_accessor": false,
"self_static_accessor": false,
"short_scalar_cast": false,
"simplified_null_return": false,
"single_blank_line_at_eof": false,
"single_class_element_per_statement": false,
"single_import_per_statement": false,
"single_line_after_imports": false,
"single_line_comment_style": false,
"single_quote": false,
"single_space_around_construct": false,
"space_after_semicolon": false,
"spaces_inside_parentheses": false,
"standardize_not_equals": false,
"statement_indentation": false,
"switch_case_semicolon_to_colon": false,
"switch_case_space": false,
"ternary_operator_spaces": false,
"trailing_comma_in_multiline": false,
"trim_array_spaces": false,
"type_declaration_spaces": false,
"types_spaces": false,
"unary_operator_spaces": false,
"visibility_required": false,
"whitespace_after_comma_in_array": false,
"yoda_style": false
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/Access/AuthorizationException.php
Original file line number Diff line number Diff line change
@@ -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);

4 changes: 2 additions & 2 deletions src/Illuminate/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
@@ -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',
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/Passwords/PasswordBroker.php
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/RequestGuard.php
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
@@ -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;
6 changes: 3 additions & 3 deletions src/Illuminate/Broadcasting/BroadcastManager.php
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/Batch.php
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/RedisTagSet.php
Original file line number Diff line number Diff line change
@@ -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();

4 changes: 2 additions & 2 deletions src/Illuminate/Collections/Arr.php
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
@@ -381,7 +381,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));
@@ -399,7 +399,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);
}
@@ -747,7 +747,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);
}
20 changes: 10 additions & 10 deletions src/Illuminate/Collections/Enumerable.php
Original file line number Diff line number Diff line change
@@ -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.
Loading