vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Sum values using ord #11159

Open chriskapp opened 2 hours ago

chriskapp commented 2 hours ago

If we add the result of the ord function in a loop it does not work as expected, Psalm thinks the value can be max 510 but it is actually larger s.

https://psalm.dev/r/9d872c77dd

psalm-github-bot[bot] commented 2 hours ago

I found these snippets:

https://psalm.dev/r/9d872c77dd ```php = 19_000) { return 1; } else { return 0; } ``` ``` Psalm output (using commit 03ee02c): ERROR: TypeDoesNotContainType - 8:5 - Type int<0, 510> for $result is always !<19000 ```