1 | <?php |
||
17 | class ExceptionRenderer |
||
18 | { |
||
19 | /** |
||
20 | * @var Highlighter |
||
21 | */ |
||
22 | private $highlighter; |
||
23 | |||
24 | /** |
||
25 | * ExceptionRenderer constructor. |
||
26 | * @param Highlighter $highlighter |
||
27 | */ |
||
28 | public function __construct(Highlighter $highlighter) |
||
32 | |||
33 | /** |
||
34 | * @param \Throwable $e |
||
35 | * @return string |
||
36 | */ |
||
37 | public function render(\Throwable $e): string |
||
45 | |||
46 | /** |
||
47 | * @param \Throwable $e |
||
48 | * @return string |
||
49 | */ |
||
50 | private function renderCode(\Throwable $e): string |
||
61 | |||
62 | /** |
||
63 | * @param \Throwable $e |
||
64 | * @return string |
||
65 | */ |
||
66 | private function renderHeader(\Throwable $e): string |
||
73 | |||
74 | /** |
||
75 | * @param string|object $class |
||
76 | * @return string |
||
77 | */ |
||
78 | private function classname($class): string |
||
84 | |||
85 | /** |
||
86 | * @param \Throwable $e |
||
87 | * @return string |
||
88 | */ |
||
89 | private function renderFileHeader(\Throwable $e): string |
||
96 | |||
97 | /** |
||
98 | * @param \Throwable $e |
||
99 | * @return string |
||
100 | */ |
||
101 | private function renderTrace(\Throwable $e): string |
||
116 | |||
117 | /** |
||
118 | * @param array $trace |
||
119 | * @return string |
||
120 | */ |
||
121 | private function traceArguments(array $trace): string |
||
131 | |||
132 | /** |
||
133 | * @param array $trace |
||
134 | * @return string |
||
135 | */ |
||
136 | private function traceInvocation(array $trace): string |
||
142 | } |
||
143 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.