[11.x] Revert faulty change to EnumeratesValues::ensure() doc block #54919
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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
scalaras 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 toscalarPHPStan will merge the parameter types (after all aclass-stringis also ascalar) and the template type becomes unresolvable.E.g.
$collection->ensure(Foo::class)no longer works after the change toscalar(edit: it still works, but PHPStan can't resolve the type)