Passed
Push — master ( 8bc538...1c53d0 )
by Vsevolods
08:57
created

ConsoleErrorRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 2
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Framework\Debug\Renderer;
4
5
use Error;
6
use ErrorException;
7
use Symfony\Component\Console\Application;
8
use Symfony\Component\Console\Output\ConsoleOutput;
9
use Throwable;
10
use Venta\Contracts\Debug\ErrorRenderer;
11
12
/**
13
 * Class ConsoleErrorRenderer
14
 *
15
 * @package Venta\Debug\Renderer
16
 */
17
final class ConsoleErrorRenderer implements ErrorRenderer
18
{
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function render(Throwable $e)
24
    {
25
        if ($e instanceof Error) {
26
            $e = new ErrorException(
27
                $e->getMessage(), 0, $e->getCode(), $e->getFile(), $e->getLine(), $e->getPrevious()
28
            );
29
        }
30
31
        (new Application())->renderException($e, new ConsoleOutput());
1 ignored issue
show
Bug introduced by
It seems like $e defined by parameter $e on line 23 can also be of type object<Throwable>; however, Symfony\Component\Consol...tion::renderException() does only seem to accept object<Exception>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
32
    }
33
34
}