title: PhpStorm type-hinting for factories?
body: <p>I have code more or less like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>class Foo {
      public static function factory($str) {
          $class = "Foo_" . $str;
          return new $class;
      }
  }
  class Foo_Bar {
      public function razzle() {
          print "Foo_Bar-&gt;baz() was called";
      }
  }
  
  $Obj = Foo::factory('Bar');
  </code></pre>
  
  <p>and I would like PhpStorm to understand that <code>$Obj</code> is a <code>Foo_Bar</code> object, so that for example if I type <code>$Obj-&gt;raz</code>, <code>razzle()</code> will show up for autocompletion.</p>
  
  <p>Is there any way to get this?  To tell PhpStorm that the function <code>Foo::factory($str)</code> returns an object of type <code>Foo_$str</code>?  My guess is that the answer is no.</p>