This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 238871 - Method return class name from string
Summary: Method return class name from string
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Linux
: P1 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2013-11-27 12:10 UTC by PHPGeek
Modified: 2017-02-17 15:31 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description PHPGeek 2013-11-27 12:10:00 UTC

This is (in my opinion), one of the most important features that NetBeans MUST have.
Using Doctrine or many many other APIs allow developers to have some methods like :


class EntityManager {
   * @return $classname
  public function find($classname) {
    return new $classname;


so that when you call $entityManager->find("MyClass"); it would return an instance of MyClass, there's no such thing as @return $classname (or return instance of class that is a string). It's so boring not having the pop-up that shows the available methods from the class we've passed in variables.

I know it must be hard, but it's just resolving a string to a class name, and then suggesting the available internal methods and stuff.
Comment 1 Xenos 2017-02-17 15:31:31 UTC
I think this cannot be resolved, because you could do a


There, what's the returned class? (Year, NEVER do such thing, but you get the idea: the name in the call can be dynamic).

If you want to get auto-completion in the calling, you should just use the PHPDoc syntax:

/* @var $myvar \vendor\namespace\MyClass */
$myvar = $entityManager->find("MyClass);

There, NB 8.2 will know that the $myvar variable contains a MyClass instance, and it will provide all required hints.

If that suits your needs (after all these years!), tell us so this bug can be closed.