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