I have a class test, and one getDatathat returns object variables that occur magically in the context of methods.
My question is how to correctly IDE and phpdoc said correctly. I want PhpStorm to understand that it returns as output variables. It?
class Test
{
function getData($param)
{
$data = (object)[
'a' => 'aaa',
'b' => 'bbb',
];
return $data;
}
}
$test = new Test();
$data = $test->getData('param');
echo $data->

source
share