# upstream/trunk/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php

UpStream: a Project Management Plugin for WordPress, version trunk. 25 lines.

- Page: https://pluginprobe.com/plugins/upstream/trunk/code/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php
- Raw: https://pluginprobe.com/plugins/upstream/trunk/raw/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php
- Modified: 2024-05-22T12:40:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/upstream/trunk/code/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php#L10-L20`.

```php
<?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 trigger_error($e, E_USER_ERROR);
        }
    }
}

```
