Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Node::load(1);
documentation does not return allow IDEs (eg. PHPStorm) to autocomplete. This is because the IDE gets the object type from EntityStorageInterface::load()
we can fix this by inlining a typehint.
Tested in PHPStorm and it works a treat.
Thanks to @dawehner for the idea.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2372323-2.patch | 1.03 KB | amateescu |
d8.static-load-type-hint.patch | 738 bytes | alexpott | |
Comments
Comment #1
dawehnerManually tested it (can be helpful from time to time), and it worked fine.
Comment #2
amateescu CreditAttribution: amateescu commentedOr we can fix the docblocks and also help other IDEs that might not be as smart as Phpstorm :)
Comment #3
amateescu CreditAttribution: amateescu commentedComment #4
alexpottWorks for me.
Comment #5
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #8
jhodgdonNote: follow-up issue on #2461671: Entity::load() docs has parameter that is not needed due to inheritdoc will probably reverse this patch, which has the wrong syntax in it. You cannot do @inheritdoc with extra stuff! Please don't do this any more. It will NOT work on api.drupal.org and we have been discussing this standard but this will not work.
See #1994890: Allow {@inheritdoc} and additional documentation