Skip to content

Commit b28e301

Browse files
committed
fix type
1 parent 3d293c3 commit b28e301

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Analyser/MutatingScope.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,11 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
17381738
if ($node instanceof Expr\PreInc) {
17391739
if ($varValue === '') {
17401740
$varValue = '1';
1741-
} elseif (is_string($varValue) && function_exists('str_increment')) {
1741+
} elseif (
1742+
is_string($varValue)
1743+
&& !is_numeric($varValue)
1744+
&& function_exists('str_increment')
1745+
) {
17421746
$varValue = str_increment($varValue);
17431747
} elseif (!is_bool($varValue)) {
17441748
++$varValue;

tests/PHPStan/Analyser/nsrt/pre-inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function doFoo() {
1313
function doFoo2() {
1414
$s = '123';
1515
++$s;
16-
assertType("'124'", $s);
16+
assertType("124", $s);
1717
}
1818

1919
function doFooBar() {

0 commit comments

Comments
 (0)