insperedia / yiidea-support

Other
2 stars 0 forks source link

PHPDoc variable declaration/use statement order #23

Closed chriscpty closed 1 month ago

chriscpty commented 2 months ago

In the projects I work on, we always put the PHPDoc variable declarations below the use statements:

use \foo\bar\Baz;

/**
* @var Baz $baz
*/

yiidea-support's "Missed PhpDoc variable declaration" inspection throws a warning as it seems to only consider PHPDocs that are at the very top of the file, before any use statements, meaning we have to either disable the inspection or restructure all the view files to have the variable declarations before the use statements.

Perhaps the inspection should also consider variable declarations that come after use (and similar) statements?

insperedia commented 2 months ago

Thank you for the issue. I will take a look on the problem.

insperedia commented 2 months ago

I can not reproduce the problem. The plugin supports multiline variable declarations after use declaration. The problem is somewhere else. Try to press Add missed variable declarations to see what types and variables will be inserted.

chriscpty commented 2 months ago

I can't reproduce it anymore either, maybe it either got fixed in the meantime or i got confused because yiidea-support seems to expect there to be an @var yii\web\View $this in the variable declarations, which I usually don't bother adding to views.

verifiera commented 1 month ago

I can't reproduce it anymore either, maybe it either got fixed in the meantime or i got confused because yiidea-support seems to expect there to be an @var yii\web\View $this in the variable declarations, which I usually don't bother adding to views.

The latter is correct.