Active
Project:
Drupal core
Version:
main
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2026 at 11:32 UTC
Updated:
5 Jan 2026 at 16:19 UTC
Jump to comment: Most recent
How to typehint a service closure (w/o having to add phpdoc for all parameters)?
- (Coming from #3221375: Wrong language field labels after `drush cr` because of Drush language negotiation, see commit)
- I'm finding a constructor without docblock
- I'm adding a service closure
- Now i have only bad choices:
-- Do not add a docblock => No IDE and phpstan bliss
-- Add docblock for ALL parameters => Clutter
-- Add docblock typehint for the service closure only => CS error
- Allow docblock-typehinting only relevant parameters
- ?
Comments
Comment #2
geek-merlinComment #3
geek-merlinComment #4
geek-merlinComment #5
mondrakefwiw, I started doing this in contrib
waiting for #3419960-15: [policy, no patch] Allow docblock to be removed when modifying constructor params and #16
Comment #6
geek-merlin@mondrake Thanks a lot for confirming it is an issue and a variant of phpstan-ignore is currently the only way out.
And thanks for the pointer, maybe you want to boost that by confirming my "what would make sense" over there at #3376518-190: Allow omitting @var, @param and @return tags or their descriptions if the variable name and type is enough.