Skip to content
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

Remove count() narrowing handling of empty array #3896

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Mar 22, 2025

Is already covered by the adaption of #3895

Verified

This commit was signed with the committer’s verified signature.
herndlm Martin Herndl
Is already covered by the adaption of phpstan#3895
@herndlm herndlm mentioned this pull request Mar 22, 2025
@herndlm
Copy link
Contributor Author

herndlm commented Mar 22, 2025

I realized late that this is slightly different though. the fix from @staabm is checking sizeType, while this was checking type. let's see what CI says, if in doubt, maybe it's better to keep? hmm

on the other hand I do prefer a simpler if here though if possible :)

@herndlm
Copy link
Contributor Author

herndlm commented Mar 22, 2025

I'll do a quick check for what I added this initially, can't remember

@herndlm
Copy link
Contributor Author

herndlm commented Mar 22, 2025

no clue, it doesn't influence anything. independent of @staabm's sizeType check. even if I remove the whole sizeType check line no new tests start failing. while developing things initially, at some point, I'm sure the isIterableAtLeastOnce()->no() was needed to fix failing tests. but most likely I refactored then and it became irrelevant.

if nobody else has another opinion, then I think it's fine to remove it

@staabm
Copy link
Contributor

staabm commented Mar 22, 2025

agree we should not have code which does not fail tests when removed (except perf improvements)

@ondrejmirtes ondrejmirtes merged commit 40d7179 into phpstan:2.1.x Mar 22, 2025
416 of 418 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@herndlm herndlm deleted the count-empty-array-handling branch March 22, 2025 12:59
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.

None yet

3 participants