Conditions | 5 |
Paths | 5 |
Total Lines | 32 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | #!/usr/bin/env php |
||
4 | function findPolyfill(string $directory): int |
||
5 | { |
||
6 | // See issue #4215 - code which should have erred in unit test |
||
7 | // succeeded because a dev package required polyfills. |
||
8 | $retCode = 0; |
||
9 | $polyfill81 = 'MYSQLI_REFRESH_REPLICA\\b' |
||
10 | . '|fdiv[(]' |
||
11 | . '|array_is_list[(]' |
||
12 | . '|enum_exists[(]'; |
||
13 | $polyfill = '/\\b(?:' |
||
14 | . $polyfill81 |
||
15 | . '})/'; |
||
16 | |||
17 | $it = new RecursiveIteratorIterator( |
||
18 | new RecursiveDirectoryIterator($directory, FilesystemIterator::UNIX_PATHS) |
||
19 | ); |
||
20 | |||
21 | foreach ($it as $file) { |
||
22 | if ($file->getExtension() === 'php') { |
||
23 | $fullname = $it->getPath() . '/' . $it->getBaseName(); |
||
2 ignored issues
–
show
|
|||
24 | $contents = file_get_contents($fullname); |
||
25 | if ($contents === false) { |
||
26 | echo "failed to read $fullname\n"; |
||
27 | ++$retCode; |
||
28 | } elseif (preg_match_all($polyfill, $contents, $matches)) { |
||
29 | var_dump($fullname, $matches); |
||
1 ignored issue
–
show
|
|||
30 | ++$retCode; |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return $retCode; |
||
36 | } |
||
45 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.