I recently started to add comments on properties declaration on my php classes. The main reason is that without thoses comments, NetBeans don't understand what to do with the properties and so i get no autocompletion. Here what it looks like :
/**
* @var MyClass what blabla about the instance.
*/
public $myClassInstance;
The question is : when I have more then 1 instance of the same class instanciated on properties, is there a way to "multi-comment" ? using only once @var for every property under it ? (as follow)
/**
* @var MyClass what blabla about the instance.
*/
public $myClassInstance;
public $myClassInstance2;
Ok, it seems stupid to do that at once, but it comes handy when declaring primary types for exemple, so it'll looks be开发者_开发问答tter and have less "trash" :
/**
* @var Integer blabla
*/
public $index;
public $start;
public $end;
I assume netbeans uses the phpDocumentor. From the docs it doesn't result that such a thing is possible.
There's no official standard for phpdoc comments, and especially their interpretation by IDEs. Probably your best bet in this case would be to have @var phpdoc for each variable separately.
Ok, thanks for your answers :) finally I ended up doing one line comments using Phpdoc structure like that :
/** @var Professionnel */
protected $auteur;
/** @var Categorie */
protected $categ;
So I have both things I looked for : less comments and autocomplete :)
精彩评论