PhpDoc class names without namespaces

In this sample code PhpStorm says that PhpDoc comment does not match the function signiature:

namespace Two;

use One\MyClass;

/**
* ...
*/
class Test
{
     /**
      * @param MyClass $class
      */
     public function test(MyClass $class)
     {
          ...
     }
}


When I trying to autocurrect it with PhpStorm, it changes to:

namespace Two;

use One\MyClass;

/**
* ...
*/
class Test
{
     /**
      * @param \One\MyClass $class
      */
     public function test(MyClass $class)
     {
          ...
     }
}



It wants full class name including namespace. Is there any way to fix this? As I know, it is correct to use short class name if it is declared with 'use' keyword.
0
2 comments

Hi Bogdan,

As I understand you are using PhpStorm v3.0. Please try latest EAP build (RC of 3.0.1) -- as far as I understand it is fixed there: http://www.jetbrains.net/confluence/display/wi

Please note: because it is EAP build (kind of beta version), it may have other issues (e.g. newly-introduced bugs or new behaviour).

0

Hi,

sorry for re-activating this issue.

Actually I am using phpstorm 3.0.2 (linux), and the following strange behaviour occurs now (perhaps it is only a kind of correct settings-thing):

The DocComment-Autocompleter now seems to be smart enough to recognize use-Statements. But only on hitting "Ctrl-Space" - when generating the whole DocBlock by using generate ... ->PHPDoc Blocks, the fully qualified namespace pathname is applied to annotate the corresponding signature parameters. This would be no problem at all, but worse is that "relative" paths in phpdocs are marked with a warning (see screenshot behind this link: http://imgur.com/gN6WA).

Thanks in advance for your support!

0

Please sign in to leave a comment.