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?
Tag: psalm-php
How To Declare Traversable Type?
There are multiple typehints in PHP, more now in PHP 8, and even more with Psalm. But what about declaring the type, rather than hinting the expected type? I have a interface Collection extends Traversable, and I need to declare that it is a traversable of type Abc. How can I do that, so that PHPDoc or Psalm know that