diff --git a/rules/Defluent/ConflictGuard/ParentClassMethodTypeOverrideGuard.php b/rules/Defluent/ConflictGuard/ParentClassMethodTypeOverrideGuard.php index 9c9ce14a8f8d..2e9e23ee57e3 100644 --- a/rules/Defluent/ConflictGuard/ParentClassMethodTypeOverrideGuard.php +++ b/rules/Defluent/ConflictGuard/ParentClassMethodTypeOverrideGuard.php @@ -65,6 +65,10 @@ public function isReturnTypeChangeAllowed(\PhpParser\Node\Stmt\ClassMethod $clas } return \strpos($fileName, '/vendor/') === \false; } + public function hasParentClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool + { + return $this->getParentClassMethod($classMethod) instanceof \PHPStan\Reflection\MethodReflection; + } private function getParentClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMethod) : ?\PHPStan\Reflection\MethodReflection { $scope = $classMethod->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE); diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php index 248dfb7986e3..7ee8be727393 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php @@ -18,6 +18,7 @@ use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use Rector\Core\Rector\AbstractRector; +use Rector\Defluent\ConflictGuard\ParentClassMethodTypeOverrideGuard; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\TypeDeclaration\NodeAnalyzer\CallerParamMatcher; use RectorPrefix20210802\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser; @@ -36,10 +37,15 @@ final class ParamTypeByMethodCallTypeRector extends \Rector\Core\Rector\Abstract * @var \Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser */ private $simpleCallableNodeTraverser; - public function __construct(\Rector\TypeDeclaration\NodeAnalyzer\CallerParamMatcher $callerParamMatcher, \RectorPrefix20210802\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser) + /** + * @var \Rector\Defluent\ConflictGuard\ParentClassMethodTypeOverrideGuard + */ + private $parentClassMethodTypeOverrideGuard; + public function __construct(\Rector\TypeDeclaration\NodeAnalyzer\CallerParamMatcher $callerParamMatcher, \RectorPrefix20210802\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\Defluent\ConflictGuard\ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard) { $this->callerParamMatcher = $callerParamMatcher; $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; + $this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard; } public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition { @@ -129,6 +135,9 @@ private function shouldSkipClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMe if ($classMethod->params === []) { return \true; } + if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) { + return \true; + } $scope = $classMethod->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE); if (!$scope instanceof \PHPStan\Analyser\Scope) { return \true; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 226f393c17de..c3dd6c88e8e0 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = 'b3480900f3da86846dfabdfcd7e12f07b16a3f78'; + public const PACKAGE_VERSION = 'd936944aedeaa6687e4eeca55aab8148e9104436'; /** * @var string */ - public const RELEASE_DATE = '2021-08-02 17:39:36'; + public const RELEASE_DATE = '2021-08-02 19:12:49'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210802\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 0311da7871e3..66f61bc2d5a7 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2::getLoader(); +return ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 014927297073..63b50f7c2f87 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2 +class ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e { private static $loader; @@ -22,15 +22,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit515a7719282ef2aa9111616aa962f8f2::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit515a7719282ef2aa9111616aa962f8f2::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire515a7719282ef2aa9111616aa962f8f2($fileIdentifier, $file); + composerRequire4c0fdd8ae9e558b3dcc5b77b57b9be6e($fileIdentifier, $file); } return $loader; } } -function composerRequire515a7719282ef2aa9111616aa962f8f2($fileIdentifier, $file) +function composerRequire4c0fdd8ae9e558b3dcc5b77b57b9be6e($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 0bda7cb0237b..9b6072090e1d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit515a7719282ef2aa9111616aa962f8f2 +class ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3847,9 +3847,9 @@ class ComposerStaticInit515a7719282ef2aa9111616aa962f8f2 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit515a7719282ef2aa9111616aa962f8f2::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit515a7719282ef2aa9111616aa962f8f2::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit515a7719282ef2aa9111616aa962f8f2::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit4c0fdd8ae9e558b3dcc5b77b57b9be6e::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index ed51f054d5a8..5c82f59f4b09 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -9,8 +9,8 @@ if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) { spl_autoload_call('RectorPrefix20210802\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2', false) && !interface_exists('ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2', false) && !trait_exists('ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2', false)) { - spl_autoload_call('RectorPrefix20210802\ComposerAutoloaderInit515a7719282ef2aa9111616aa962f8f2'); +if (!class_exists('ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e', false) && !interface_exists('ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e', false) && !trait_exists('ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e', false)) { + spl_autoload_call('RectorPrefix20210802\ComposerAutoloaderInit4c0fdd8ae9e558b3dcc5b77b57b9be6e'); } if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) { spl_autoload_call('RectorPrefix20210802\Doctrine\Inflector\Inflector'); @@ -3308,9 +3308,9 @@ function print_node() { return \RectorPrefix20210802\print_node(...func_get_args()); } } -if (!function_exists('composerRequire515a7719282ef2aa9111616aa962f8f2')) { - function composerRequire515a7719282ef2aa9111616aa962f8f2() { - return \RectorPrefix20210802\composerRequire515a7719282ef2aa9111616aa962f8f2(...func_get_args()); +if (!function_exists('composerRequire4c0fdd8ae9e558b3dcc5b77b57b9be6e')) { + function composerRequire4c0fdd8ae9e558b3dcc5b77b57b9be6e() { + return \RectorPrefix20210802\composerRequire4c0fdd8ae9e558b3dcc5b77b57b9be6e(...func_get_args()); } } if (!function_exists('parseArgs')) {