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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function refactor(Node $node): ?Node
}

$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
if ($parentNode instanceof Assign) {
if ($parentNode instanceof Assign || $this->isStaticVariable($parentNode)) {
return null;
}

Expand Down Expand Up @@ -138,4 +138,17 @@ public function refactor(Node $node): ?Node

return $node;
}

private function isStaticVariable(Node $parentNode): bool
{
// definition of static variable
if ($parentNode instanceof Node\Stmt\StaticVar) {
$parentParentNode = $parentNode->getAttribute(AttributeKey::PARENT_NODE);
if ($parentParentNode instanceof Node\Stmt\Static_) {
return true;
}
}

return false;
}
}