Bug 180189 - code completion from phpDoc for inherited objects/classes and interfaces
code completion from phpDoc for inherited objects/classes and interfaces
Status: VERIFIED FIXED
Product: php
Classification: Unclassified
Component: Editor
6.x
PC All
: P4 (vote)
: 6.x
Assigned To: rmatous
issues@php
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-03 02:59 UTC by koubel
Modified: 2010-05-17 11:34 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
nice code completion for parent (52.23 KB, image/jpeg)
2010-02-04 02:09 UTC, koubel
Details
no php doc in completion for childs (44.69 KB, image/jpeg)
2010-02-04 02:10 UTC, koubel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description koubel 2010-02-03 02:59:53 UTC
current code completion doesn't support "automatic" code completion for phpdoc in inherited classes. Hence using deep object hierarchy is little bit uncomfortable.

example

abstract class MyParent {
 /**
  * method1 description
  * @param string $arg first argument
  * @return string
  */
 public function method1($arg) {
   ...
   ...
 }

 /**
  * method2 description
  * @param string $arg first argument 
  * @return string
  */
 abstract public function method2($arg);
}

class MyChild extends MyParent {

 public function method1($arg) {
   ....
   return parent::method1($ehancedArg);
 }

 public function method2($arg) {
  ... ...
  return $retVal;
 }
}

when I type
$var = new MyChild();
$var->method1 or $var->method2 I get empty code completion box,
and I expect box with phpDoc information which are defined in
MyParent.

 
MyChild inherits MyParent and behavior of methods is same or very similar,
so I expect inheritance of documentation, specially in abstract methods
and interfaces implementations.

Btw this is default behaviour of phpDocumentor tool which is used for generation documentation from sources with phpdoc comments. Support for inline @{inheritdoc} would be also very welcome.

See http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html which describes @{inheritdoc} tag
and default phpdoc inheritance also.
Comment 1 rmatous 2010-02-03 03:20:53 UTC
if you had in mind CC like this:
var = new MyChild();
$var->method1->| or $var->method2->|

then, the problem is that string (@return string) isn't object in PHP if you didn't explicitly added your won impl. for it.

Changing the doc's type to MyChild (or whatever other object) like this: 
@return MyChild
should work
Comment 2 koubel 2010-02-04 02:05:34 UTC
Sorry, I made a mistake in description.
The code completion problem with previous OOP code is
when I type just

$var = new MyChild();
$var->|

I expect same result as for

$var = new MyParent();
$var->|

because MyChild inherits from MyParent a behaviour of methods described
via phpdoc in parent is same in child. It's especially expected on abstract methods.


I try to add screen shots for both described situations.
Comment 3 koubel 2010-02-04 02:09:34 UTC
Created attachment 93833 [details]
nice code completion for parent
Comment 4 koubel 2010-02-04 02:10:15 UTC
Created attachment 93834 [details]
no php doc in completion for childs
Comment 5 koubel 2010-02-04 02:13:22 UTC
example is little bit odd, because I cannot instantiate abstract class directly but works good for demonstration of "inheritance" of phpdoc in OOP code.
Comment 7 koubel 2010-05-12 15:35:49 UTC
Just notice, I tried today test it with latest build from http://bertram.netbeans.org/hudson/job/PHP-build/1832/ but IDE is after while in state "Checking for external changes - Suspended". IDE isn't friezed, but it seems "Checking for external changes" never finises. I'll wait a few days for a new release and try to search related issues.
Comment 8 rmatous 2010-05-12 16:15:50 UTC
Never ending refresh will be probably following issue:
http://netbeans.org/bugzilla/show_bug.cgi?id=185900
Comment 9 Quality Engineering 2010-05-13 05:06:42 UTC
Integrated into 'main-golden', will be available in build *201005122200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 10 Filip Zamboj 2010-05-17 11:34:36 UTC
v/c 
Product Version: NetBeans IDE Dev (Build 100517-f3e07cd88d57)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo