This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
class A { public $A = 'A'; /** * @return static */ public static function foo() { return new static(); } /** * @return static[] */ public static function foos() { return [new static()]; } /** * @return A[] */ public static function foosA() { return [new static()]; } } class B extends A { public $B = 'B'; /** * @return \static */ public static function boo() { return new static(); } /** * @return static[] */ public static function boos() { return [new static()]; } } A::foo()->A;//->A is offered in autocompleter B::foo()->A;//->A is offered in autocompleter B::foo()->B;//->B is offered in autocompleter foreach (A::foosA() as $foo) { $foo->A;//->A is offered in autocompleter } //following variable cases are NOT shown in autocompleter foreach (A::foos() as $foo) { $foo->A;//->A is NOT offered in autocompleter } foreach (B::boos() as $boo) { $boo->A;//->A is NOT offered in autocompleter $boo->B;//->B is NOT offered in autocompleter } As seen from the simple testcase: - typehint @return static works correctly (same goes for @return self but did not include sample to keep things short) - typehint @return A[] also works correctly for the foreach case - typehint @return static[] is not detected correctly, foreach block does not detect A::foos() as array of A instances and does not detect B::boos() as array of B instances Since the static and self return types are supported and ClassName[] notation is also supported, it would be good to have support for static[] hinting.