|Typehint return value as instance of static [message #643897]
||Wed, 08 December 2010 16:10
Registered: December 2010
In my current project I have a parent class that has a method similar to the following:|
public static function load($id)
return new static($id);
This gives each childclass a static method load() that will instantiate an object of that class when called, so Foo::load($id) will return an object of type Foo and Bar::load($id) will return an object of the type Bar.
It would be nice if it is possible to let PDT know what type will be returned (e.g. an object of the class in which the method was called).
* @return static
Can this be done?
Powered by FUDForum
. Page generated in 0.01441 seconds