phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Update RangeFunctionReturnTypeExtension to include known integer ranges for keys

Open PrinsFrank opened this issue 4 months ago • 1 comments

Right now, the range function returns a list Type for large numbers. we can narrow this down, because we do actually know the upper and lower bounds of the keys, by subtracting the lower bound from the upper bound and dividing that by the step number.

I think this covers all scenarios, let me know if I've missed anything!

PrinsFrank avatar Aug 20 '25 19:08 PrinsFrank

Misses a type-inference test which fails without the patch using assertType

staabm avatar Aug 21 '25 11:08 staabm