Skip to content

Commit 594cb4d

Browse files
committed
please move $newArg = $this->getArgWithFlags($flags) to before if, and use ! instanceof check instead of ! is_null
1 parent 555170a commit 594cb4d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ private function processJsonEncode(FuncCall $funcCall): FuncCall
140140
$arg = $funcCall->args[1];
141141
$flags = $this->getFlags($arg);
142142
}
143-
if (!is_null($newArg = $this->getArgWithFlags($flags))) {
143+
$newArg = $this->getArgWithFlags($flags);
144+
if ($newArg instanceof Arg) {
144145
$this->hasChanged = true;
145146
$funcCall->args[1] = $newArg;
146147
}
@@ -165,7 +166,8 @@ private function processJsonDecode(FuncCall $funcCall): FuncCall
165166
$funcCall->args[2] = new Arg(new Int_(512));
166167
}
167168

168-
if (!is_null($newArg = $this->getArgWithFlags($flags))) {
169+
$newArg = $this->getArgWithFlags($flags);
170+
if ($newArg instanceof Arg) {
169171
$this->hasChanged = true;
170172
$funcCall->args[3] = $newArg;
171173
}

0 commit comments

Comments
 (0)