Skip to content

Endless loop from @template TKey as array-key #4670

@voku

Description

@voku

Bug report

I have an endless loop via @template TKey as array-key in this repo https://github.com/voku/Arrayy/tree/7.8.7 ... I only could fix it via removing the as array-key part in the \Arrayy\Arrayy class (voku/Arrayy@c4918ee#diff-5c5a0eceb722d6a06ff9dce22c42fb98db853e5ce760b5f6b4af84da38e1fdfbL18), and I think it's not needed there anyway because the \Arrayy\Collection\Collection class is mostly used for type checks and there TKey of array-key is working.

PS: it seems the bug was intro via "Support for union type as @template type bound"? (phpstan/phpstan-src@ac7b49e#diff-25162cb9381c440f083e718a296b61f70741c7eb3eaaa1daf3f785c301e4842f)

Code snippet that reproduces the problem

Sorry, but I couldn't find the code that produces the endless loop in PHPStan. :-/

I tried strace & --debug & -vvvvv but the only thing that happens is that the memory filled and my laptop cashed. Is there a thing that I can do to find the issue?


Anyway I could work around the issue, and maybe I used the PHPDoc annotation wrongly from the beginning, so feel free to close the issue I only wanted to write this down, so that if someone has the same issue he/she maybe find this issue and knows where to search for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions