Custom Suggestion with array of classes?
Hi!
I have a question about the suggestions.
I have a function, that gets me an array of classes
class test
{
public $a
public function getA()
{
...
}
}
function getTests()
{
return array(
new test();
new test();
new test();
}
In phpDoc I can define the return value for that function with array.
Is it possible, that I define array[test] and if I do the following
$ret = getTests();
for each ($ret as $r){
$r->...
I get the suggestion for the class?
请先登录再写评论。
Hi there,
Use ClassName[] syntax.
Alternatively, you can provide typehint for local variable in foreach cycle: