Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\NullsafeMethodCall;
use PhpParser\Node\Expr\PostDec;
use PhpParser\Node\Expr\PostInc;
use PhpParser\Node\Expr\PreDec;
use PhpParser\Node\Expr\PreInc;
use PhpParser\Node\Expr\Print_;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
Expand All @@ -52,7 +48,6 @@
use PhpParser\Node\Expr\Yield_;
use PhpParser\Node\Expr\YieldFrom;
use PhpParser\Node\Identifier;
use PhpParser\Node\IntersectionType;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Stmt;
Expand All @@ -75,7 +70,6 @@
use PhpParser\Node\Stmt\TryCatch;
use PhpParser\Node\Stmt\Unset_;
use PhpParser\Node\Stmt\While_;
use PhpParser\Node\UnionType;
use PhpParser\NodeTraverser;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Analyser\NodeCallbackScope;
Expand All @@ -102,7 +96,6 @@
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PhpParser\Node\FileNode;
use Rector\Util\Reflection\PrivatesAccessor;
use Webmozart\Assert\Assert;

/**
* @inspired by https://github.com/silverstripe/silverstripe-upgrader/blob/532182b23e854d02e0b27e68ebc394f436de0682/src/UpgradeRule/PHP/Visitor/PHPStanScopeVisitor.php
Expand Down Expand Up @@ -226,14 +219,6 @@ private function fillScope(array $stmts, string $filePath, MutatingScope $scope)
return;
}

if ($node instanceof PostInc ||
$node instanceof PostDec ||
$node instanceof PreInc ||
$node instanceof PreDec) {
$node->var->setAttribute(AttributeKey::SCOPE, $mutatingScope);
return;
}

if ($node instanceof ArrayDimFetch) {
$node->var->setAttribute(AttributeKey::SCOPE, $mutatingScope);
if ($node->dim instanceof Expr) {
Expand Down Expand Up @@ -318,14 +303,6 @@ private function fillScope(array $stmts, string $filePath, MutatingScope $scope)
return;
}

if ($node instanceof UnionType || $node instanceof IntersectionType) {
foreach ($node->types as $type) {
$type->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

return;
}

if ($node instanceof StaticPropertyFetch || $node instanceof ClassConstFetch) {
$node->class->setAttribute(AttributeKey::SCOPE, $mutatingScope);
$node->name->setAttribute(AttributeKey::SCOPE, $mutatingScope);
Expand Down Expand Up @@ -479,8 +456,6 @@ private function nodeScopeResolverProcessNodes(
MutatingScope $mutatingScope,
callable $nodeCallback
): void {
Assert::allIsInstanceOf($stmts, Stmt::class);

try {
$this->nodeScopeResolver->processNodes($stmts, $mutatingScope, $nodeCallback);
} catch (ParserErrorsException|ParserException|ShouldNotHappenException|UndefinedVariableException) {
Expand Down
Loading