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 CC for class members works only for variables of object type. It should also work for functions/methods returning object type, e.g. <?php class My { public function echoMy() { echo "echoMy\n"; } } /** * @return My */ function getMy() { return new my(); } //doesn't work getMy()->| ?> This may be challenging to implement using the current infrastructure as I would need to operate on AST level (currently cc for class members operates on token level). Probably enhancements in 'code sanitation' would be required too. It is also possible to stick to the token level but then again it may get quite tricky...
*** Issue 144161 has been marked as a duplicate of this issue. ***
Changing issue type to P2 DEFECT
Fixed in 80%, http://hg.netbeans.org/main/rev/c6013dfee497
Integrated into 'main-golden', available in build *200808220201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/c6013dfee497 User: Tomasz Slota <tslota@netbeans.org> Log: #141652: Offer CC for class members directly on functions returning object type (part 1)
I have noticed that code: $var = factory();//my comment $var->| //echome()->echome()->echome(); works if you omit the comment "//my comment" Also this version doesn't work $var = factory(); //my comment $var->| //echome()->echome()->echome();
It would be great if also these pieces of code worked ($var2->|, $var3->|): /** * @return ClsFromFactory */ function factory() { global $factoryVar; return $factoryVar; } $var = factory(); $var2 = $var; $var2->| //->echome();//not working $var3 = $var->echome(); $var3->| //echome();
Sorry for just code snip., follow this link for better context: http://www.netbeans.org/nonav/issues/showattachment.cgi/68096/I144809.php
With this commit the fix can be considered complete: http://hg.netbeans.org/main/rev/aacf5fb678ec
Integrated into 'main-golden', available in build *200808230201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/7892e0e584bb User: Tomasz Slota <tslota@netbeans.org> Log: #141652: Offer CC for class members directly on functions returning object type (part 2)
I tried to fix somehow usecases that I mentioned in my comment Fri Aug 22 17:05:54 +0000 2008. Meaning usecases like: $var3 = $var->echome(); $var3->| //echome(); Fixes: type resolution for var assignments http://hg.netbeans.org/main/rev/068c6e98001c type resolution for var assignments, part II - takes function parameters into acount http://hg.netbeans.org/main/rev/5f31008d19e9 type resolution for var assignments, part III - takes into acount assignments inside class containing $this,self,parent http://hg.netbeans.org/main/rev/dda52792b157
Hi! I found that it is still not working with version NetBeans IDE Dev (Build 200809150201) MyMain.php: <?php class MyMain { function MyMain(){ } function getParam($param01 = "default") { echo $param01; } } ?> MyMain2.php: <?php include_once 'MyMain.php'; function GetMyMain() { return new MyMain(); } ?> index.php: <?php include_once 'MyMain.php'; include_once 'MyMain2.php'; $instance1 = new MyMain(); // code completion works ok $instance1->getParam("MyString<br />"); $instance2=GetMyMain(); // code completion does not work: $instance2->getParam(); ?> Roti
Idea for hint. Such a hint on line like "return new MyMain;" inside function could offer && generate phpdoc like this: /** * @return MyMain */ function GetMyMain() { return new MyMain(); } Then CC would works fine in case like: $instance2->| mentioned by reported (phpdoc like above is btw. hint for workaround for Roti)
You need to use PHPDoc tags to get it working. There is a number of enhancement requests for improving type recognition for class members, e.g. issue 147195, we will not have time to do it for this coming release though. The issue in its original scope has been fixed
wow, it works with phpdoc! Thanx!
Verified