From 7950d5a8412bf52ca7cd1afa919c6168840f0f66 Mon Sep 17 00:00:00 2001 From: Tomas Votruba <tomas.vot@gmail.com> Date: Mon, 17 Mar 2025 11:28:58 +0000 Subject: [PATCH] Updated Rector to commit 8decc9a693522fec96cc241ce40bc00b36fa7ad9 https://github.com/rectorphp/rector-src/commit/8decc9a693522fec96cc241ce40bc00b36fa7ad9 [naming] Skip DateTime in RenamePropertyToMatchTypeRector as often named in custom way (#6787) --- .../Rector/Class_/RenamePropertyToMatchTypeRector.php | 10 +++++++--- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php index a94a632c683..1f76c51ec95 100644 --- a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php +++ b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Naming\Rector\Class_; +use DateTime; use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; @@ -113,7 +114,7 @@ CODE_SAMPLE if (!$propertyRename instanceof PropertyRename) { continue; } - if ($this->skipMockObjectProperty($property)) { + if ($this->skipDateTimeOrMockObjectPropertyType($property)) { continue; } $renameProperty = $this->matchTypePropertyRenamer->rename($propertyRename); @@ -127,11 +128,14 @@ CODE_SAMPLE * Such properties can have "xMock" names that are not compatible with "MockObject" suffix * They should be kept and handled by another naming rule that deals with mocks */ - private function skipMockObjectProperty(Property $property) : bool + private function skipDateTimeOrMockObjectPropertyType(Property $property) : bool { if (!$property->type instanceof Name) { return \false; } - return $this->isName($property->type, ClassName::MOCK_OBJECT); + if ($this->isName($property->type, ClassName::MOCK_OBJECT)) { + return \true; + } + return $this->isName($property->type, DateTime::class); } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index de7727fe15a..898f6f56d99 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 = '3fc24e1460dcf672b75bbe7d374a9bea4a403573'; + public const PACKAGE_VERSION = '8decc9a693522fec96cc241ce40bc00b36fa7ad9'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-03-17 12:15:54'; + public const RELEASE_DATE = '2025-03-17 11:26:26'; /** * @var int */