Skip to content
Merged
Show file tree
Hide file tree
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 @@ -12,6 +12,7 @@
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Ternary;
Expand Down Expand Up @@ -145,6 +146,19 @@ public function processNodes(
$node->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

$expr = $node;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may need to be cloned to avoid object changed, ref https://3v4l.org/BU1O0

Copy link
Copy Markdown
Member Author

@samsonasik samsonasik Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried debug after while, and it seems the object is followed, and target change is different with original node, so it actually ok, see https://3v4l.org/lR4mF

while ($expr instanceof Assign || $expr instanceof AssignOp) {
if ($expr->expr instanceof CallLike && ! $expr->expr->isFirstClassCallable()) {
foreach ($expr->expr->getArgs() as $arg) {
$arg->value->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
}

// decorate value as well
$expr->var->setAttribute(AttributeKey::SCOPE, $mutatingScope);
$expr = $expr->expr;
}

if ($node instanceof Ternary) {
$this->processTernary($node, $mutatingScope);
}
Expand Down Expand Up @@ -189,11 +203,6 @@ public function processNodes(
$node->name->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

if ($node instanceof Assign || $node instanceof AssignOp) {
// decorate value as well
$node->var->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}

if ($node instanceof Trait_) {
$traitName = $this->resolveClassName($node);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

abstract class SkipVariableVariable
{
private static function loadCurveByParam(\DOMXPath $xpath)
{
$$param = self::decodeValue($result->item(0)->textContent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

abstract class SkipVariableVariable2
{
private static function loadCurveByParam(\DOMXPath $xpath)
{
$$param = $$bar = self::decodeValue($result->item(0)->textContent);
}
}