-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
For some downstream code, I am constraining a value to be positive-int|0. In the upstream code, this comes from an array for which the only operations are appending a value ($array[] = $value) and removing a value (unset($array[$index])).
However PHPStan doesn't appear to like that very much as it infers int for the index instead of positive-int|0, which is what it is in this specific case where the index is never explicitly set.
Code snippet that reproduces the problem
https://phpstan.org/r/b27d9595-2fb0-4e53-bae6-66728a05a53c
Expected output
No error reported.
Did PHPStan help you today? Did it make you happy in any way?
First PHPStan issue I believe so it works :)
Reactions are currently unavailable