How to create a PHP DocBlock with @return indicating the return of the class. Itβs pretty simple right now by doing
public function getUser() { return $this->user; }
I use this to get intellisense via my IDE for these return values. (in my case Netbeans)
However, I have a class that returns a class based on the name of the variable. (eg:)
public function getSomeObject($className) { return new $className(); }
and I'm trying to create intellisense for this, but I'm not sure if this is really possible.
For example, when I call
$someClass = new MyClass(); $var = $someClass->getSomeObject('Address');
I would like my IDE to show me intellisense for the $ var variable (which will contain the address object)
source share