Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318073 - Class method/field completion for Class with dynamic construction not shown
Summary: Class method/field completion for Class with dynamic construction not shown
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-26 06:06 EDT by schnagga CLA
Modified: 2020-05-14 11:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schnagga CLA 2010-06-26 06:06:34 EDT
Build Identifier: 2.2

When Class FooBar is created dynamicly in ParentClass Bar (by the late static binding function get_called_class of PHP5.3) method-completion doesn't show the methods of class FooBar, only the methods of the parent class Bar are proposed

Example:

***
Classes:

abstract class Bar {

  public static function getInstance()
  {
    if(!isset(static::$instance)){
      $classname = get_called_class();
      static::$instance = new $classname();
    }
    return static::$instance;
  }
  
  public function my_bar_method(){
    ;
  }
  
}

abstract class FooBar extends Bar{
  
  public function my_foobar_method(){
    ;
  }
  
}


***
Script:

$foobar = FooBar::getInstance();
$foobar -> ... // Only the method my_bar_method() is proposed...


***
Additional Information:

When we add the function getInstance(){ return parent::getInstance(); } to FooBar. The completion works fine. But we don't want to add getInstance-functions to all our FooBarClasses...

Reproducible: Always
Comment 1 Michal Niewrzal CLA 2016-06-05 16:17:20 EDT
This functionality can be achieved with:

/**
 * @return $this
 */
public static function getInstance()

Mark as worksforme.
Comment 2 Sylvia Tancheva CLA 2016-06-17 06:20:06 EDT
Verified - works with @return $this. Closing