Add return types in docs to avoid generating more legacy code #16421
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.
I am not entirely sure if this goes against a policy or not, but I wanted to fix this and also use it to raise the point in case it wasn't raised yet.
While copy-pasting this code from the docs to get started on an arg value resolver, I then instantly got
Method "Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface::supports()" might add "bool" as a native return type declaration in the future. Do the same in implementation "App\ArgumentResolver\PackageResolver" now to avoid errors or add an explicit @return annotation to suppress this message.
in my deprecation log.This feature was added in Symfony 5.x IIRC which means PHP 7.2+ support, so return types including iterable are fully supported, no reason to advise anyone to not use them as far as I can tell :)