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

Bug 347332

Summary: Freature Request: Syntaxcomplition when using get_calling_class(). eg: /** @return get_calling_class()
Product: z_Archived Reporter: harrieva
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: trivial    
Priority: P3 CC: zulus
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description harrieva CLA 2011-05-26 11:07:07 EDT
Build Identifier: 20110301-1815

I love PDT because it detects the the returntype of a function by parsing the @return comment. Unfortunaly this does not work for derived classes and static functions. Here is an example:

class base{
/**
 * @return base
 */
public static function getobj(){
  $c = get_calling_class();
  return new $c;
}
}

class derived extends base{}

$obj = derived::getobj();

in this case pdt would complete $obj as it was an instance of base. And this is the right behavior. Unfortiunaly im not able to force eclipse to hanlde $obj like an instance of "derived". My idea is, that when @return gets the type "get_calling_class()" Syntaxcomplition handles $obj like the class that is called... Example:

/**
 * @return  get_calling_class()
 */
public static function getobj(){
  $c = get_calling_class();
  return new $c;
}
}

A special type eg "__calling__class__" could be possible to....

Regards, Hendrik

Reproducible: Always
Comment 1 Dawid Pakula CLA 2015-01-18 18:50:09 EST

*** This bug has been marked as a duplicate of bug 276082 ***