2018-03-11 12:35:46 -04:00
|
|
|
<?php
|
|
|
|
|
2022-03-07 16:57:18 -05:00
|
|
|
use Composer\Autoload\ClassLoader;
|
2021-12-27 20:18:33 +01:00
|
|
|
|
2018-03-11 12:35:46 -04:00
|
|
|
return [
|
|
|
|
'patchers' => [
|
2022-11-25 23:58:41 -04:00
|
|
|
function (string $filePath, string $prefix, string $contents): string {
|
2018-03-11 12:35:46 -04:00
|
|
|
//
|
|
|
|
// PHP-Parser patch
|
|
|
|
//
|
2018-05-30 07:21:34 -04:00
|
|
|
if ($filePath === 'vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php') {
|
2018-03-11 12:35:46 -04:00
|
|
|
$length = 15 + strlen($prefix) + 1;
|
|
|
|
|
|
|
|
return preg_replace(
|
|
|
|
'%strpos\((.+?)\) \+ 15%',
|
|
|
|
sprintf('strpos($1) + %d', $length),
|
|
|
|
$contents
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
},
|
2022-11-25 23:58:41 -04:00
|
|
|
function (string $_filePath, string $prefix, string $contents): string {
|
2018-05-05 01:43:43 +01:00
|
|
|
return str_replace(
|
2022-11-25 23:58:41 -04:00
|
|
|
'\\' . $prefix . '\Composer\Autoload\ClassLoader',
|
2018-05-05 01:43:43 +01:00
|
|
|
'\Composer\Autoload\ClassLoader',
|
|
|
|
$contents
|
|
|
|
);
|
|
|
|
},
|
2022-11-25 23:58:41 -04:00
|
|
|
function (string $filePath, string $prefix, string $contents): string {
|
2018-05-30 07:21:34 -04:00
|
|
|
if (strpos($filePath, 'src/Psalm') === 0) {
|
2018-03-18 10:52:54 -04:00
|
|
|
return str_replace(
|
2020-05-14 19:56:20 -04:00
|
|
|
[' \\PhpParser\\'],
|
|
|
|
[' \\' . $prefix . '\\PhpParser\\'],
|
2018-03-18 10:52:54 -04:00
|
|
|
$contents
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
},
|
2022-11-25 23:58:41 -04:00
|
|
|
function (string $filePath, string $prefix, string $contents): string {
|
2018-05-30 07:21:34 -04:00
|
|
|
if (strpos($filePath, 'vendor/openlss') === 0) {
|
2018-03-18 10:52:54 -04:00
|
|
|
return str_replace(
|
|
|
|
$prefix . '\\DomDocument',
|
|
|
|
'DomDocument',
|
|
|
|
$contents
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
},
|
2018-03-11 12:35:46 -04:00
|
|
|
],
|
2022-11-25 23:58:41 -04:00
|
|
|
'exclude-classes' => [
|
2022-03-07 16:57:18 -05:00
|
|
|
ClassLoader::class,
|
|
|
|
Stringable::class,
|
2022-03-07 16:06:38 -05:00
|
|
|
],
|
2022-11-25 23:58:41 -04:00
|
|
|
'exclude-namespaces' => [
|
|
|
|
'Psalm',
|
|
|
|
],
|
|
|
|
'exclude-constants' => [
|
|
|
|
'PSALM_VERSION',
|
|
|
|
'PHP_PARSER_VERSION',
|
|
|
|
],
|
|
|
|
'exclude-files' => [
|
2019-12-30 04:12:03 +02:00
|
|
|
'src/spl_object_id.php',
|
2022-03-07 16:57:18 -05:00
|
|
|
'vendor/symfony/polyfill-php80/Php80.php',
|
|
|
|
'vendor/symfony/polyfill-php80/PhpToken.php',
|
|
|
|
'vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
|
|
|
'vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
|
|
|
|
'vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
2019-02-19 01:10:49 -05:00
|
|
|
],
|
2018-03-11 12:35:46 -04:00
|
|
|
];
|