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
rcalicdan commentedon Aug 10, 2026
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 forkey-of<T>andvalue-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,,
mitelg commentedon Aug 10, 2026
thanks for the fast response. I will give it another try 👍
rcalicdan commentedon Aug 10, 2026
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.