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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Manually tested it (can be helpful from time to time), and it worked fine.

amateescu’s picture

FileSize
1.03 KB

Or we can fix the docblocks and also help other IDEs that might not be as smart as Phpstorm :)

amateescu’s picture

Status: Reviewed & tested by the community » Needs review
alexpott’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs manual testing

Works for me.

webchick’s picture

Component: entity system » documentation
Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 87b2e6e on 8.0.x
    Issue #2372323 by alexpott, amateescu: Static loaders on entity types...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jhodgdon’s picture

Note: 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