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 Mar 19, 2021
1 parent cc72d3b commit c1848ff
Showing 1 changed file with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,16 @@

namespace Rector\VendorLocker\NodeVendorLocker;

use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use Rector\NodeCollector\NodeCollector\NodeRepository;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\VendorLocker\Reflection\ClassReflectionAncestorAnalyzer;
use Rector\VendorLocker\Reflection\MethodReflectionContractAnalyzer;

final class ClassMethodParamVendorLockResolver
{
/**
* @var ClassReflectionAncestorAnalyzer
*/
private $classReflectionAncestorAnalyzer;

/**
* @var MethodReflectionContractAnalyzer
*/
private $methodReflectionContractAnalyzer;

/**
* @var NodeNameResolver
*/
Expand All @@ -35,14 +24,8 @@ final class ClassMethodParamVendorLockResolver
*/
private $nodeRepository;

public function __construct(
ClassReflectionAncestorAnalyzer $classReflectionAncestorAnalyzer,
MethodReflectionContractAnalyzer $methodReflectionContractAnalyzer,
NodeNameResolver $nodeNameResolver,
NodeRepository $nodeRepository
) {
$this->classReflectionAncestorAnalyzer = $classReflectionAncestorAnalyzer;
$this->methodReflectionContractAnalyzer = $methodReflectionContractAnalyzer;
public function __construct(NodeNameResolver $nodeNameResolver, NodeRepository $nodeRepository)
{
$this->nodeNameResolver = $nodeNameResolver;
$this->nodeRepository = $nodeRepository;
}
Expand Down Expand Up @@ -76,12 +59,12 @@ public function isVendorLocked(ClassMethod $classMethod, int $paramPosition): bo

// class is vendor, its locking us
$classLike = $this->nodeRepository->findClassLike($ancestorClassReflection->getName());
if ($classLike === null) {
if (! $classLike instanceof ClassLike) {
return true;
}

$classMethod = $classLike->getMethod($methodName);
if ($classMethod === null) {
if (! $classMethod instanceof ClassMethod) {
continue;
}

Expand Down

0 comments on commit c1848ff

Please sign in to comment.