ToStringThrower.php 541B

12345678910111213141516171819202122232425
  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 user_error($e, E_USER_ERROR);
  18. }
  19. }
  20. }