feature #34332 Allow \Throwable $previous everywhere (fancyweb)
This PR was merged into the 4.4 branch.
Discussion
----------
Allow \Throwable $previous everywhere
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Commits
-------
59e044dfb1
Allow \Throwable $previous everywhere
This commit is contained in:
commit
686e9b7d72
|
@ -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".');
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in New Issue