PhpStorm object property type hint
I'm using type hinting in PhpStorm in .php
files which works fine. I can do type hinting for php fragments <? ?>
<? ?>
in .html
files for variables and for $this
like:
<?
/**
* @var $this My_Custom_Class
*/
?>
I have some dynamically added properties in .html
templates, which I don't know how should I instruct PhpStorm to hint. Config file containing associative array is passed to init method and then properties are created like this:
public function init($params)
{
foreach ($params as $key => $value) {
$this->$key = $value;
}
}
It is legacy code, widely used so I don't want to touch it.
I tried:
<?
/**
* @property $prop_name My_Custom_Class
*/
?>
and variations with @var
, $this->prop_name
, $this['prop_name']
different order but nothing works
I can only declare local var and type hint this
<?
/**
* @var My_Custom_Class
*/
$prop_name = $this->prop_name
?>
but it's confusing to have multiple declaration. Is there better way ?
链接地址: http://www.djcxy.com/p/58628.html上一篇: C#中字符串比较方法的差异
下一篇: PhpStorm对象属性类型提示