I work for a company where employees both use PHPStorm and Netbeans 8. This has always been working fine for us until we recently started added more type hinting to our code.
In PHPStorm the correct way to use type hinting in your source like this
/** @var MyAwesomeClass $theObject */
$theObject = $orm->getMyAwesomeObject();
Which makes sense because the correct way to document a function is
/**
* @param MyAwesomeClass $awesomeObjectArgument
* @param boolean $booleanArgumentsAreSilly
*/
But netbeans works like this
/** @var $theObject \Full\Freeking\Namespace\With\Leading\Backslash\MyAwesomeClass */
Which is an issue because the order of arguments (to the @var notation) is reversed, and Netbeans uses leading slashes which is not supported by PHPStorm.
Does anybody know a way to configure either one of these IDE's to work with the same standard, because at the moment only half of our code has working autocompletion. To me the implementation in Netbeans seems unnecessarily and conflicting with the PHPDocs standard (based on the @param notation).
UPDATE: I was wrong, PHPStorm is actually compatible with the Netbeans notation, but not the other way around. Meaning my problem is not completely fixed. I still need to find a way to configure both IDE's to generate docs that work in both.
Which is an issue because the order of arguments (to the @var notation) is reversed, and Netbeans uses leading slashes which is not supported by PHPStorm
This is NOT true.
1. PhpStorm supports both orders (@var [type] [variable]
as well as @var [variable] [type]
)
2. PhpStorm supports both PHPDoc comments (/** @var ...
) as well as ordinary block comments (/* @var ...
)
3. PhpStorm supports FQN -- this works just fine: /** @var $theObject \Full\Namespace\MyAwesomeClass */
Despite ashazg's assertion that there is no PHPDoc standard for type hinting, the official documentation at http://phpdoc.org/docs/latest/references/phpdoc/tags/var.html does say that typehint should precede variable name, and there is no mention in the documentation that this order is just a suggestion and that anyone can just use their own ordering.
Also, this practice is consistent with most other languages that are strongly typed, such as Java (public int speed) or C (int speed). So the fact that Netbeans does not support the correct typehint order as in PHPDoc documentation is causing a lot of pain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With