What phpdoc syntax do I use for Iterators in phpstorm?
Given the following iterator:
class foo implements Iterator
{
/**
* @return bool
*/
public function current()
{
}
}
I then create an instance:
$x = new bla;
foreach($x as $y)
{
echo $y;
}
phpstorm is unable to tell me that $y is a boolean.
I actually need to do this with objects instead of booleans, but I suppose the phpdoc construct would be the same.
Anyone any idea how to tell phpstorm what an iterator holds in it's array, without doing so at each location it's used?
请先登录再写评论。
Hi there,
Currently not possible to do it only once somewhere in class declaration - http://youtrack.jetbrains.com/issue/WI-679 (and similar)
ATM you could try something like this, but without some simple but real example it's hard to say if it will actually work fine: