1 | <?php |
||
18 | class ExceptionRenderer |
||
19 | { |
||
20 | /** |
||
21 | * @var Highlighter |
||
22 | */ |
||
23 | private $highlighter; |
||
24 | |||
25 | /** |
||
26 | * ExceptionRenderer constructor. |
||
27 | * @param Highlighter $highlighter |
||
28 | */ |
||
29 | public function __construct(Highlighter $highlighter) |
||
33 | |||
34 | /** |
||
35 | * @param \Throwable $e |
||
36 | * @return string |
||
37 | */ |
||
38 | public function render(\Throwable $e): string |
||
46 | |||
47 | /** |
||
48 | * @param \Throwable $e |
||
49 | * @return string |
||
50 | */ |
||
51 | private function renderCode(\Throwable $e): string |
||
62 | |||
63 | /** |
||
64 | * @param \Throwable $e |
||
65 | * @return string |
||
66 | */ |
||
67 | private function renderHeader(\Throwable $e): string |
||
74 | |||
75 | /** |
||
76 | * @param string|object $class |
||
77 | * @return string |
||
78 | */ |
||
79 | private function classname($class): string |
||
85 | |||
86 | /** |
||
87 | * @param \Throwable $e |
||
88 | * @return string |
||
89 | */ |
||
90 | private function renderFileHeader(\Throwable $e): string |
||
97 | |||
98 | /** |
||
99 | * @param \Throwable $e |
||
100 | * @return string |
||
101 | */ |
||
102 | private function renderTrace(\Throwable $e): string |
||
117 | |||
118 | /** |
||
119 | * @param array $trace |
||
120 | * @return string |
||
121 | */ |
||
122 | private function traceArguments(array $trace): string |
||
132 | |||
133 | /** |
||
134 | * @param array $trace |
||
135 | * @return string |
||
136 | */ |
||
137 | private function traceInvocation(array $trace): string |
||
143 | } |
||
144 |
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.