From e5e3c815d58862153c3ad0056ec5c22e64f0a405 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 8 Dec 2023 14:41:39 +0000 Subject: [PATCH] Updated Rector to commit 14f11280c85a2776b211dac001f0accd4295c587 https://github.com/rectorphp/rector-src/commit/14f11280c85a2776b211dac001f0accd4295c587 [Naming] Skip DateTimeImmutable on RenamePropertyToMatchTypeRector (#5340) --- .../MatchParamTypeExpectedNameResolver.php | 20 +++++++++---------- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php index 207ffc74a2b..6bdc34cad3b 100644 --- a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php +++ b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php @@ -8,6 +8,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use Rector\Naming\Naming\PropertyNaming; use Rector\Naming\ValueObject\ExpectedName; +use Rector\NodeTypeResolver\NodeTypeResolver; use Rector\StaticTypeMapper\StaticTypeMapper; final class MatchParamTypeExpectedNameResolver { @@ -21,10 +22,16 @@ final class MatchParamTypeExpectedNameResolver * @var \Rector\Naming\Naming\PropertyNaming */ private $propertyNaming; - public function __construct(StaticTypeMapper $staticTypeMapper, PropertyNaming $propertyNaming) + /** + * @readonly + * @var \Rector\NodeTypeResolver\NodeTypeResolver + */ + private $nodeTypeResolver; + public function __construct(StaticTypeMapper $staticTypeMapper, PropertyNaming $propertyNaming, NodeTypeResolver $nodeTypeResolver) { $this->staticTypeMapper = $staticTypeMapper; $this->propertyNaming = $propertyNaming; + $this->nodeTypeResolver = $nodeTypeResolver; } public function resolve(Param $param) : ?string { @@ -33,9 +40,9 @@ final class MatchParamTypeExpectedNameResolver return null; } $staticType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); - // include nullable too + // include nullabgitle too // skip date time + date time interface, as should be kept - if ($this->isDateTimeType($staticType)) { + if ($this->nodeTypeResolver->isObjectType($param->type, new ObjectType('DateTimeInterface'))) { return null; } $expectedName = $this->propertyNaming->getExpectedNameFromType($staticType); @@ -44,11 +51,4 @@ final class MatchParamTypeExpectedNameResolver } return $expectedName->getName(); } - private function isDateTimeType(Type $type) : bool - { - if ($type->isSuperTypeOf(new ObjectType('DateTimeInterface'))->yes()) { - return \true; - } - return $type->isSuperTypeOf(new ObjectType('DateTime'))->yes(); - } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b142abf56de..e756179ee84 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 = '0a2dc3d52b679bad1b07849d951748a8faad7f9a'; + public const PACKAGE_VERSION = '14f11280c85a2776b211dac001f0accd4295c587'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-12-08 13:56:59'; + public const RELEASE_DATE = '2023-12-08 21:39:23'; /** * @var int */