ContextErrorException.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  12. * Error Exception with Variable Context.
  13. *
  14. * @author Christian Sciberras <uuf6429@gmail.com>
  15. *
  16. * @deprecated since version 3.3. Instead, \ErrorException will be used directly in 4.0.
  17. */
  18. class ContextErrorException extends \ErrorException
  19. {
  20. private $context = array();
  21. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  22. {
  23. parent::__construct($message, $code, $severity, $filename, $lineno);
  24. $this->context = $context;
  25. }
  26. /**
  27. * @return array Array of variables that existed when the exception occurred
  28. */
  29. public function getContext()
  30. {
  31. @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
  32. return $this->context;
  33. }
  34. }