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

Type hinting in PHPStorm for transfer object collections

Options
vasily.rodin
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: https://github.com/spryker/transfer/releases/tag/3.35.0

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?