From 71b64910b3a63c307398602edd58403b1cdd5a5e Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 22 Jun 2021 16:12:07 +0000 Subject: [PATCH] Updated Rector to commit b7359eda29da4377d8ee842c0964f981fbd42abd https://github.com/rectorphp/rector-src/commit/b7359eda29da4377d8ee842c0964f981fbd42abd [Php80] Fix Non namespaced class with annotation on AnnotationToAttributeRector (#268) --- .../Rector/Class_/AnnotationToAttributeRector.php | 10 +++++++++- src/Application/VersionResolver.php | 4 ++-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 8 ++++---- vendor/scoper-autoload.php | 10 +++++----- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php index 5702fe4492f3..5fcaa8ef565f 100644 --- a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php @@ -10,6 +10,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Property; +use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; @@ -124,7 +125,7 @@ private function processApplyAttrGroups(array $tags, \Rector\BetterPhpDocParser\ foreach ($tags as $tag) { foreach ($this->annotationsToAttributes as $annotationToAttribute) { $annotationToAttributeTag = $annotationToAttribute->getTag(); - if ($phpDocInfo->hasByName($annotationToAttributeTag)) { + if ($this->isFoundGenericTag($phpDocInfo, $tag->value, $annotationToAttributeTag)) { // 1. remove php-doc tag $this->phpDocTagRemover->removeByName($phpDocInfo, $annotationToAttributeTag); // 2. add attributes @@ -147,6 +148,13 @@ private function processApplyAttrGroups(array $tags, \Rector\BetterPhpDocParser\ } return $hasNewAttrGroups; } + private function isFoundGenericTag(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode, string $annotationToAttributeTag) : bool + { + if (!$phpDocInfo->hasByName($annotationToAttributeTag)) { + return \false; + } + return $phpDocTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; + } private function shouldSkip(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, string $annotationToAttributeTag) : bool { $doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass($annotationToAttributeTag); diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 20a65f5368a6..05e13621fdd7 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '0c035c390d4afd73b76f186313d4b7f7d906e072'; + public const PACKAGE_VERSION = 'b7359eda29da4377d8ee842c0964f981fbd42abd'; /** * @var string */ - public const RELEASE_DATE = '2021-06-22 17:45:36'; + public const RELEASE_DATE = '2021-06-22 18:01:49'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210622\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/vendor/autoload.php b/vendor/autoload.php index 4a0e4ef2f477..38bec5c500d7 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b::getLoader(); +return ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 5e23a8c00435..c6ef7a46d381 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b +class ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081 { private static $loader; @@ -22,15 +22,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', '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\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::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\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file); + composerRequire6cf032a1bf53c6c94774272899db7081($fileIdentifier, $file); } return $loader; } } -function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file) +function composerRequire6cf032a1bf53c6c94774272899db7081($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 01dd5c40e7d3..6bc10258740a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b +class ComposerStaticInit6cf032a1bf53c6c94774272899db7081 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3869,9 +3869,9 @@ class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index c987b1178dd2..55690a964d9c 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -21,8 +21,8 @@ if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) { spl_autoload_call('RectorPrefix20210622\CheckoutEntityFactory'); } -if (!class_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !interface_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !trait_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false)) { - spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b'); +if (!class_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !interface_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !trait_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false)) { + spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081'); } if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) { spl_autoload_call('RectorPrefix20210622\Doctrine\Inflector\Inflector'); @@ -3323,9 +3323,9 @@ function print_node() { return \RectorPrefix20210622\print_node(...func_get_args()); } } -if (!function_exists('composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b')) { - function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b() { - return \RectorPrefix20210622\composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b(...func_get_args()); +if (!function_exists('composerRequire6cf032a1bf53c6c94774272899db7081')) { + function composerRequire6cf032a1bf53c6c94774272899db7081() { + return \RectorPrefix20210622\composerRequire6cf032a1bf53c6c94774272899db7081(...func_get_args()); } } if (!function_exists('parseArgs')) {