Add patching for interface name collision with match expression

[MAILPOET-3296]
This commit is contained in:
Rostislav Wolny
2020-11-26 10:59:14 +01:00
committed by Veljko V
parent 747d5fffee
commit 71c515cdcf

View File

@ -10,8 +10,11 @@ if (!file_exists(__DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/
exit; exit;
} }
// Rename Match interface source file to Matcher
exec('mv ' . __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php ' . __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MockMatch.php');
// Fixes for PHP8 Compatibility
$replacements = [ $replacements = [
// Fixes for PHP8 Compatibility
[ [
'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', 'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php',
'find' => [ 'find' => [
@ -21,6 +24,52 @@ $replacements = [
'$class = $parameter->hasType() && $parameter->getType() && !$parameter->getType()->isBuiltin() ? new ReflectionClass($parameter->getType()->getName()) : null;', '$class = $parameter->hasType() && $parameter->getType() && !$parameter->getType()->isBuiltin() ? new ReflectionClass($parameter->getType()->getName()) : null;',
], ],
], ],
// Renaming Match Interface
[
'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MockMatch.php',
'find' => [
'interface Match extends Stub',
],
'replace' => [
'interface MockMatch extends Stub',
],
],
[
'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php',
'find' => [
'* @return Match',
', Match $builder',
'Match $builder',
],
'replace' => [
'* @return MockMatch',
', MockMatch $builder',
'MockMatch $builder',
],
],
[
'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php',
'find' => [
'use PHPUnit\Framework\MockObject\Builder\Match;',
'* @var Match[]',
', Match $builder',
],
'replace' => [
'use PHPUnit\Framework\MockObject\Builder\MockMatch;',
'* @var MockMatch[]',
', MockMatch $builder',
],
],
[
'file' => __DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php',
'find' => [
'interface ParametersMatch extends Match',
],
'replace' => [
'interface ParametersMatch extends MockMatch',
],
],
]; ];
// Apply replacements // Apply replacements