Skip to content

Commit

Permalink
avoid future getArgs() method that breaks package usage
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 27, 2021
1 parent a9710ac commit adff549
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,22 @@ private function shouldSkip(FuncCall $funcCall): bool
return true;
}

$args = $funcCall->getArgs();
foreach ($args as $arg) {
if ($funcCall->args === null) {
return true;
}

foreach ($funcCall->args as $arg) {
if (! $arg instanceof Arg) {
continue;
}

if ($arg->name instanceof Identifier) {
return true;
}
}

$value = $this->valueResolver->getValue($args[0]->value);
$firstArg = $funcCall->args[0];
$value = $this->valueResolver->getValue($firstArg->value);
if (is_string($value)) {
return true;
}
Expand Down

0 comments on commit adff549

Please sign in to comment.