1 | <?php |
||
8 | abstract class BaseTokenParser extends \Twig_TokenParser |
||
9 | { |
||
10 | /** |
||
11 | * @var int |
||
12 | */ |
||
13 | const PARAMETER_TYPE_ARRAY = 0; |
||
14 | |||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | const PARAMETER_TYPE_VALUE = 1; |
||
19 | |||
20 | /** |
||
21 | * @param \Twig_Token $token |
||
22 | * |
||
23 | * @return array |
||
24 | */ |
||
25 | public function configureParameters(\Twig_Token $token): array |
||
29 | |||
30 | /** |
||
31 | * @return array |
||
32 | */ |
||
33 | public function getAttributes(): array |
||
37 | |||
38 | /** |
||
39 | * @return string |
||
40 | */ |
||
41 | abstract public function getNode(): string; |
||
42 | |||
43 | /** |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function hasBody(): bool |
||
50 | |||
51 | /** |
||
52 | * @param \Twig_Token $token |
||
53 | * |
||
54 | * @throws \Twig_Error_Syntax |
||
55 | * @throws \InvalidArgumentException |
||
56 | * |
||
57 | * @return \Twig_node |
||
58 | */ |
||
59 | public function parse(\Twig_Token $token) |
||
74 | |||
75 | /** |
||
76 | * @param array $parameterConfiguration |
||
77 | * |
||
78 | * @throws \InvalidArgumentException |
||
79 | * @throws \Twig_Error_Syntax |
||
80 | * |
||
81 | * @return \Twig_Node_Expression[] |
||
82 | */ |
||
83 | private function parseParameters(array $parameterConfiguration = []): array |
||
134 | |||
135 | /** |
||
136 | * @return \Twig_Node |
||
137 | */ |
||
138 | private function parseBody(): \Twig_Node |
||
152 | } |
||
153 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.