Skip to content

Commit

Permalink
[Php81] Remove cast check on NullToStrictStringFuncCallArgRector (#4320)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 22, 2023
1 parent 5c1fd4e commit 5370b72
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Cast\String_ as CastString_;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\FuncCall;
Expand Down Expand Up @@ -486,10 +485,6 @@ private function processNullToStrictStringOnNodePosition(
return null;
}

if ($this->isCastedReassign($argValue)) {
return null;
}

$args[$position]->value = new CastString_($argValue);
$funcCall->args = $args;

Expand Down Expand Up @@ -517,21 +512,6 @@ private function shouldSkipTrait(Expr $expr, Type $type, bool $isTrait): bool
return true;
}

private function isCastedReassign(Expr $expr): bool
{
return (bool) $this->betterNodeFinder->findFirstPrevious($expr, function (Node $subNode) use ($expr): bool {
if (! $subNode instanceof Assign) {
return false;
}

if (! $this->nodeComparator->areNodesEqual($subNode->var, $expr)) {
return false;
}

return $subNode->expr instanceof CastString_;
});
}

private function isAnErrorTypeFromParentScope(Expr $expr, Scope $scope): bool
{
$parentScope = $scope->getParentScope();
Expand Down

0 comments on commit 5370b72

Please sign in to comment.