Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318073

Summary: Class method/field completion for Class with dynamic construction not shown
Product: z_Archived Reporter: schnagga
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: silviya, wywrzal
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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