Skip to content

non-empty-array<mixed> does not accept array with hasOffsetValue #3924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 2.1.x
Choose a base branch
from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 7, 2025

@staabm staabm marked this pull request as ready for review April 7, 2025 19:35
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Comment on lines +79 to +83
if ($type instanceof HasOffsetType
|| $type instanceof HasOffsetValueType
) {
return AcceptsResult::createYes();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure on this fix, as the 2 types do not necessarily mean "offset on array".

did not find a better place to implement it though.

@staabm staabm changed the title non-empty-array<mixed> does not except array with hasOffsetValue non-empty-array<mixed> does not accept array with hasOffsetValue Apr 10, 2025
@staabm
Copy link
Contributor Author

staabm commented Apr 14, 2025

I see we have more todo here.

a union of 2 non-empty-arrays with has-offset accessory atm is just array, could be at least non-empty-array

https://phpstan.org/r/cfad9fa9-2279-4f97-b9df-580aab7aa844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non-empty-array<mixed> does not except array with hasOffsetValue
2 participants