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

[11.x] Revert faulty change to EnumeratesValues::ensure() doc block #54919

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Mar 6, 2025

This PR partially reverts #54840, specifically one commit which breaks PHPStan type inference.

Explanation:

It seems that there was some confusion and these types were shortened to scalar as if the doc blocks said "any string, float, int or bool is allowed" which is a wrong assumption. The doc blocks in fact said "these exact string values are allowed". By changing these constant strings to scalar PHPStan will merge the parameter types (after all a class-string is also a scalar) and the template type becomes unresolvable.

E.g. $collection->ensure(Foo::class) no longer works after the change to scalar (edit: it still works, but PHPStan can't resolve the type)

@cosmastech
Copy link
Contributor

Thanks for doing this. Was just bumping Laravel versions on some apps and got this exact error.

@taylorotwell taylorotwell merged commit 69a7dbd into laravel:11.x Mar 6, 2025
46 checks passed
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