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 */