Skip to content

Commit 64dd49d

Browse files
derrabusnicolas-grekas
authored andcommitted
Switched to non-null defaults in exception constructors
1 parent a3050e0 commit 64dd49d

32 files changed

+102
-87
lines changed

Exception/AccessDeniedHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
class AccessDeniedHttpException extends HttpException
1919
{
2020
/**
21-
* @param string $message The internal exception message
22-
* @param \Throwable $previous The previous exception
23-
* @param int $code The internal exception code
21+
* @param string|null $message The internal exception message
22+
* @param \Throwable|null $previous The previous exception
23+
* @param int $code The internal exception code
2424
*/
25-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
25+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2626
{
2727
parent::__construct(403, $message, $previous, $headers, $code);
2828
}

Exception/BadRequestHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class BadRequestHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(400, $message, $previous, $headers, $code);
2727
}

Exception/ConflictHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class ConflictHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(409, $message, $previous, $headers, $code);
2727
}

Exception/GoneHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class GoneHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(410, $message, $previous, $headers, $code);
2727
}

Exception/HttpException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface
2121
private $statusCode;
2222
private $headers;
2323

24-
public function __construct(int $statusCode, string $message = null, \Throwable $previous = null, array $headers = [], ?int $code = 0)
24+
public function __construct(int $statusCode, ?string $message = '', \Throwable $previous = null, array $headers = [], ?int $code = 0)
2525
{
2626
$this->statusCode = $statusCode;
2727
$this->headers = $headers;

Exception/LengthRequiredHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class LengthRequiredHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(411, $message, $previous, $headers, $code);
2727
}

Exception/MethodNotAllowedHttpException.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
class MethodNotAllowedHttpException extends HttpException
1818
{
1919
/**
20-
* @param array $allow An array of allowed methods
21-
* @param string $message The internal exception message
22-
* @param \Throwable $previous The previous exception
23-
* @param int $code The internal exception code
20+
* @param string[] $allow An array of allowed methods
21+
* @param string|null $message The internal exception message
22+
* @param \Throwable|null $previous The previous exception
23+
* @param int|null $code The internal exception code
2424
*/
25-
public function __construct(array $allow, string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
25+
public function __construct(array $allow, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = [])
2626
{
2727
$headers['Allow'] = strtoupper(implode(', ', $allow));
2828

Exception/NotAcceptableHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class NotAcceptableHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(406, $message, $previous, $headers, $code);
2727
}

Exception/NotFoundHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class NotFoundHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(404, $message, $previous, $headers, $code);
2727
}

Exception/PreconditionFailedHttpException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class PreconditionFailedHttpException extends HttpException
1818
{
1919
/**
20-
* @param string $message The internal exception message
21-
* @param \Throwable $previous The previous exception
22-
* @param int $code The internal exception code
20+
* @param string|null $message The internal exception message
21+
* @param \Throwable|null $previous The previous exception
22+
* @param int $code The internal exception code
2323
*/
24-
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
24+
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
2525
{
2626
parent::__construct(412, $message, $previous, $headers, $code);
2727
}

0 commit comments

Comments
 (0)