Lighthouse: Fully qualified class names in PHPDoc

Created on 31 Dec 2018  路  5Comments  路  Source: nuwave/lighthouse

Laravel seems to refer to classes by their FQCN in PHPDoc blocks but imports them otherwise, for example:

use Illuminate\Support\Collection;

/**
 * @return \Illuminate\Support\Collection
 */
function foo(): Collection

Do you think we should stick with that convention?

@lucasmichot are there any exceptions to this rule?

Is there an automated refactoring/transformation available for this in PHPStorm?

enhancement

Most helpful comment

screenshot 2018-12-31 at 19 13 13

All 5 comments

There is no exception.
There is a setting in PHPStorm to ensure the newly created docblocks are with FCQN notations.
No refactoring tool (php-cs-fixer...) that I know provide any transformer.

Can you post a screenshot where that setting is made?

I think the easiest transformation should be to simply delete and recreate the relevant parts of the DocBlocks.

screenshot 2018-12-31 at 19 13 13

Since it is the Laravel way, we will do PHPDocs with FQCN in the future. I will keep this issue open until we converted all Doc blocks.

I guess this can be closed @spawnia :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

a-ssassi-n picture a-ssassi-n  路  3Comments

wimski picture wimski  路  3Comments

nguyentrongbang picture nguyentrongbang  路  3Comments

alexwhb picture alexwhb  路  4Comments

spawnia picture spawnia  路  4Comments