diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php index fbd002b5b..2c07cec31 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php @@ -74,6 +74,14 @@ class ArrayFillReturnTypeProvider implements \Psalm\Plugin\EventHandler\Function return true; } + if ($arg->isSingle()) { + foreach ($arg->getRangeInts() as $range_int) { + if ($range_int->isPositive()) { + return true; + } + } + } + return $arg->isSingleIntLiteral() && $arg->getSingleIntLiteral()->value > 0; } }