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.
Currently you must specify the class as the return value for a chained-method (a method that returns $this). This breaks code completion when subclasses are involved. class Parent { /** * @return Parent */ public function foo() { return $this; } } class Child extends Parent { /** * @return Child */ public function bar() { return $this; } } $c = new Child(); $c-> // CC shows foo() and bar(), correct $c->foo()-> // CC shows only foo(), but I want bar() too I would like to be able to set both @return attributes above to "this". NetBeans should be able to see that in the last line foo() returns $c which is a Child and display both methods in code completion. I understand that this is not valid PHPDoc, but I see no reason to keep NB from extending it.
Batch reassigning.
Editor area.
*** This bug has been marked as a duplicate of bug 196565 ***
While this feature request is similar to 196565 in that it is asking for special handling of the @return doc comment, it's a different case. This one address fluent interfaces whereas the other is for static factory methods.
reply to 1: If foo() returns not just Parent, but sometimes Child too (if it's called on a Child type), then we should use "@return this" annotation instead of "@return Parent" (it's same as for @return static). It doesn't work either by now, but I'll try to implement it.
Fixed in web-main #f2368dd7777f
Integrated into 'main-golden', will be available in build *201301300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/f2368dd7777f User: Ondrej Brejla <obrejla@netbeans.org> Log: #196564 and #196565 - Allow "self", "static" and "this" in a @return annotation (improved type inference)