Completed
Pull Request — master (#1)
by
unknown
09:06
created

FatalErrorException   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 18
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
C __construct() 0 54 17
A setTrace() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Symfony\Component\HttpKernel\Exception;
13
14
/**
15
 * Fatal Error Exception.
16
 *
17
 * @author Fabien Potencier <[email protected]>
18
 * @author Konstanton Myakshin <[email protected]>
19
 * @author Nicolas Grekas <[email protected]>
20
 *
21
 * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
22
 */
23
class FatalErrorException extends \ErrorException
24
{
25
}
26
27
namespace Symfony\Component\Debug\Exception;
28
29
use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
30
31
/**
32
 * Fatal Error Exception.
33
 *
34
 * @author Konstanton Myakshin <[email protected]>
35
 */
36
class FatalErrorException extends LegacyFatalErrorException
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\HttpKe...ion\FatalErrorException has been deprecated with message: Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
37
{
38
    public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
39
    {
40
        parent::__construct($message, $code, $severity, $filename, $lineno);
41
42
        if (null !== $trace) {
43
            if (!$traceArgs) {
44
                foreach ($trace as &$frame) {
45
                    unset($frame['args'], $frame['this'], $frame);
46
                }
47
            }
48
49
            $this->setTrace($trace);
50
        } elseif (null !== $traceOffset) {
51
            if (function_exists('xdebug_get_function_stack')) {
52
                $trace = xdebug_get_function_stack();
53
                if (0 < $traceOffset) {
54
                    array_splice($trace, -$traceOffset);
55
                }
56
57
                foreach ($trace as &$frame) {
58
                    if (!isset($frame['type'])) {
59
                        // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
60
                        if (isset($frame['class'])) {
61
                            $frame['type'] = '::';
62
                        }
63
                    } elseif ('dynamic' === $frame['type']) {
64
                        $frame['type'] = '->';
65
                    } elseif ('static' === $frame['type']) {
66
                        $frame['type'] = '::';
67
                    }
68
69
                    // XDebug also has a different name for the parameters array
70
                    if (!$traceArgs) {
71
                        unset($frame['params'], $frame['args']);
72
                    } elseif (isset($frame['params']) && !isset($frame['args'])) {
73
                        $frame['args'] = $frame['params'];
74
                        unset($frame['params']);
75
                    }
76
                }
77
78
                unset($frame);
79
                $trace = array_reverse($trace);
80
            } elseif (function_exists('symfony_debug_backtrace')) {
81
                $trace = symfony_debug_backtrace();
82
                if (0 < $traceOffset) {
83
                    array_splice($trace, 0, $traceOffset);
84
                }
85
            } else {
86
                $trace = array();
87
            }
88
89
            $this->setTrace($trace);
90
        }
91
    }
92
93
    protected function setTrace($trace)
94
    {
95
        $traceReflector = new \ReflectionProperty('Exception', 'trace');
96
        $traceReflector->setAccessible(true);
97
        $traceReflector->setValue($this, $trace);
98
    }
99
}
100