From a3b725126c9875360665a767494e2a2e07c9b888 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 23 Apr 2024 09:06:40 +0000 Subject: [PATCH] Updated Rector to commit 775916c6416e68507e846421f04e2cabbfa2d737 https://github.com/rectorphp/rector-src/commit/775916c6416e68507e846421f04e2cabbfa2d737 [Naming] Skip DateTime as individual in name resolver (#5842) --- rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php | 3 ++- rules/Naming/Naming/ExpectedNameResolver.php | 4 ++++ src/Application/VersionResolver.php | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php index ec3af1051f3..10c35d41739 100644 --- a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\NodeAnalyzer; +use PhpParser\Node\Expr\NullsafeMethodCall; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; @@ -121,7 +122,7 @@ final class IsClassMethodUsedAnalyzer { $className = (string) $this->nodeNameResolver->getName($class); /** @var Node\Expr\NullsafeMethodCall[] $methodCalls */ - $methodCalls = $this->betterNodeFinder->findInstanceOf($class, Node\Expr\NullsafeMethodCall::class); + $methodCalls = $this->betterNodeFinder->findInstanceOf($class, NullsafeMethodCall::class); return $this->callCollectionAnalyzer->isExists($methodCalls, $classMethodName, $className); } private function isInArrayMap(Class_ $class, Array_ $array) : bool diff --git a/rules/Naming/Naming/ExpectedNameResolver.php b/rules/Naming/Naming/ExpectedNameResolver.php index bdd0076b639..571407e60f5 100644 --- a/rules/Naming/Naming/ExpectedNameResolver.php +++ b/rules/Naming/Naming/ExpectedNameResolver.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Naming\Naming; +use DateTimeInterface; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; @@ -93,6 +94,9 @@ final class ExpectedNameResolver } $className = $this->nodeNameResolver->getName($new->class); $fullyQualifiedObjectType = new FullyQualifiedObjectType($className); + if ($fullyQualifiedObjectType->isInstanceOf(DateTimeInterface::class)->yes()) { + return null; + } $expectedName = $this->propertyNaming->getExpectedNameFromType($fullyQualifiedObjectType); if (!$expectedName instanceof ExpectedName) { return null; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 0e2973af00f..1a4c2502a11 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 = '6eac87db32eff9308a037fb32ce973ccf905fc92'; + public const PACKAGE_VERSION = '775916c6416e68507e846421f04e2cabbfa2d737'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-04-22 16:33:11'; + public const RELEASE_DATE = '2024-04-23 11:03:42'; /** * @var int */