title: Proper PHPDoc for switch statement with object return value
body: <p>If you could be so kind to take a look at the project I'm working on at this line ( the function api() ).</p>
  
  <p><a href="https://github.com/wtfzdotnet/php-tmdb-api/blob/develop/lib/Tmdb/Client.php#L79" rel="nofollow">https://github.com/wtfzdotnet/php-tmdb-api/blob/develop/lib/Tmdb/Client.php#L79</a></p>
  
  <p>What is the correct way here for IDE's to actually auto complete the methods of the returned object instances? The way I'm using it right now returns all the methods from all the possible return objects.</p>
  
  <p>Short; how do I make sure the IDE recognizes auto-complete methods for objects being returned are defined by a switch statement? I'd like to know what the proper way is for the IDE auto-completing this, and as well the best PHPDoc strategy ( It does have an interface, which however is empty for time being ).</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>As the first comment suggested I tried to adjust the case for 'movies' as a test to:</p>
  
  <pre><code>case 'movies':
      return $this-&gt;getMovieApi();
  </code></pre>
  
  <p>and added</p>
  
  <pre><code>/**
   * @return Api\Movies
   */
  private function getMovieApi(){
      return new Api\Movies($this);
  }
  </code></pre>
  
  <p>But this does not function as expected when trying to call:</p>
  
  <pre><code>$client-&gt;api('movies')-&gt;[try_autocomplete]
  </code></pre>
  
  <p>However when I change the scope of getMovieApi to public and call this directly as:</p>
  
  <pre><code>$client-&gt;getMovieApi()-&gt;[try_autocomplete]
  </code></pre>
  
  <p>It works as expected, however I really prefer my initial method, as this looks cleaner ( atleast to me ). Is it really impossible to get proper auto-completion if return values are derived from a switch statement?</p>