Question: How do I get my IDE to register that this method is returning a instance of the parameter?

So I could do something like this: 

```
Class::models()->getModel('newModel')->newModelMethodHere()?

```

The code works, but not the autocomplete in PHPStorm.

```
    /**
     * Returns the object of the model
     *
     * @var $this->_models[$model] $model
     * @param string object $model
     * @throws Exception
     * @return object
     */
    public function getModel($model)
    {
        if (array_key_exists($model, $this->_models) && class_exists($model) && is_object($this->_models[$model])
            && $this->_models[$model] instanceof $model) {
            if (is_a($this->_models[$model], $model)) {
                /* @var $this->_models[$model] $model */
                return ($this->_models[$model]);
            }
        }
        throw new Exception('Model ' . (string)$model . ' is not registered correctly.');
    }

```

Answer: 
I had to change my code a bit, but I managed to get this to work:

```
namespace PHPSTORM_META {
    $STATIC_METHOD_TYPES = array(
       \ClassName::getModel('') => [
           "" == "@",
       ],
   );
}

```

in a new .phpstorm.meta.php file in the root of my project in PHPStorm.
The method `getModel()` probably returns objects of different types depending on the provided argument. While this is not good practice, there is a simple trick that you can use to let PhpStorm help you with the auto complete: store the value returned by `getModel()` into a variable and use a `@var` annotation to tell PhpStorm about its type:

```
 /** @var newModel $model */
 $model = Class::models()->getModel('newModel');
 // Here PhpStorm will be able to help you with its auto-complete
 $model->newModelMethodHere()?

```