1 | <?php |
||
21 | class Analyzer |
||
22 | { |
||
23 | /** |
||
24 | * A list of parsed rules |
||
25 | * |
||
26 | * @var array|Symbol[]|Terminal[]|Production[] |
||
27 | */ |
||
28 | private $parsed = []; |
||
29 | |||
30 | /** |
||
31 | * A list of kept rule names. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private $keep; |
||
36 | |||
37 | /** |
||
38 | * @var Mapping |
||
39 | */ |
||
40 | private $mapping; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | private $ruleTokens = []; |
||
46 | |||
47 | /** |
||
48 | * @var ProvideTokens |
||
49 | */ |
||
50 | private $tokens; |
||
51 | |||
52 | /** |
||
53 | * Analyzer constructor. |
||
54 | * @param array $keep |
||
55 | * @param ProvideTokens $tokens |
||
56 | */ |
||
57 | public function __construct(array $keep, ProvideTokens $tokens) |
||
63 | |||
64 | /** |
||
65 | * @param string $rule |
||
66 | * @param iterable $tokens |
||
67 | */ |
||
68 | public function add(string $rule, iterable $tokens): void |
||
72 | |||
73 | /** |
||
74 | * @param string $rule |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function isCompleted(string $rule): bool |
||
81 | |||
82 | /** |
||
83 | * @return array |
||
84 | * @throws \InvalidArgumentException |
||
85 | */ |
||
86 | public function getResult(): array |
||
93 | |||
94 | /** |
||
95 | * @throws \InvalidArgumentException |
||
96 | */ |
||
97 | private function parse(): void |
||
103 | |||
104 | /** |
||
105 | * @param Symbol $symbol |
||
106 | */ |
||
107 | public function store(Symbol $symbol): void |
||
111 | |||
112 | /** |
||
113 | * @return Mapping |
||
114 | */ |
||
115 | public function getMapping(): Mapping |
||
119 | |||
120 | /** |
||
121 | * @param string $rule |
||
122 | * @param array $tokens |
||
123 | * @return Production |
||
124 | * @throws \InvalidArgumentException |
||
125 | */ |
||
126 | public function build(string $rule, array $tokens): Production |
||
130 | |||
131 | /** |
||
132 | * @param string $rule |
||
133 | * @return int |
||
134 | * @throws \InvalidArgumentException |
||
135 | */ |
||
136 | public function fetchId(string $rule): int |
||
144 | |||
145 | /** |
||
146 | * @param LookaheadIterator $iterator |
||
147 | * @param string|null $rule |
||
148 | * @return Group |
||
149 | */ |
||
150 | public function group(LookaheadIterator $iterator, string $rule = null): Group |
||
158 | } |
||
159 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: