Reliable type hinting when using AbstractCollection/ArrayCollection/FinderCollection collections

X

Xon

Guest
Member
These collection classes result in entity property type hints of;
PHP:

Code:

Code:
/**
  * @property-read \MyAddon\Entity\Foo[]|\XF\Mvc\Entity\AbstractCollection
  */
This has edge cases where the exact return type doesn't really match and iterating can lose the proper type hint. Especially if calling methods on AbstractCollection

It would be nice if this was;
PHP:

Code:

Code:
/**
  * @property-read \XF\Mvc\Entity\AbstractCollection<\MyAddon\Entity\Foo>
  */

Thankfully via phpdocs we can do...

Read more

Continue reading...
 
BlackSpigot General Chat
Rules Help Users
    RealNotSound @ RealNotSound: Click on the “version history” tab of a resource to view older versiona @Dekomori...
    Top