Issue
I was thinking about how to annotate types in PhpStorm. I believe PhpStorm is using Psalm to resolve types, but I can't find how to annotate type to get suggestions here:
$row
in my app will always be Collection
object and I want to have it marked somewhere here with annotations.
Does anyone have an idea how to accomplish that?
/**
* @param Collection $rows
*/
public function collection(Collection $rows)
{
foreach ($rows as $row)
{
dump($row->); // $row is also Collection object
}
}
Solution
you can mark var type like this:
/**
@var $row Collection
**/
dump($row->);
Answered By - Eden Moshe Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.