Skip to content

Commit 04657b2

Browse files
committed
fix
1 parent d722c32 commit 04657b2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,17 @@ public function refactor(Node $node): ?Node
199199
if ($offset instanceof Arg) {
200200
$offsetType = $this->getType($offset->value);
201201
if ($offsetType instanceof ConstantIntegerType && $offsetType->getValue() <= 0) {
202-
return null;
203-
}
204-
205-
$length = $node->getArg('length', 2);
206-
if ($length instanceof Arg) {
207-
$lengthType = $this->getType($length->value);
208-
if ($lengthType instanceof ConstantIntegerType && $lengthType->getValue() >= 0) {
209-
return null;
202+
$length = $node->getArg('length', 2);
203+
if ($length instanceof Arg) {
204+
$lengthType = $this->getType($length->value);
205+
if ($lengthType instanceof ConstantIntegerType && $lengthType->getValue() >= 0) {
206+
return null;
207+
}
208+
209+
return new String_($node);
210210
}
211+
212+
return null;
211213
}
212214
}
213215

0 commit comments

Comments
 (0)