summaryrefslogtreecommitdiff
path: root/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php
blob: 40a5fb7f8c852a23c84782dabc02f7bf5d2abb2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

namespace Symfony\Component\Debug\Tests\Fixtures;

class ToStringThrower
{
    private $exception;

    public function __construct(\Exception $e)
    {
        $this->exception = $e;
    }

    public function __toString()
    {
        try {
            throw $this->exception;
        } catch (\Exception $e) {
            // Using user_error() here is on purpose so we do not forget
            // that this alias also should work alongside with trigger_error().
            return user_error($e, E_USER_ERROR);
        }
    }
}