Skip to content

Fixing PHP 8.4 deprecations #68

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Exception/InternalHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class InternalHttpException extends HttpException
*
* @param \Symfony\Component\HttpFoundation\Response $response
* @param string $message
* @param \Exception $previous
* @param \Exception|null $previous
* @param array $headers
* @param int $code
* @return void
*/
public function __construct(Response $response, $message = null, Exception $previous = null, array $headers = [], $code = 0)
public function __construct(Response $response, $message = null, ?Exception $previous = null, array $headers = [], $code = 0)
{
$this->response = $response;

Expand Down
10 changes: 5 additions & 5 deletions src/Exception/RateLimitExceededException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class RateLimitExceededException extends HttpException
/**
* Create a new rate limit exceeded exception instance.
*
* @param string $message
* @param \Exception $previous
* @param array $headers
* @param int $code
* @param string $message
* @param \Exception|null $previous
* @param array $headers
* @param int $code
* @return void
*/
public function __construct($message = null, Exception $previous = null, $headers = [], $code = 0)
public function __construct($message = null, ?Exception $previous = null, $headers = [], $code = 0)
{
if (array_key_exists('X-RateLimit-Reset', $headers)) {
$headers['Retry-After'] = $headers['X-RateLimit-Reset'] - time();
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ResourceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class ResourceException extends HttpException implements MessageBagErrors
*
* @param string $message
* @param \Illuminate\Support\MessageBag|array $errors
* @param \Exception $previous
* @param \Exception|null $previous
* @param array $headers
* @param int $code
* @return void
*/
public function __construct($message = null, $errors = null, Exception $previous = null, $headers = [], $code = 0)
public function __construct($message = null, $errors = null, ?Exception $previous = null, $headers = [], $code = 0)
{
if (is_null($errors)) {
$this->errors = new MessageBag;
Expand Down
8 changes: 4 additions & 4 deletions src/Exception/UnknownVersionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class UnknownVersionException extends HttpException
/**
* Create a new unknown version exception instance.
*
* @param string $message
* @param \Exception $previous
* @param int $code
* @param string $message
* @param \Exception|null $previous
* @param int $code
* @return void
*/
public function __construct($message = null, Exception $previous = null, $code = 0)
public function __construct($message = null, ?Exception $previous = null, $code = 0)
{
parent::__construct(400, $message ?: 'The version given was unknown or has no registered routes.', $previous, [], $code);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ValidationHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class ValidationHttpException extends ResourceException
* Create a new validation HTTP exception instance.
*
* @param \Illuminate\Support\MessageBag|array $errors
* @param \Exception $previous
* @param \Exception|null $previous
* @param array $headers
* @param int $code
* @return void
*/
public function __construct($errors = null, Exception $previous = null, $headers = [], $code = 0)
public function __construct($errors = null, ?Exception $previous = null, $headers = [], $code = 0)
{
parent::__construct(null, $errors, $previous, $headers, $code);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class Response extends IlluminateResponse
/**
* Create a new response instance.
*
* @param mixed $content
* @param int $status
* @param array $headers
* @param \Dingo\Api\Transformer\Binding $binding
* @param mixed $content
* @param int $status
* @param array $headers
* @param \Dingo\Api\Transformer\Binding|null $binding
* @return void
*/
public function __construct($content, $status = 200, $headers = [], Binding $binding = null)
public function __construct($content, $status = 200, $headers = [], ?Binding $binding = null)
{
parent::__construct($content, $status, $headers);

Expand Down
12 changes: 6 additions & 6 deletions src/Http/Response/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function noContent()
* @param \Closure|null $after
* @return \Dingo\Api\Http\Response
*/
public function collection(Collection $collection, $transformer = null, $parameters = [], Closure $after = null)
public function collection(Collection $collection, $transformer = null, $parameters = [], ?Closure $after = null)
{
if ($collection->isEmpty()) {
$class = get_class($collection);
Expand Down Expand Up @@ -117,10 +117,10 @@ public function collection(Collection $collection, $transformer = null, $paramet
* @param object $item
* @param null|string|callable|object $transformer
* @param array $parameters
* @param \Closure $after
* @param \Closure|null $after
* @return \Dingo\Api\Http\Response
*/
public function item($item, $transformer = null, $parameters = [], Closure $after = null)
public function item($item, $transformer = null, $parameters = [], ?Closure $after = null)
{
// Check for $item being null
if (! is_null($item)) {
Expand Down Expand Up @@ -152,7 +152,7 @@ public function item($item, $transformer = null, $parameters = [], Closure $afte
* @param Closure|null $after
* @return Response
*/
public function array(array $array, $transformer = null, $parameters = [], Closure $after = null)
public function array(array $array, $transformer = null, $parameters = [], ?Closure $after = null)
{
if ($parameters instanceof \Closure) {
$after = $parameters;
Expand Down Expand Up @@ -180,10 +180,10 @@ public function array(array $array, $transformer = null, $parameters = [], Closu
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
* @param null|string|callable|object $transformer
* @param array $parameters
* @param \Closure $after
* @param \Closure|null $after
* @return \Dingo\Api\Http\Response
*/
public function paginator(Paginator $paginator, $transformer = null, array $parameters = [], Closure $after = null)
public function paginator(Paginator $paginator, $transformer = null, array $parameters = [], ?Closure $after = null)
{
if ($paginator->isEmpty()) {
$class = get_class($paginator);
Expand Down
4 changes: 2 additions & 2 deletions src/Transformer/Binding.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class Binding
* @param \Illuminate\Container\Container $container
* @param mixed $resolver
* @param array $parameters
* @param \Closure $callback
* @param \Closure|null $callback
* @return void
*/
public function __construct(Container $container, $resolver, array $parameters = [], Closure $callback = null)
public function __construct(Container $container, $resolver, array $parameters = [], ?Closure $callback = null)
{
$this->container = $container;
$this->resolver = $resolver;
Expand Down
6 changes: 3 additions & 3 deletions src/Transformer/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(Container $container, Adapter $adapter)
* @param \Closure|null $after
* @return \Dingo\Api\Transformer\Binding
*/
public function register($class, $resolver, array $parameters = [], Closure $after = null)
public function register($class, $resolver, array $parameters = [], ?Closure $after = null)
{
return $this->bindings[$class] = $this->createBinding($resolver, $parameters, $after);
}
Expand Down Expand Up @@ -124,10 +124,10 @@ public function getBinding($class)
*
* @param string|callable|object $resolver
* @param array $parameters
* @param \Closure $callback
* @param \Closure|null $callback
* @return \Dingo\Api\Transformer\Binding
*/
protected function createBinding($resolver, array $parameters = [], Closure $callback = null)
protected function createBinding($resolver, array $parameters = [], ?Closure $callback = null)
{
return new Binding($this->container, $resolver, $parameters, $callback);
}
Expand Down