ToStringThrower.php 544 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Symfony\Component\Debug\Tests\Fixtures;
  3. class ToStringThrower
  4. {
  5. private $exception;
  6. public function __construct(\Exception $e)
  7. {
  8. $this->exception = $e;
  9. }
  10. public function __toString()
  11. {
  12. try {
  13. throw $this->exception;
  14. } catch (\Exception $e) {
  15. // Using user_error() here is on purpose so we do not forget
  16. // that this alias also should work alongside with trigger_error().
  17. return trigger_error($e, E_USER_ERROR);
  18. }
  19. }
  20. }