A simple PHPDoc question

Hi


If I have a method that takes an object as parameter, returns another object, and throws some exceptions, should I use fully-qualified names or simple object type names ( without namespace part ) for the phpdoc components @param, @return, and @throws?

In other words, which of the following will help PHPStorm figure out what's what and hence better autocompletion?





/**
* @param Object $o
*
* @return Object
*
* @throws Exception
*/



OR


/**
  * @param models\namespace\Object $o
  *
  * @return models\namesapce\Object
  *
  * @throws exceptions\namespace\SomeException
  */



Thanks
Jason

1 comment
Comment actions Permalink

In 1.0.x both mean the same for IDE - it does not actually honor namespaces. However this will change in 1.x, so if you actually have two or more classes with same name you should use fully qualified name, it will help in future.

0

Please sign in to leave a comment.