From 5ffac169d7ef8e50db08fc8a7f4bc4dbb99d2657 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 23 Aug 2024 08:38:17 +0000 Subject: [PATCH] Updated Rector to commit 1884cdd170c8a1f9580dea448fc79ede3e7e9802 https://github.com/rectorphp/rector-src/commit/1884cdd170c8a1f9580dea448fc79ede3e7e9802 Skip Columns from TypedPropertyFromAssignsRector, as handled better in doctrine rules (#6254) --- .../Property/TypedPropertyFromAssignsRector.php | 12 ++++++++++-- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php index cb75d20efed..ef501e75b7a 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php @@ -18,6 +18,7 @@ use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover; use Rector\Doctrine\CodeQuality\Enum\CollectionMapping; +use Rector\Doctrine\Enum\MappingClass; use Rector\Doctrine\NodeAnalyzer\AttrinationFinder; use Rector\Php74\Guard\MakePropertyTypedGuard; use Rector\PhpParser\Node\Value\ValueResolver; @@ -161,8 +162,7 @@ public function refactor(Node $node) : ?Node if (!$property->isPrivate() && !$this->inlinePublic) { continue; } - // doctrine colleciton is handled in doctrine rules - if ($this->attrinationFinder->hasByMany($property, CollectionMapping::TO_MANY_CLASSES)) { + if ($this->isDoctrineMappedProperty($property)) { continue; } if (!$classReflection instanceof ClassReflection) { @@ -217,4 +217,12 @@ private function decorateTypeWithNullableIfDefaultPropertyNull(Property $propert } return TypeCombinator::addNull($inferredType); } + /** + * Doctrine properties are handled in doctrine rules + */ + private function isDoctrineMappedProperty(Property $property) : bool + { + $mappingClasses = \array_merge(CollectionMapping::TO_MANY_CLASSES, CollectionMapping::TO_ONE_CLASSES, [MappingClass::COLUMN]); + return $this->attrinationFinder->hasByMany($property, $mappingClasses); + } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index ef629f1afbb..4a435ffb0b4 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 = 'c9470e4aa3fe841a40b4b92e3c351a84ad9d7dc4'; + public const PACKAGE_VERSION = '1884cdd170c8a1f9580dea448fc79ede3e7e9802'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-08-23 09:58:02'; + public const RELEASE_DATE = '2024-08-23 08:35:43'; /** * @var int */