このメソッドがパラメータのインスタンスを返すことを登録するにはどうすればよいですか?オートコンプリートの動的宣言メソッド
だから私はこのような何かを行うことができます:
Class::models()->getModel('newModel')->newModelMethodHere()?
コードは動作しますが、ない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.');
}
メタデータが役立つはずです(このような場合のみ)。https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata http://stackoverflow.com/q/17666699/783119 – LazyOne