phpDocumentor / ReflectionDocBlock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type resolver doesn't resolve improved type definitions

jakzal opened this issue · comments

I use the reflectiondockblock to extract types from properties defined on phpunit test cases. Since PHPUnit implemented improvements in their type hints the type resolver fails to parse types for some properties.

array<string,array<int,string>> seems to be an issue in particular.

An example test failure on my side:

1) Zalas\PHPUnit\Doubles\Tests\TestCase\TestDoubles\Inheritance\InheritanceTest::test_it_initialises_parent_private_properties
InvalidArgumentException: "\PHPUnit\Framework\array<string,array<int,string>>" is not a valid Fqsen.

/phpunit-doubles/vendor/phpdocumentor/reflection-common/src/Fqsen.php:48
/phpunit-doubles/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:70
/phpunit-doubles/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:32
/phpunit-doubles/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:264
/phpunit-doubles/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:118
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:87
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:59
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:48
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:33
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:34
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:34
/phpunit-doubles/src/PhpDocumentor/ReflectionExtractor.php:25
/phpunit-doubles/src/TestCase/Doubler.php:69
/phpunit-doubles/src/TestCase/Doubler.php:39
/phpunit-doubles/src/TestCase/TestDoubles.php:35

I would need to double-check, but the version on master uses the latest TypeResolver that is able to handle these types.

We do support this for some time... but somehow we didn't have a test case for this. Which is added now phpDocumentor/TypeResolver@11a18d0