Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347332 - Freature Request: Syntaxcomplition when using get_calling_class(). eg: /** @return get_calling_class()
Summary: Freature Request: Syntaxcomplition when using get_calling_class(). eg: /** @r...
Status: CLOSED DUPLICATE of bug 276082
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 11:07 EDT by harrieva CLA
Modified: 2020-05-14 11:17 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***