You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any classes implementing Injectable should have a @method phpDoc annotation for the create method to have a better experience in IDEs. Because right now, it just says "any number of arguments".
The signatures are taken from the constructors and their phpDoc annotations. This way, you get the exact same IDE help for the ::create() method as for the constructor, which can make the adoption of the Factory method easier.
Technically, it could be possible to automate this across all files with some script, but I'm not sure that would be faster than manually doing it... Depends on how many classes actually use Injectable, I guess. If some modules do as well, it might be useful to write such a script.
The text was updated successfully, but these errors were encountered:
Didn't know that worked, good stuff! Do you want to do a PR for core modules on this? There's a module out there which auto-adds some PHPDoc to custom SilverStripe code (e.g. getters for $db), but I can't remember what it was called. If you track that down, maybe suggest to add it there?
I don't think anyone will object to doing this, but it's unlikely to be actioned by the core team. So I'll put a feedback-required/author on here, up to you to send a PR - otherwise I'll come across this again in a few months and will close ;)
Any classes implementing
Injectable
should have a@method
phpDoc annotation for thecreate
method to have a better experience in IDEs. Because right now, it just says "any number of arguments".Example for
SilverStripe\Forms\TextField
:The signatures are taken from the constructors and their phpDoc annotations. This way, you get the exact same IDE help for the
::create()
method as for the constructor, which can make the adoption of the Factory method easier.Technically, it could be possible to automate this across all files with some script, but I'm not sure that would be faster than manually doing it... Depends on how many classes actually use Injectable, I guess. If some modules do as well, it might be useful to write such a script.
The text was updated successfully, but these errors were encountered: