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

Fix count() regression #3895

Merged
merged 2 commits into from
Mar 22, 2025
Merged

Fix count() regression #3895

merged 2 commits into from
Mar 22, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 22, 2025

fix regression mentioned in #3876 (comment)

followup to #3889

@staabm
Copy link
Contributor Author

staabm commented Mar 22, 2025

//cc @herndlm

@herndlm
Copy link
Contributor

herndlm commented Mar 22, 2025

Wow, you beat me to it it seems. I didn't even have time to get to a computer yet. Thx! But I was also not expecting for the fix to be this tbh 🤔

Maybe you can rename the variable too :)

@staabm
Copy link
Contributor Author

staabm commented Mar 22, 2025

I guess we are narrowing a NonEmptyArray with a count(0) down the line. but I could not pinpoint where exactly.

@ondrejmirtes ondrejmirtes merged commit 815f317 into phpstan:2.1.x Mar 22, 2025
415 of 417 checks passed
@ondrejmirtes
Copy link
Member

Thank you! I'll report back if testing on real-world projects finds more problems. Otherwise I'll be able to release 2.1.9.

@herndlm
Copy link
Contributor

herndlm commented Mar 22, 2025

@ondrejmirtes just give me a minute, I think I can do a tiny cleanup of an edge case I was handling there which is now covered by @staabm's adaption

because the explanation with non-empty-array felt very very familiar :)

@staabm staabm deleted the reg branch March 22, 2025 09:30
@ondrejmirtes
Copy link
Member

Yeah, sure :)

herndlm added a commit to herndlm/phpstan-src that referenced this pull request Mar 22, 2025
@herndlm
Copy link
Contributor

herndlm commented Mar 22, 2025

--> #3896

ondrejmirtes pushed a commit that referenced this pull request Mar 22, 2025
Is already covered by the adaption of #3895
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