From 1e0199beb580fbe2bba9815c7135889ebf7ff6d8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 18 Oct 2023 08:05:23 +0000 Subject: [PATCH] Updated Rector to commit beeba1770967a4f5e59cf21db28a5a1ccae48a2f https://github.com/rectorphp/rector-src/commit/beeba1770967a4f5e59cf21db28a5a1ccae48a2f [Naming] Skip DateTime from renaming, to keep convention of named dates (#5184) --- .../RemoveUnusedNonEmptyArrayBeforeForeachRector.php | 2 +- .../MatchParamTypeExpectedNameResolver.php | 10 +++++++++- src/Application/VersionResolver.php | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php index 8ef7aaea897..ae7e9dcc2c2 100644 --- a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php +++ b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; -use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node; use PhpParser\Node\Expr; +use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; diff --git a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php index 4ad76b9f1c7..207ffc74a2b 100644 --- a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php +++ b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php @@ -5,6 +5,7 @@ namespace Rector\Naming\ExpectedNameResolver; use PhpParser\Node\Param; use PHPStan\Type\ObjectType; +use PHPStan\Type\Type; use Rector\Naming\Naming\PropertyNaming; use Rector\Naming\ValueObject\ExpectedName; use Rector\StaticTypeMapper\StaticTypeMapper; @@ -34,7 +35,7 @@ final class MatchParamTypeExpectedNameResolver $staticType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); // include nullable too // skip date time + date time interface, as should be kept - if ($staticType->isSuperTypeOf(new ObjectType('DateTimeInterface'))->yes()) { + if ($this->isDateTimeType($staticType)) { return null; } $expectedName = $this->propertyNaming->getExpectedNameFromType($staticType); @@ -43,4 +44,11 @@ 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 18633362ee8..6399f4f265a 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 = '369f16a2640c381138bc12151109047ae5759f32'; + public const PACKAGE_VERSION = 'beeba1770967a4f5e59cf21db28a5a1ccae48a2f'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-10-17 12:17:16'; + public const RELEASE_DATE = '2023-10-18 08:02:31'; /** * @var int */