Skip to content

Commit

Permalink
[10.x] PHP 8.4 Code Compatibility (#53612)
Browse files Browse the repository at this point in the history
* [10.x] PHP 8.4 Code Compatibility

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* Apply fixes from StyleCI

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

---------

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
  • Loading branch information
crynobone and StyleCIBot authored Nov 21, 2024
1 parent 33d2445 commit f7a566f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Client/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Client/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions Concerns/InteractsWithInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Exceptions/PostTooLargeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Exceptions/ThrottleRequestsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f7a566f

Please sign in to comment.