From 4c9a89e861746575451d4c68d5f8163af9f2f900 Mon Sep 17 00:00:00 2001 From: kaizen-ci Date: Wed, 24 Feb 2021 00:40:54 +0000 Subject: [PATCH] [ci-review] Rector Rectify --- .../src/NodeAnalyzer/CallableClassMethodMatcher.php | 8 -------- .../src/NodeFactory/AnonymousFunctionFactory.php | 8 -------- .../ClassMethod/DowngradeCovariantReturnTypeRector.php | 6 +----- .../Rector/New_/CompleteMissingDependencyInNewRector.php | 4 ++-- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/rules/code-quality/src/NodeAnalyzer/CallableClassMethodMatcher.php b/rules/code-quality/src/NodeAnalyzer/CallableClassMethodMatcher.php index 2225163911ba..9cd955479dcb 100644 --- a/rules/code-quality/src/NodeAnalyzer/CallableClassMethodMatcher.php +++ b/rules/code-quality/src/NodeAnalyzer/CallableClassMethodMatcher.php @@ -15,7 +15,6 @@ use PHPStan\Type\UnionType; use Rector\Core\Exception\ShouldNotHappenException; use Rector\Core\PhpParser\Node\Value\ValueResolver; -use Rector\NodeCollector\NodeCollector\NodeRepository; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\NodeTypeResolver; @@ -32,11 +31,6 @@ final class CallableClassMethodMatcher */ private $nodeTypeResolver; - /** - * @var NodeRepository - */ - private $nodeRepository; - /** * @var NodeNameResolver */ @@ -50,13 +44,11 @@ final class CallableClassMethodMatcher public function __construct( ValueResolver $valueResolver, NodeTypeResolver $nodeTypeResolver, - NodeRepository $nodeRepository, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider ) { $this->valueResolver = $valueResolver; $this->nodeTypeResolver = $nodeTypeResolver; - $this->nodeRepository = $nodeRepository; $this->nodeNameResolver = $nodeNameResolver; $this->reflectionProvider = $reflectionProvider; } diff --git a/rules/code-quality/src/NodeFactory/AnonymousFunctionFactory.php b/rules/code-quality/src/NodeFactory/AnonymousFunctionFactory.php index 03e223938110..fe264e970132 100644 --- a/rules/code-quality/src/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/code-quality/src/NodeFactory/AnonymousFunctionFactory.php @@ -18,18 +18,12 @@ use PHPStan\Reflection\Php\PhpMethodReflection; use PHPStan\Type\MixedType; use PHPStan\Type\VoidType; -use Rector\Core\PhpParser\Node\BetterNodeFinder; use Rector\Core\PhpParser\Node\NodeFactory; use Rector\NodeNameResolver\NodeNameResolver; use Rector\StaticTypeMapper\StaticTypeMapper; final class AnonymousFunctionFactory { - /** - * @var BetterNodeFinder - */ - private $betterNodeFinder; - /** * @var NodeFactory */ @@ -46,12 +40,10 @@ final class AnonymousFunctionFactory private $staticTypeMapper; public function __construct( - BetterNodeFinder $betterNodeFinder, NodeFactory $nodeFactory, NodeNameResolver $nodeNameResolver, StaticTypeMapper $staticTypeMapper ) { - $this->betterNodeFinder = $betterNodeFinder; $this->nodeFactory = $nodeFactory; $this->nodeNameResolver = $nodeNameResolver; $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/downgrade-php74/src/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/downgrade-php74/src/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index f1b3eaa3f287..6b86f35cb9ca 100644 --- a/rules/downgrade-php74/src/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/downgrade-php74/src/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -163,11 +163,7 @@ private function resolveDifferentAncestorReturnType(ClassMethod $classMethod, No return new MixedType(); } - if ($returnTypeNode instanceof NullableType) { - $bareReturnType = $returnTypeNode->type; - } else { - $bareReturnType = $returnTypeNode; - } + $bareReturnType = $returnTypeNode instanceof NullableType ? $returnTypeNode->type : $returnTypeNode; $returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($bareReturnType); $methodName = $this->getName($classMethod); diff --git a/rules/restoration/src/Rector/New_/CompleteMissingDependencyInNewRector.php b/rules/restoration/src/Rector/New_/CompleteMissingDependencyInNewRector.php index 3f66c238c199..8bb86da60372 100644 --- a/rules/restoration/src/Rector/New_/CompleteMissingDependencyInNewRector.php +++ b/rules/restoration/src/Rector/New_/CompleteMissingDependencyInNewRector.php @@ -157,8 +157,8 @@ private function getNewNodeClassConstructorMethodReflection(New_ $new): ?MethodR return null; } - $reflectionClass = $this->reflectionProvider->getClass($className); - return $reflectionClass->getConstructor(); + $classReflection = $this->reflectionProvider->getClass($className); + return $classReflection->getConstructor(); // // $reflectionClass = new ReflectionClass($className); //