Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizen-ci committed Feb 24, 2021
1 parent 7699cd7 commit 4c9a89e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,11 +31,6 @@ final class CallableClassMethodMatcher
*/
private $nodeTypeResolver;

/**
* @var NodeRepository
*/
private $nodeRepository;

/**
* @var NodeNameResolver
*/
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
//
Expand Down

0 comments on commit 4c9a89e

Please sign in to comment.