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
|
* @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);
|
return new NotFoundHttpException($message, $previous);
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ trait ControllerTrait
|
|||||||
*
|
*
|
||||||
* @final
|
* @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)) {
|
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".');
|
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
|
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]);
|
$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;
|
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);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class AutowiringFailedException extends RuntimeException
|
|||||||
private $serviceId;
|
private $serviceId;
|
||||||
private $messageCallback;
|
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;
|
$this->serviceId = $serviceId;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\DependencyInjection\Exception;
|
|||||||
*/
|
*/
|
||||||
class EnvParameterException extends InvalidArgumentException
|
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);
|
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class ParameterCircularReferenceException extends RuntimeException
|
|||||||
{
|
{
|
||||||
private $parameters;
|
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);
|
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 $key The requested parameter key
|
||||||
* @param string $sourceId The service id that references the non-existent parameter
|
* @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 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[] $alternatives Some parameter name alternatives
|
||||||
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
|
* @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->key = $key;
|
||||||
$this->sourceId = $sourceId;
|
$this->sourceId = $sourceId;
|
||||||
|
@ -21,7 +21,7 @@ class ServiceCircularReferenceException extends RuntimeException
|
|||||||
private $serviceId;
|
private $serviceId;
|
||||||
private $path;
|
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);
|
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 $sourceId;
|
||||||
private $alternatives;
|
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) {
|
if (null !== $msg) {
|
||||||
// no-op
|
// no-op
|
||||||
|
@ -20,7 +20,7 @@ final class FormatException extends \LogicException implements ExceptionInterfac
|
|||||||
{
|
{
|
||||||
private $context;
|
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;
|
$this->context = $context;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Dotenv\Exception;
|
|||||||
*/
|
*/
|
||||||
final class PathException extends \RuntimeException implements ExceptionInterface
|
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);
|
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
|
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 === $message) {
|
||||||
if (null === $path) {
|
if (null === $path) {
|
||||||
|
@ -22,7 +22,7 @@ class IOException extends \RuntimeException implements IOExceptionInterface
|
|||||||
{
|
{
|
||||||
private $path;
|
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;
|
$this->path = $path;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class HttpTransportException extends TransportException
|
|||||||
{
|
{
|
||||||
private $response;
|
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);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
|
|||||||
{
|
{
|
||||||
protected $allowedMethods = [];
|
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);
|
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class AccessDeniedException extends RuntimeException
|
|||||||
private $attributes = [];
|
private $attributes = [];
|
||||||
private $subject;
|
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);
|
parent::__construct($message, 403, $previous);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class CustomUserMessageAuthenticationException extends AuthenticationException
|
|||||||
|
|
||||||
private $messageData = [];
|
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);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Security\Core\Exception;
|
|||||||
*/
|
*/
|
||||||
class LogoutException extends RuntimeException
|
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);
|
parent::__construct($message, 403, $previous);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class ExtraAttributesException extends RuntimeException
|
|||||||
{
|
{
|
||||||
private $extraAttributes;
|
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));
|
$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
|
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);
|
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 string|null $parsedFile The file name where the error occurred
|
||||||
* @param \Exception|null $previous The previous exception
|
* @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->parsedFile = $parsedFile;
|
||||||
$this->parsedLine = $parsedLine;
|
$this->parsedLine = $parsedLine;
|
||||||
|
Reference in New Issue
Block a user