From 254c38f7571ee7ff59f1743c23e8c7b575650bf9 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 12 Oct 2024 16:15:59 +0000 Subject: [PATCH] Updated Rector to commit d180b8d7363f508a4e9c6931c327c65aed5ff6ee https://github.com/rectorphp/rector-src/commit/d180b8d7363f508a4e9c6931c327c65aed5ff6ee [CodeQuality] Skip no @property doc on DynamicDocBlockPropertyToNativePropertyRector (#6380) --- ...DocBlockPropertyToNativePropertyRector.php | 32 +++++++++++-------- src/Application/VersionResolver.php | 4 +-- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php index e1524694f18..be64cdbecd7 100644 --- a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php +++ b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php @@ -122,23 +122,27 @@ public function refactor(Node $node) : ?Node if ($this->shouldSkipClass($node)) { return null; } - // 1. remove dynamic attribute, most likely any - $node->attrGroups = []; // 2. add defined @property explicitly $classPhpDocInfo = $this->phpDocInfoFactory->createFromNode($node); - if ($classPhpDocInfo instanceof PhpDocInfo) { - $propertyPhpDocTagNodes = $classPhpDocInfo->getTagsByName('property'); - $newProperties = $this->createNewPropertyFromPropertyTagValueNodes($propertyPhpDocTagNodes, $node); - // remove property tags - foreach ($propertyPhpDocTagNodes as $propertyPhpDocTagNode) { - // remove from docblock - $this->phpDocTagRemover->removeTagValueFromNode($classPhpDocInfo, $propertyPhpDocTagNode); - } - // merge new properties to start of the file - $node->stmts = \array_merge($newProperties, $node->stmts); - // update doc info - $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); + if (!$classPhpDocInfo instanceof PhpDocInfo) { + return null; + } + $propertyPhpDocTagNodes = $classPhpDocInfo->getTagsByName('property'); + if ($propertyPhpDocTagNodes === []) { + return null; + } + // 1. remove dynamic attribute, most likely any + $node->attrGroups = []; + $newProperties = $this->createNewPropertyFromPropertyTagValueNodes($propertyPhpDocTagNodes, $node); + // remove property tags + foreach ($propertyPhpDocTagNodes as $propertyPhpDocTagNode) { + // remove from docblock + $this->phpDocTagRemover->removeTagValueFromNode($classPhpDocInfo, $propertyPhpDocTagNode); } + // merge new properties to start of the file + $node->stmts = \array_merge($newProperties, $node->stmts); + // update doc info + $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); return $node; } public function provideMinPhpVersion() : int diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 4129314ac0f..0badc307418 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '684f23d165407e0461a48d2c1fd289834a492876'; + public const PACKAGE_VERSION = 'd180b8d7363f508a4e9c6931c327c65aed5ff6ee'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-10-12 17:53:31'; + public const RELEASE_DATE = '2024-10-12 23:13:40'; /** * @var int */