user; }I use this" name="description" /> user; }I use this" />

PHP docBlock @return className


How do I create a PHP DocBlock stating an @return which states the return of a class. This is at the moment fairly simple by doing

<pre class="lang-php prettyprint-override">/** * This returns an object of the "User" class * @return User */ public function getUser() { return $this->user; }

I use this to get intellisense through my IDE for these return values. (in my case Netbeans)

However I have a class that returns a class based on a variable name. (for example:)

<pre class="lang-php prettyprint-override">/** * This returns an object of the $param * @param String $className * @return ??? */ public function getSomeObject($className) { return new $className(); }

and I'm trying to create intellisense for this aswell but I'm not sure if this is actually possible.

For example when I call

<pre class="lang-php prettyprint-override">$someClass = new MyClass(); $var = $someClass->getSomeObject('Address');

I would like my IDE to show me intellisense for the variable $var(which will contain an Object of Address)


It would make sense to mention that the method returns an object as such:

/** * [...] * @return object */

Eventually with some details as such:

* @return object Object of class $className

See the <a href="" rel="nofollow">docs for @return</a>.


Unless you can list <em>all</em> the potential return types,

@return User|Address|Sandwich|Coiture

, <strong><em>and</em></strong> the IDE be capable of allowing autocompletion to <em>aggregate</em> <strong>all</strong> methods/properties from <em>that entire list of classes</em>, then I don't see it as possible.


  • Is there any advantage to using Classes with static functions versus Modules?
  • second dropdown menu not selected
  • array from php to JavaScript
  • ios swift parse: Collect data from 3 classes
  • Sticky footer with flexbox
  • Shallow render a React/Enzyme component that uses Refs
  • System.IO.Directory.GetFiles. No definition for GetFiles?
  • Where and How To Define An Application Property? - JHIpster
  • How to attach php documentation in eclipse
  • Angular2 How to display localStorage value inside HTML5 template?
  • Replace Node Name
  • JavaScript Intellisense is not working in Visual Studio 2015
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • Yii2: Using Kartik Depdrop Widget?
  • getelement by class name for clicking
  • Is looping through all style sheets and classes a good idea in JavaScript?
  • Wrapping a c#/WPF GUI around c++/cli around native c++
  • Debugging VB6 Code From Visual Studio 2010
  • Convert array of 8 bytes to signed long in C++
  • How to make Safari send if-modified-since header?
  • How to pass list parameters for each object using Spring MVC?
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Understanding cpu registers
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • apache spark aggregate function using min value
  • How can I remove ASP.NET Designer.cs files?
  • JaxB to read class hierarchy
  • Busy indicator not showing up in wpf window [duplicate]
  • Recursive/Hierarchical Query Using Postgres
  • Running Map reduces the dimensions of the matrices
  • Sorting a 2D array using the second column C++
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF