Skip to content

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

3 participants