From 413475184c47dd0d92d3f8f4a433d4d082e58a76 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 5 Dec 2023 21:28:49 +0000 Subject: [PATCH] Updated Rector to commit a92fade7d0fbfcee3fb3e4f0ff5620e281de8ce0 https://github.com/rectorphp/rector-src/commit/a92fade7d0fbfcee3fb3e4f0ff5620e281de8ce0 [TypeDeclaration] Handle DateTimeInterface from use statement on MergeDateTimePropertyTypeDeclarationRector (#5330) --- .../Class_/MergeDateTimePropertyTypeDeclarationRector.php | 5 +++-- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php index d9a5c5ee1e5..d8f8004233a 100644 --- a/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\Class_; +use PHPStan\Type\TypeWithClassName; use PhpParser\Node; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\Class_; @@ -12,7 +13,6 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\Comments\NodeDocBlock\DocBlockUpdater; use Rector\Core\Rector\AbstractRector; use Rector\Core\ValueObject\PhpVersionFeature; -use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType; use Rector\VersionBonding\Contract\MinPhpVersionInterface; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -86,7 +86,8 @@ CODE_SAMPLE continue; } $varType = $phpDocInfo->getVarType(); - if ($varType instanceof FullyQualifiedObjectType && $varType->getClassName() === 'DateTimeInterface') { + $className = $varType instanceof TypeWithClassName ? $this->nodeTypeResolver->getFullyQualifiedClassName($varType) : null; + if ($className === 'DateTimeInterface') { $phpDocInfo->removeByType(VarTagValueNode::class); $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property); $property->type = new FullyQualified('DateTimeInterface'); diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 033448a80bb..52115896ade 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 = 'd22741edaf63d488b39f7754353b0ea8cc454836'; + public const PACKAGE_VERSION = 'a92fade7d0fbfcee3fb3e4f0ff5620e281de8ce0'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-12-06 04:00:59'; + public const RELEASE_DATE = '2023-12-06 04:26:37'; /** * @var int */