DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
82 stars 10 forks source link

phpdoc local variable #697

Closed zak-wojtek77 closed 1 month ago

zak-wojtek77 commented 1 month ago

If is written such phpdoc:

/* @var $register \Register */
$register = $arr['register'];

or

/** @var $register \Register */
$register = $arr['register'];

there is no hint for the class "\Register".

The first is used in NetBeans the second is used in PHPStorm.

ging-dev commented 1 month ago

If is written such phpdoc:

/* @var $register \Register */
$register = $arr['register'];

or

/** @var $register \Register */
$register = $arr['register'];

there is no hint for the class "\Register".

The first is used in NetBeans the second is used in PHPStorm.

This is valid spec for local variable in phpstan/psalm/phpstorm:

/** @var \Register */
$register = $arr['register'];

or

/** @var \Register $register */
$register = $arr['register'];
zak-wojtek77 commented 1 month ago

Thank you, it was my mistake.

jakubmisek commented 1 month ago

Thank you for the discussion.

I confirm. If it is written the other way /** @var $name TYPE Description */, then the TYPE is often confused with Description.