- Issue created by @dpi
We can improve the typing of the return values of methods of MenuLinkManagerInterface
so PHPStan on higher levels doesn't complain so much. This is primarily useful for consumers of MenuLinkManager, as core is currently at a lower level with a large baseline.
Note that the menu definitions returned by MenuLinkInterface and descendants (MenuLinkBase
, MenuLinkDefault
, etc), and MenuTreeStorage
/MenuTreeStorageInterface
are distinctly different, so they do not share the same type.
MenuLink
definitions can have arbitrary keys, and MenuTreeStorage
also has level (P*) columns.
I think MenuLinkItemInterface
etc will need to use a generic, anyway.
Make calls to MenuLinkManagerInterface
methods in a private project with a high PHPSTan level.
Run \PHPStan\dumpType()
on the result of the methods.
See the results do not have any keys or typing.
Introduce two PHPStan types, which have array shapes of menu link definitions.
One is a fully hydrated definition, the other is a partial, which includes the same typing, except all keys are optional.
Improve docs.
Nil.
Nil.
PHPDocs
Nil.
Nil.