type hinting for arrays [message #56203] |
Mon, 01 October 2007 12:30 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Nico Ehinger![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=neh%40hosts.ch) Messages: 7 Registered: July 2009 |
Junior Member |
|
|
hey folks,
i'm not sure if this has been requested before, but it would be great if pdt would recognize objects
returned in an array:
class Foo {
public $var1;
/**
* returns an array of Foo objects
* @return Foo[] array of Foo objects
*/
public static getInstances() {
return array(new Foo(), new Foo());
}
}
foreach (Foo::getInstances() as $foo) {
$foo->var1 = "bar"; // after $foo->, ctrl+space will display $var1
}
when returning a single object, pdt parses the phpdoc and everything works great, but here we have
an array, so pdt had to parse through the code ("foreach") as well, in order to apply the correct
object type to the variable $foo.
is that even possible? that would make pdt even greater than it already is! :)
cheers,
-nico.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04196 seconds