vimeo /
psalm
| 1 | <?php |
||
| 2 | |||
| 3 | use Isolated\Symfony\Component\Finder\Finder; |
||
|
0 ignored issues
–
show
|
|||
| 4 | |||
| 5 | return [ |
||
| 6 | 'finders' => [ |
||
| 7 | Finder::create()->files()->in('src'), |
||
| 8 | Finder::create()->files()->in('assets'), |
||
| 9 | Finder::create() |
||
| 10 | ->files() |
||
| 11 | ->ignoreVCS(true) |
||
| 12 | ->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/') |
||
| 13 | ->exclude([ |
||
| 14 | 'doc', |
||
| 15 | 'test', |
||
| 16 | 'test_old', |
||
| 17 | 'tests', |
||
| 18 | 'Tests', |
||
| 19 | 'vendor-bin', |
||
| 20 | ]) |
||
| 21 | ->in('vendor'), |
||
| 22 | Finder::create()->append([ |
||
| 23 | 'composer.json', |
||
| 24 | 'composer.lock', |
||
| 25 | 'config.xsd', |
||
| 26 | 'psalm' |
||
| 27 | ]), |
||
| 28 | ], |
||
| 29 | 'whitelist' => [ |
||
| 30 | |||
| 31 | ], |
||
| 32 | 'patchers' => [ |
||
| 33 | function ($filePath, $prefix, $contents) { |
||
| 34 | // |
||
| 35 | // PHP-Parser patch |
||
| 36 | // |
||
| 37 | if ($filePath === realpath(__DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php')) { |
||
| 38 | $length = 15 + strlen($prefix) + 1; |
||
| 39 | |||
| 40 | return preg_replace( |
||
| 41 | '%strpos\((.+?)\) \+ 15%', |
||
| 42 | sprintf('strpos($1) + %d', $length), |
||
| 43 | $contents |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $contents; |
||
| 48 | }, |
||
| 49 | function ($filePath, $prefix, $contents) { |
||
| 50 | if ($filePath === realpath(__DIR__ . '/src/Psalm/Config.php')) { |
||
| 51 | return str_replace( |
||
| 52 | $prefix . '\Composer\Autoload\ClassLoader', |
||
| 53 | 'Composer\Autoload\ClassLoader', |
||
| 54 | $contents |
||
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | return $contents; |
||
| 59 | }, |
||
| 60 | function ($filePath, $prefix, $contents) { |
||
| 61 | if (strpos($filePath, realpath(__DIR__ . '/src/Psalm')) === 0) { |
||
| 62 | return str_replace( |
||
| 63 | [' \\Psalm\\', ' \\PhpParser\\'], |
||
| 64 | [' \\' . $prefix . '\\Psalm\\', ' \\' . $prefix . '\\PhpParser\\'], |
||
| 65 | $contents |
||
| 66 | ); |
||
| 67 | } |
||
| 68 | |||
| 69 | return $contents; |
||
| 70 | }, |
||
| 71 | function ($filePath, $prefix, $contents) { |
||
| 72 | if (strpos($filePath, realpath(__DIR__ . '/vendor/openlss')) === 0) { |
||
| 73 | return str_replace( |
||
| 74 | $prefix . '\\DomDocument', |
||
| 75 | 'DomDocument', |
||
| 76 | $contents |
||
| 77 | ); |
||
| 78 | } |
||
| 79 | |||
| 80 | return $contents; |
||
| 81 | }, |
||
| 82 | function ($filePath, $prefix, $contents) { |
||
| 83 | if ($filePath === realpath(__DIR__ . '/src/Psalm/PropertyMap.php') |
||
| 84 | || $filePath === realpath(__DIR__ . '/src/Psalm/CallMap.php') |
||
| 85 | || $filePath === realpath(__DIR__ . '/src/Psalm/Stubs/CoreGenericFunctions.php') |
||
| 86 | || $filePath === realpath(__DIR__ . '/src/Psalm/Stubs/CoreGenericClasses.php') |
||
| 87 | ) { |
||
| 88 | $contents = str_replace( |
||
| 89 | ['namespace ' . $prefix . ';', $prefix . '\\\\', $prefix . '\\'], |
||
| 90 | '', |
||
| 91 | $contents |
||
| 92 | ); |
||
| 93 | |||
| 94 | $contents = str_replace( |
||
| 95 | ['\'phpparser\\\\', 'PhpParser\\\\'], |
||
| 96 | ['\'' . strtolower($prefix) . '\\\\phpparser\\\\', $prefix . '\\\\PhpParser\\\\'], |
||
| 97 | $contents |
||
| 98 | ); |
||
| 99 | |||
| 100 | return str_replace('Psalm\\\\', $prefix . '\\\\Psalm\\\\', $contents); |
||
| 101 | } |
||
| 102 | |||
| 103 | return $contents; |
||
| 104 | }, |
||
| 105 | function ($filePath, $prefix, $contents) { |
||
| 106 | if ($filePath === realpath(__DIR__ . '/src/Psalm/Checker/Statements/Expression/Call/MethodCallChecker.php')) { |
||
| 107 | return str_replace( |
||
| 108 | 'case \'Psalm\\\\', |
||
| 109 | 'case \'' . $prefix . '\\\\Psalm\\\\', |
||
| 110 | $contents |
||
| 111 | ); |
||
| 112 | } |
||
| 113 | |||
| 114 | return $contents; |
||
| 115 | }, |
||
| 116 | function ($filePath, $prefix, $contents) { |
||
| 117 | if ($filePath === realpath(__DIR__ . '/src/Psalm/Type.php')) { |
||
| 118 | return str_replace( |
||
| 119 | 'get_class($type) === \'Psalm\\\\', |
||
| 120 | 'get_class($type) === \'' . $prefix . '\\\\Psalm\\\\', |
||
| 121 | $contents |
||
| 122 | ); |
||
| 123 | } |
||
| 124 | |||
| 125 | return $contents; |
||
| 126 | }, |
||
| 127 | function ($filePath, $prefix, $contents) { |
||
| 128 | if ($filePath === realpath(__DIR__ . '/src/psalm.php')) { |
||
| 129 | return str_replace( |
||
| 130 | '\\' . $prefix . '\\PSALM_VERSION', |
||
| 131 | 'PSALM_VERSION', |
||
| 132 | $contents |
||
| 133 | ); |
||
| 134 | } |
||
| 135 | |||
| 136 | return $contents; |
||
| 137 | }, |
||
| 138 | ], |
||
| 139 | ]; |
||
| 140 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths