Skip to content

make:entity add PHPDoc to Collection (getBars()) getter method for auto-completion #979

Closed
@weaverryan

Description

@weaverryan

https://blog.jetbrains.com/phpstorm/2021/09/phpstorm-2021-3-early-access-program-is-open/#improved_support_for_doctrine_collections

So:

+/**
+ * @return Collection<int, Bar>
+ */
public function getBars(): Collection
{

}

The @return will aid auto-completion and is more correct than saying @return Bar[], which is what we do currently:

$this->addGetter(
$relation->getPropertyName(),
$collectionTypeHint,
false,
// add @return that advertises this as a collection of specific objects
[sprintf('@return %s|%s[]', $collectionTypeHint, $typeHint)]
);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions