From 59e044dfb10e0c233ac22378195d19235fed986f Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 12 Nov 2019 15:50:35 +0100 Subject: [PATCH] Allow \Throwable $previous everywhere --- .../Bundle/FrameworkBundle/Controller/ControllerTrait.php | 4 ++-- .../Exception/FileLoaderImportCircularReferenceException.php | 2 +- .../Config/Exception/FileLocatorFileNotFoundException.php | 2 +- .../Exception/AutowiringFailedException.php | 2 +- .../DependencyInjection/Exception/EnvParameterException.php | 2 +- .../Exception/ParameterCircularReferenceException.php | 2 +- .../Exception/ParameterNotFoundException.php | 4 ++-- .../Exception/ServiceCircularReferenceException.php | 2 +- .../Exception/ServiceNotFoundException.php | 2 +- src/Symfony/Component/Dotenv/Exception/FormatException.php | 2 +- src/Symfony/Component/Dotenv/Exception/PathException.php | 2 +- .../Component/Filesystem/Exception/FileNotFoundException.php | 2 +- src/Symfony/Component/Filesystem/Exception/IOException.php | 2 +- .../Component/Mailer/Exception/HttpTransportException.php | 2 +- .../Component/Routing/Exception/MethodNotAllowedException.php | 2 +- .../Security/Core/Exception/AccessDeniedException.php | 2 +- .../Exception/CustomUserMessageAuthenticationException.php | 2 +- .../Component/Security/Core/Exception/LogoutException.php | 2 +- .../Serializer/Exception/ExtraAttributesException.php | 2 +- .../Component/VarDumper/Exception/ThrowingCasterException.php | 4 ++-- src/Symfony/Component/Yaml/Exception/ParseException.php | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php index fd80fd4704..e5a1e109fa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php @@ -288,7 +288,7 @@ trait ControllerTrait * * @final */ - protected function createNotFoundException(string $message = 'Not Found', \Exception $previous = null): NotFoundHttpException + protected function createNotFoundException(string $message = 'Not Found', \Throwable $previous = null): NotFoundHttpException { return new NotFoundHttpException($message, $previous); } @@ -304,7 +304,7 @@ trait ControllerTrait * * @final */ - protected function createAccessDeniedException(string $message = 'Access Denied.', \Exception $previous = null): AccessDeniedException + protected function createAccessDeniedException(string $message = 'Access Denied.', \Throwable $previous = null): AccessDeniedException { if (!class_exists(AccessDeniedException::class)) { throw new \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require symfony/security-bundle".'); diff --git a/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php b/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php index da9105d0a5..8c5e736524 100644 --- a/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php +++ b/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Config\Exception; */ class FileLoaderImportCircularReferenceException extends LoaderLoadException { - public function __construct(array $resources, int $code = null, \Exception $previous = null) + public function __construct(array $resources, int $code = null, \Throwable $previous = null) { $message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]); diff --git a/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php b/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php index d8dad76a0a..3ee4b938f4 100644 --- a/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php +++ b/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php @@ -20,7 +20,7 @@ class FileLocatorFileNotFoundException extends \InvalidArgumentException { private $paths; - public function __construct(string $message = '', int $code = 0, \Exception $previous = null, array $paths = []) + public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, array $paths = []) { parent::__construct($message, $code, $previous); diff --git a/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php b/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php index 99a5b17ccd..c203b85bae 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php @@ -19,7 +19,7 @@ class AutowiringFailedException extends RuntimeException private $serviceId; private $messageCallback; - public function __construct(string $serviceId, $message = '', int $code = 0, \Exception $previous = null) + public function __construct(string $serviceId, $message = '', int $code = 0, \Throwable $previous = null) { $this->serviceId = $serviceId; diff --git a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php index c758ce1438..48b5e486ae 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php @@ -18,7 +18,7 @@ namespace Symfony\Component\DependencyInjection\Exception; */ class EnvParameterException extends InvalidArgumentException { - public function __construct(array $envs, \Exception $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') + public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') { parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous); } diff --git a/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php b/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php index e17e4024fd..2450ccb5c7 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php @@ -20,7 +20,7 @@ class ParameterCircularReferenceException extends RuntimeException { private $parameters; - public function __construct(array $parameters, \Exception $previous = null) + public function __construct(array $parameters, \Throwable $previous = null) { parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous); diff --git a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php index 9fdc2fd775..7c0c5e3087 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php @@ -30,11 +30,11 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not * @param string $key The requested parameter key * @param string $sourceId The service id that references the non-existent parameter * @param string $sourceKey The parameter key that references the non-existent parameter - * @param \Exception $previous The previous exception + * @param \Throwable $previous The previous exception * @param string[] $alternatives Some parameter name alternatives * @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters */ - public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Exception $previous = null, array $alternatives = [], string $nonNestedAlternative = null) + public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null) { $this->key = $key; $this->sourceId = $sourceId; diff --git a/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php b/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php index 5936b3a6d7..a38671bcf2 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php @@ -21,7 +21,7 @@ class ServiceCircularReferenceException extends RuntimeException private $serviceId; private $path; - public function __construct(string $serviceId, array $path, \Exception $previous = null) + public function __construct(string $serviceId, array $path, \Throwable $previous = null) { parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous); diff --git a/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php b/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php index 5c63aea062..f91afae397 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php @@ -24,7 +24,7 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo private $sourceId; private $alternatives; - public function __construct(string $id, string $sourceId = null, \Exception $previous = null, array $alternatives = [], string $msg = null) + public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null) { if (null !== $msg) { // no-op diff --git a/src/Symfony/Component/Dotenv/Exception/FormatException.php b/src/Symfony/Component/Dotenv/Exception/FormatException.php index adccc8c8d1..3ac77e592d 100644 --- a/src/Symfony/Component/Dotenv/Exception/FormatException.php +++ b/src/Symfony/Component/Dotenv/Exception/FormatException.php @@ -20,7 +20,7 @@ final class FormatException extends \LogicException implements ExceptionInterfac { private $context; - public function __construct(string $message, FormatExceptionContext $context, int $code = 0, \Exception $previous = null) + public function __construct(string $message, FormatExceptionContext $context, int $code = 0, \Throwable $previous = null) { $this->context = $context; diff --git a/src/Symfony/Component/Dotenv/Exception/PathException.php b/src/Symfony/Component/Dotenv/Exception/PathException.php index 6a82e94100..4a4d717222 100644 --- a/src/Symfony/Component/Dotenv/Exception/PathException.php +++ b/src/Symfony/Component/Dotenv/Exception/PathException.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Dotenv\Exception; */ final class PathException extends \RuntimeException implements ExceptionInterface { - public function __construct(string $path, int $code = 0, \Exception $previous = null) + public function __construct(string $path, int $code = 0, \Throwable $previous = null) { parent::__construct(sprintf('Unable to read the "%s" environment file.', $path), $code, $previous); } diff --git a/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php b/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php index f941b536e7..48b6408095 100644 --- a/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php +++ b/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php @@ -19,7 +19,7 @@ namespace Symfony\Component\Filesystem\Exception; */ class FileNotFoundException extends IOException { - public function __construct(string $message = null, int $code = 0, \Exception $previous = null, string $path = null) + public function __construct(string $message = null, int $code = 0, \Throwable $previous = null, string $path = null) { if (null === $message) { if (null === $path) { diff --git a/src/Symfony/Component/Filesystem/Exception/IOException.php b/src/Symfony/Component/Filesystem/Exception/IOException.php index f02cbd885c..fea26e4ddc 100644 --- a/src/Symfony/Component/Filesystem/Exception/IOException.php +++ b/src/Symfony/Component/Filesystem/Exception/IOException.php @@ -22,7 +22,7 @@ class IOException extends \RuntimeException implements IOExceptionInterface { private $path; - public function __construct(string $message, int $code = 0, \Exception $previous = null, string $path = null) + public function __construct(string $message, int $code = 0, \Throwable $previous = null, string $path = null) { $this->path = $path; diff --git a/src/Symfony/Component/Mailer/Exception/HttpTransportException.php b/src/Symfony/Component/Mailer/Exception/HttpTransportException.php index f9e49aaeda..f672acc6f1 100644 --- a/src/Symfony/Component/Mailer/Exception/HttpTransportException.php +++ b/src/Symfony/Component/Mailer/Exception/HttpTransportException.php @@ -20,7 +20,7 @@ class HttpTransportException extends TransportException { private $response; - public function __construct(string $message = null, ResponseInterface $response, int $code = 0, \Exception $previous = null) + public function __construct(string $message = null, ResponseInterface $response, int $code = 0, \Throwable $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php index e129ec8bf2..b897081bd5 100644 --- a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php +++ b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php @@ -22,7 +22,7 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn { protected $allowedMethods = []; - public function __construct(array $allowedMethods, string $message = null, int $code = 0, \Exception $previous = null) + public function __construct(array $allowedMethods, string $message = null, int $code = 0, \Throwable $previous = null) { $this->allowedMethods = array_map('strtoupper', $allowedMethods); diff --git a/src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php b/src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php index c8e7f7b8ee..0e59dc4077 100644 --- a/src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php +++ b/src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php @@ -21,7 +21,7 @@ class AccessDeniedException extends RuntimeException private $attributes = []; private $subject; - public function __construct(string $message = 'Access Denied.', \Exception $previous = null) + public function __construct(string $message = 'Access Denied.', \Throwable $previous = null) { parent::__construct($message, 403, $previous); } diff --git a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php index b64d267b48..203e8ba133 100644 --- a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php @@ -26,7 +26,7 @@ class CustomUserMessageAuthenticationException extends AuthenticationException private $messageData = []; - public function __construct(string $message = '', array $messageData = [], int $code = 0, \Exception $previous = null) + public function __construct(string $message = '', array $messageData = [], int $code = 0, \Throwable $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Symfony/Component/Security/Core/Exception/LogoutException.php b/src/Symfony/Component/Security/Core/Exception/LogoutException.php index cd9e5b2268..7058c6244b 100644 --- a/src/Symfony/Component/Security/Core/Exception/LogoutException.php +++ b/src/Symfony/Component/Security/Core/Exception/LogoutException.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Security\Core\Exception; */ class LogoutException extends RuntimeException { - public function __construct(string $message = 'Logout Exception', \Exception $previous = null) + public function __construct(string $message = 'Logout Exception', \Throwable $previous = null) { parent::__construct($message, 403, $previous); } diff --git a/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php b/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php index 74d87f87f5..b8fb86beef 100644 --- a/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php +++ b/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php @@ -20,7 +20,7 @@ class ExtraAttributesException extends RuntimeException { private $extraAttributes; - public function __construct(array $extraAttributes, \Exception $previous = null) + public function __construct(array $extraAttributes, \Throwable $previous = null) { $msg = sprintf('Extra attributes are not allowed ("%s" are unknown).', implode('", "', $extraAttributes)); diff --git a/src/Symfony/Component/VarDumper/Exception/ThrowingCasterException.php b/src/Symfony/Component/VarDumper/Exception/ThrowingCasterException.php index af47753ad5..122f0d358a 100644 --- a/src/Symfony/Component/VarDumper/Exception/ThrowingCasterException.php +++ b/src/Symfony/Component/VarDumper/Exception/ThrowingCasterException.php @@ -17,9 +17,9 @@ namespace Symfony\Component\VarDumper\Exception; class ThrowingCasterException extends \Exception { /** - * @param \Exception $prev The exception thrown from the caster + * @param \Throwable $prev The exception thrown from the caster */ - public function __construct(\Exception $prev) + public function __construct(\Throwable $prev) { parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev); } diff --git a/src/Symfony/Component/Yaml/Exception/ParseException.php b/src/Symfony/Component/Yaml/Exception/ParseException.php index 95efe68fbb..ce623a3f9a 100644 --- a/src/Symfony/Component/Yaml/Exception/ParseException.php +++ b/src/Symfony/Component/Yaml/Exception/ParseException.php @@ -30,7 +30,7 @@ class ParseException extends RuntimeException * @param string|null $parsedFile The file name where the error occurred * @param \Exception|null $previous The previous exception */ - public function __construct(string $message, int $parsedLine = -1, string $snippet = null, string $parsedFile = null, \Exception $previous = null) + public function __construct(string $message, int $parsedLine = -1, string $snippet = null, string $parsedFile = null, \Throwable $previous = null) { $this->parsedFile = $parsedFile; $this->parsedLine = $parsedLine;