Calling Developers!
We are reenergizing our code contribution process! Learn More

Type hinting in PHPStorm for transfer object collections

vasily.rodin Freelance Spryker Developer Spryker Solution Partner Posts: 25 ✨ - Novice

Hello community!

Recently on our project we've updated the `spryker/transfer` module, including this version:

In the changelog, it says:

  • Adjusted docblock type hint for the collection using generic syntax ArrayObject<Object> instead ArrayObject|Object[].

This improvement makes sense to me, but PHPStorm does not support this properly.

With the new annotation, many of our tests no longer have type hinting. This happens in the case when we try to access ArrayObject element by index [0], [1], etc

I've tried different settings in PHPStorm (or even plugins), but couldn't find a solution. offsetGet or getArrayCopy don't work as well.

So my question here: am I missing something in PHPStorm? Or if the problem exists for all projects, maybe it makes sense to rollback the PHPDoc for collections in spryker/transfer module to the old logic?