No Description

FatalThrowableError.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Debug\Exception;
  11. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4.', FatalThrowableError::class), \E_USER_DEPRECATED);
  12. /**
  13. * Fatal Throwable Error.
  14. *
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. *
  17. * @deprecated since Symfony 4.4
  18. */
  19. class FatalThrowableError extends FatalErrorException
  20. {
  21. private $originalClassName;
  22. public function __construct(\Throwable $e)
  23. {
  24. $this->originalClassName = \get_class($e);
  25. if ($e instanceof \ParseError) {
  26. $severity = \E_PARSE;
  27. } elseif ($e instanceof \TypeError) {
  28. $severity = \E_RECOVERABLE_ERROR;
  29. } else {
  30. $severity = \E_ERROR;
  31. }
  32. \ErrorException::__construct(
  33. $e->getMessage(),
  34. $e->getCode(),
  35. $severity,
  36. $e->getFile(),
  37. $e->getLine(),
  38. $e->getPrevious()
  39. );
  40. $this->setTrace($e->getTrace());
  41. }
  42. public function getOriginalClassName(): string
  43. {
  44. return $this->originalClassName;
  45. }
  46. }