From 9bda0f1b5b2aab0f51e97663b6a6189e84f7288a Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 29 Aug 2026 19:29:17 +0200 Subject: [PATCH] Ignore false-positive cheaper-guard order in DowngradeSubstrFalsyRector 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 --- .../Rector/FuncCall/DowngradeSubstrFalsyRector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php b/rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php index 1f421208..4678d903 100644 --- a/rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php +++ b/rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php @@ -178,6 +178,7 @@ public function refactor(Node $node): ?Node } } + // @phpstan-ignore rector.rectorCheaperGuardsFirst (cannot hoist above the CallLike block, which marks IS_FALSY_UNCASTABLE on non-substr nodes) if (! $this->isName($node, 'substr')) { return null; }