1 | <?php |
||
17 | class PCRECompiler |
||
18 | { |
||
19 | /** |
||
20 | * Regex delimiter |
||
21 | */ |
||
22 | protected const REGEX_DELIMITER = '/'; |
||
23 | |||
24 | private const FLAG_UNICODE = 'u'; |
||
25 | private const FLAG_DOT_ALL = 's'; |
||
26 | private const FLAG_ANALYZED = 'S'; |
||
27 | |||
28 | /** |
||
29 | * @var array|string[] |
||
30 | */ |
||
31 | protected $tokens = []; |
||
32 | |||
33 | /** |
||
34 | * PCRECompiler constructor. |
||
35 | * @param array $tokens |
||
36 | */ |
||
37 | public function __construct(array $tokens = []) |
||
41 | |||
42 | /** |
||
43 | * @param string $token |
||
44 | * @param string $pcre |
||
45 | * @return PCRECompiler |
||
46 | */ |
||
47 | public function add(string $token, string $pcre): self |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | public function compile(): string |
||
63 | |||
64 | /** |
||
65 | * @param iterable $tokens |
||
66 | * @return string |
||
67 | */ |
||
68 | private function tokensToPattern(iterable $tokens): string |
||
83 | |||
84 | /** |
||
85 | * @param string $pattern |
||
86 | * @return string |
||
87 | */ |
||
88 | protected function escapeTokenName(string $pattern): string |
||
92 | |||
93 | /** |
||
94 | * @param string $value |
||
95 | * @return string |
||
96 | */ |
||
97 | protected function escapeTokenPattern(string $value): string |
||
101 | |||
102 | /** |
||
103 | * @return string |
||
104 | */ |
||
105 | private function renderFlags(): string |
||
109 | |||
110 | /** |
||
111 | * @return array |
||
112 | */ |
||
113 | public function getTokens(): array |
||
117 | } |
||
118 |
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: