From 850b492944c51824d9cb1d729db38dd3beaef1a5 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 29 Sep 2023 20:19:15 +0700 Subject: [PATCH] Move pull StaticTypeMapper from AbstractRector into rules (#195) --- .../ClassMethod/DowngradeContravariantArgumentTypeRector.php | 4 +++- .../Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php index 2ade6225..1e5ff413 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php @@ -17,6 +17,7 @@ use Rector\Core\Rector\AbstractRector; use Rector\Core\Reflection\ReflectionResolver; use Rector\Core\ValueObject\MethodName; +use Rector\StaticTypeMapper\StaticTypeMapper; use ReflectionMethod; use ReflectionNamedType; use ReflectionParameter; @@ -36,7 +37,8 @@ public function __construct( private readonly PhpDocTypeChanger $phpDocTypeChanger, private readonly ParamAnalyzer $paramAnalyzer, private readonly ReflectionResolver $reflectionResolver, - private readonly PhpDocInfoFactory $phpDocInfoFactory + private readonly PhpDocInfoFactory $phpDocInfoFactory, + private readonly StaticTypeMapper $staticTypeMapper ) { } diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index 6c8509a4..25065ee1 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -28,6 +28,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer; +use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -47,6 +48,7 @@ public function __construct( private readonly UnionTypeAnalyzer $unionTypeAnalyzer, private readonly DocBlockUpdater $docBlockUpdater, private readonly PhpDocInfoFactory $phpDocInfoFactory, + private readonly StaticTypeMapper $staticTypeMapper, ) { }