Skip to content

Commit 1eaf0b8

Browse files
committed
fixup! misc
1 parent 8d53362 commit 1eaf0b8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,18 @@ private function refactorExpression(Expression $expression): ?array
152152
return null;
153153
}
154154

155+
// retrieve a `FuncCall`, if any, from the statement
155156
$funcCall = $this->resolveFuncCall($expression);
156157
if (! $funcCall instanceof FuncCall) {
157158
return null;
158159
}
159160

160-
if ($funcCall->isFirstClassCallable()) {
161+
// Nothing to do if not a refactored function
162+
if (! $this->isNames($funcCall, self::JSON_FUNCTIONS)) {
161163
return null;
162164
}
163165

164-
// Nothing to do if not a refactored function
165-
if (! $this->isNames($funcCall, self::JSON_FUNCTIONS)) {
166+
if ($funcCall->isFirstClassCallable()) {
166167
return null;
167168
}
168169

@@ -200,7 +201,7 @@ private function hasConstFetchInArgs(array $args, string $constName): bool
200201
{
201202
foreach ($args as $arg) {
202203
$value = $arg->value;
203-
if ($value instanceof ConstFetch && $this->getName($value) === $constName) {
204+
if ($value instanceof ConstFetch && $this->isName($value, $constName)) {
204205
return true;
205206
}
206207

0 commit comments

Comments
 (0)