diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index 1d6f44fde24..ee98dc1c5f5 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -531,7 +531,7 @@ private static function reconcilePositiveNumeric( $failed_reconciliation = 2; - return Type::getMixed(); + return Type::getEmpty(); } /** diff --git a/tests/Loop/WhileTest.php b/tests/Loop/WhileTest.php index 4df375b5012..771574e5f59 100644 --- a/tests/Loop/WhileTest.php +++ b/tests/Loop/WhileTest.php @@ -451,7 +451,19 @@ function foo(string $key): array { return $elements; }', - ] + ], + 'reconcilePositiveInt' => [ + ' 0) { + $counter = $counter - 1; + } else { + $counter = $counter + 1; + } + }' + ], ]; }