Skip to content

Wrong detection of key-of annotation #5

Closed

Description

@mitelg

hey,

I just tried your library on our project https://github.com/shopware/shopware/actions/runs/31367358674/job/93388583940?pr=19140

I does not correctly detects the array definition of Doctrine DBAL. Problem is the key-of annotation here: https://github.com/doctrine/dbal/blob/4.4.4/src/DriverManager.php#L51
It should allow the defined array keys from here https://github.com/doctrine/dbal/blob/4.4.4/src/DriverManager.php#L77

Instead following error is thrown:

Return value['driver'] must be an object of type key-of, string 'pdo_mysql' returned"

Activity

  1. added theissue type on Aug 10, 2026
  2. rcalicdan commented on Aug 10, 2026

    @rcalicdan
    Member

    Hey @mitelg

    Thank you so much for reporting this issue and for testing TypePHP on your project..

    I have officially released v0.1.7 #6 which adds full support for key-of<T> and value-of<T> type annotations and document this feature.

    You can update to the latest version via Composer:

    Feel free to open a new issue or let me know if you encounter any other edge cases. Thanks again for helping improve TypePHP,,

  3. mitelg commented on Aug 10, 2026

    @mitelg
    Author

    thanks for the fast response. I will give it another try 👍

  4. rcalicdan commented on Aug 10, 2026

    @rcalicdan
    Member

    Hello @mitelg

    Just a quick add, I release another new version v0.1.8 #7

    This should fix most issues where TypePHP does not recognize a type annotation yet in its validation registry and falling back to is_class check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions