Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » type hinting for arrays
type hinting for arrays [message #56203] Mon, 01 October 2007 12:30 Go to next message
Nico Ehinger is currently offline Nico EhingerFriend
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.
Re: type hinting for arrays [message #56325 is a reply to message #56203] Tue, 02 October 2007 02:03 Go to previous messageGo to next message
Toshihiro Izumi is currently offline Toshihiro IzumiFriend
Messages: 360
Registered: July 2009
Location: Japan
Senior Member
Bug 170968 – Use PHPDoc hints for arrays of objects
https://bugs.eclipse.org/bugs/show_bug.cgi?id=170968
Re: type hinting for arrays [message #56378 is a reply to message #56325] Tue, 02 October 2007 08:23 Go to previous message
Nico Ehinger is currently offline Nico EhingerFriend
Messages: 7
Registered: July 2009
Junior Member
Toshihiro wrote:
> Bug 170968 � Use PHPDoc hints for arrays of objects
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=170968
>


right, thanks for pointing that out, i wasnt sure if it was already taken care of.

cheers
Previous Topic:PHP Filename illigal characters
Next Topic:XDebug and Breakpoints
Goto Forum:
  


Current Time: Fri Apr 19 09:14:40 GMT 2024

Powered by FUDForum. Page generated in 0.01737 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top