Skip to content

Commit aeb03fb

Browse files
committed
Deprecate passing null as $message or $code to exceptions
1 parent 45fca28 commit aeb03fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Exception/MethodNotAllowedException.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
2727
*/
2828
public function __construct(array $allowedMethods, ?string $message = '', int $code = 0, \Throwable $previous = null)
2929
{
30+
if (null === $message) {
31+
trigger_deprecation('symfony/routing', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__);
32+
33+
$message = '';
34+
}
35+
3036
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
3137

3238
parent::__construct($message, $code, $previous);

0 commit comments

Comments
 (0)