1 | <?php |
||
16 | class ParseException extends RuntimeException |
||
17 | { |
||
18 | private $parsedFile; |
||
19 | private $parsedLine; |
||
20 | private $snippet; |
||
21 | private $rawMessage; |
||
22 | |||
23 | /** |
||
24 | * Constructor. |
||
25 | * |
||
26 | * @param array $error The error array |
||
27 | */ |
||
28 | public function __construct(array $error) |
||
61 | |||
62 | /** |
||
63 | * Gets the snippet of code near the error. |
||
64 | * |
||
65 | * @return string The snippet of code |
||
66 | */ |
||
67 | public function getSnippet() |
||
71 | |||
72 | /** |
||
73 | * Sets the snippet of code near the error. |
||
74 | * |
||
75 | * @param string $snippet The code snippet |
||
76 | */ |
||
77 | public function setSnippet($snippet) |
||
83 | |||
84 | /** |
||
85 | * Gets the filename where the error occurred. |
||
86 | * |
||
87 | * This method returns null if a string is parsed. |
||
88 | * |
||
89 | * @return string The filename |
||
90 | */ |
||
91 | public function getParsedFile() |
||
95 | |||
96 | /** |
||
97 | * Sets the filename where the error occurred. |
||
98 | * |
||
99 | * @param string $parsedFile The filename |
||
100 | */ |
||
101 | public function setParsedFile(string $parsedFile = null) |
||
107 | |||
108 | /** |
||
109 | * Gets the line where the error occurred. |
||
110 | * |
||
111 | * @return int The file line |
||
112 | */ |
||
113 | public function getParsedLine() |
||
117 | |||
118 | /** |
||
119 | * Sets the line where the error occurred. |
||
120 | * |
||
121 | * @param int $parsedLine The file line |
||
122 | */ |
||
123 | public function setParsedLine(int $parsedLine = 0) |
||
129 | |||
130 | private function updateRepr() |
||
160 | } |
||
161 | |||
163 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.