Completed
Push — master ( 3640b5...5f7c83 )
by Anton
02:49
created

RenderException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
9
namespace Spiral\Views\Exceptions;
10
11
/**
12
 * Exception while rendering.
13
 */
14
class RenderException extends ViewsException
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function __construct(\Exception $previous = null)
20
    {
21
        parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
0 ignored issues
show
Bug introduced by
It seems like $previous is not always an object, but can also be of type null. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
22
        $this->file = $previous->file;
23
        $this->line = $previous->line;
24
    }
25
}