Fix "array_rand() - offset might not exists"#4383
Fix "array_rand() - offset might not exists"#4383ondrejmirtes merged 8 commits intophpstan:2.1.xfrom
Conversation
|
This pull request has been marked as ready for review. |
|
|
||
| $this->analyse([__DIR__ . '/data/bug-12981.php'], [ | ||
| [ | ||
| 'Offset array<int, int|string> might not exist on non-empty-array<bool|float|int|string>.', |
There was a problem hiding this comment.
I feel like a good improvement would be to not have this error reported because it's already reported as a Invalid array key type.
https://phpstan.org/r/b4c81787-7c0b-46b3-b281-dd572ab6f8ac
But that's another issue, I'll a look at it.
3ec87b1 to
55f50a0
Compare
|
I think that if you rebase your PR @staabm your tests won't give the same output |
|
For the record, the fact is not reported anymore is expected. The offset is already reported by the InvalidKey rule. |
thanks
I just put the test-cases additionally into error on line 39 und 41 still overlap, maybe thats something which can also be improved in a separate PR |
There are not fully overlapping.
|
|
Thank you. |
closes phpstan/phpstan#12981
when merging, we should extract phpstan/phpstan#12981 (comment) into a new issue