开发者

How to mark array value types in PHP (Java)Doc?

开发者 https://www.devze.com 2023-01-04 00:00 出处:网络
It might be a bit difficult to explain, so I\'ll give some example code. Note that I\'m using NetBeans IDE (latest).

It might be a bit difficult to explain, so I'll give some example code. Note that I'm using NetBeans IDE (latest).

class Dummy {
    public function say(){ }
}
/**
 * Builds dummy class and returns it.
 * @return Dummy The dummy class.
 */
function say_something(){
  return new Dummy();
}
$s=say_something();

While developing in netbeans I can invoke auto-complete by hitting ctrl+space after typing "$s->". In the the hint window that follows, there is the item "say()". This i开发者_C百科s because the javadoc says say_something returns a Dummy and NetBeans parsed Dummy class to know that it has a method called "say()".

So far so good.

My problem is with arrays. Example code follows:

/**
 * Builds array of 2 dummy classes and returns it.
 * @return Array The dummy class. (*)
 */
function say_something2(){
  return array(new Dummy(),new Dummy());
}
$s=say_something2();

If I try the auto-complete thing again but with "$s[0]->" instead, I don't get the methods fro Dummy class. This is because in the JavaDoc I only said that it is an array, but not the values' type.

So the question would be, is there any JavaDoc syntax, cheat, whatever which allows me to tell JavaDoc what type of variables to expect in an array?


You can't. See the documentation here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号