Skip to content

Commit

Permalink
remove unused class
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Mar 19, 2021
1 parent c1848ff commit c8f532c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@
use PHPStan\Type\MixedType;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\VendorLocker\Reflection\ClassReflectionAncestorAnalyzer;
use Rector\VendorLocker\Reflection\MethodReflectionContractAnalyzer;

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

/**
* @var MethodReflectionContractAnalyzer
*/
Expand All @@ -32,11 +26,9 @@ final class ClassMethodReturnVendorLockResolver
private $nodeNameResolver;

public function __construct(
ClassReflectionAncestorAnalyzer $classReflectionAncestorAnalyzer,
MethodReflectionContractAnalyzer $methodReflectionContractAnalyzer,
NodeNameResolver $nodeNameResolver
) {
$this->classReflectionAncestorAnalyzer = $classReflectionAncestorAnalyzer;
$this->methodReflectionContractAnalyzer = $methodReflectionContractAnalyzer;
$this->nodeNameResolver = $nodeNameResolver;
}
Expand All @@ -53,7 +45,7 @@ public function isVendorLocked(ClassMethod $classMethod): bool
return false;
}

if (! $this->classReflectionAncestorAnalyzer->hasAncestors($classReflection)) {
if ($classReflection->getAncestors() === [$classReflection]) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@
use Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\VendorLocker\Reflection\ClassReflectionAncestorAnalyzer;

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

/**
* @var NodeNameResolver
*/
Expand All @@ -30,11 +24,9 @@ final class PropertyTypeVendorLockResolver
private $familyRelationsAnalyzer;

public function __construct(
ClassReflectionAncestorAnalyzer $classReflectionAncestorAnalyzer,
NodeNameResolver $nodeNameResolver,
FamilyRelationsAnalyzer $familyRelationsAnalyzer
) {
$this->classReflectionAncestorAnalyzer = $classReflectionAncestorAnalyzer;
$this->nodeNameResolver = $nodeNameResolver;
$this->familyRelationsAnalyzer = $familyRelationsAnalyzer;
}
Expand All @@ -49,7 +41,7 @@ public function isVendorLocked(Property $property): bool
return false;
}

if (! $this->classReflectionAncestorAnalyzer->hasAncestors($classReflection)) {
if ($classReflection->getAncestors() === [$classReflection]) {
return false;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector\Fixture;

use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;

abstract class ParentReturnType
{
public function run(): ?\PhpParser\Node
{
}
}

final class SkipAlreadySetReturnType extends ParentReturnType
{
public function run(): ?\PhpParser\Node
{
return new FuncCall(new Name('some'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ private function isInsideMethodCallHasMethodCall(MethodCall $methodCall): bool

private function isVariableNameAlreadyDefined(If_ $if, string $variableName): bool
{
/** @var Scope $scope */
$scope = $if->getAttribute(AttributeKey::SCOPE);
if (! $scope instanceof Scope) {
return false;
}

return $scope->hasVariableType($variableName)
->yes();
return $scope->hasVariableType($variableName)->yes();
}
}

0 comments on commit c8f532c

Please sign in to comment.