Skip to content

Remove count() narrowing handling of empty array - #3896

Merged
ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
herndlm:count-empty-array-handling
Mar 22, 2025
Merged

ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
herndlm:count-empty-array-handling

Conversation

@herndlm

@herndlm herndlm commented Mar 22, 2025

Copy link
Copy Markdown
Contributor

Is already covered by the adaption of #3895

@herndlm herndlm mentioned this pull request Mar 22, 2025
@herndlm

herndlm commented Mar 22, 2025 •

Copy link
Copy Markdown
Contributor Author

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

herndlm commented Mar 22, 2025

Copy link
Copy Markdown
Contributor Author

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

@herndlm

herndlm commented Mar 22, 2025

Copy link
Copy Markdown
Contributor Author

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

staabm commented Mar 22, 2025 •

Copy link
Copy Markdown
Contributor

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
@ondrejmirtes

Copy link
Copy Markdown
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.

3 participants