Skip to content

Commit 5f0139d

Browse files
committed
fix
1 parent 7c2e84a commit 5f0139d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Analyser/MutatingScope.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,11 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
17341734

17351735
foreach ($varScalars as $varValue) {
17361736
if ($node instanceof Expr\PreInc) {
1737-
if (!is_bool($varValue)) {
1737+
// until PHP 8.5 it was valid to increment an empty string.
1738+
// see https://github.com/php/php-src/issues/19597
1739+
if ($varValue === '') {
1740+
$varValue = '1';
1741+
} elseif (!is_bool($varValue)) {
17381742
if (function_exists('str_increment') && is_string($varValue)) {
17391743
$varValue = str_increment($varValue);
17401744
} else {

0 commit comments

Comments
 (0)