Skip to content

Commit 4010c8b

Browse files
authored
Ignore false-positive cheaper-guard order in DowngradeSubstrFalsyRector (#391)
The isName() guard cannot move above the CallLike block, which marks IS_FALSY_UNCASTABLE on arguments of non-substr call nodes; hoisting would skip that side effect and wrongly rewrite nested substr() in falsy-tolerant params. Claude-Session: https://claude.ai/code/session_01Na4eYvNqa2pdhZrBXbegrv
1 parent 10f6785 commit 4010c8b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public function refactor(Node $node): ?Node
178178
}
179179
}
180180

181+
// @phpstan-ignore rector.rectorCheaperGuardsFirst (cannot hoist above the CallLike block, which marks IS_FALSY_UNCASTABLE on non-substr nodes)
181182
if (! $this->isName($node, 'substr')) {
182183
return null;
183184
}

0 commit comments

Comments
 (0)