Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Add callable type tracking #16

Open
j6s opened this issue Jul 27, 2020 · 0 comments
Open

Add callable type tracking #16

j6s opened this issue Jul 27, 2020 · 0 comments

Comments

@j6s
Copy link
Owner

j6s commented Jul 27, 2020

At the moment, using callable type declarations in @param annotations will run into Runtime exceptions from phpdocumentor/type-parser:

/**
 * @template TReturn
 * @param (callable(): TReturn) $generator
 * @return TReturn
 */

will always yield the following RuntimeException:

RuntimeException: A type is missing in an array expression

/var/www/html/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:286
/var/www/html/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:215
/var/www/html/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:215
/var/www/html/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:155
/var/www/html/vendor/j6s/phparch/src/Parser/Visitor/DocBlockTypeAnnotations.php:45
/var/www/html/vendor/j6s/phparch/src/Parser/Visitor/DocBlockTypeAnnotations.php:33
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:200
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
/var/www/html/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
/var/www/html/vendor/j6s/phparch/src/Parser/Parser.php:56
/var/www/html/vendor/j6s/phparch/src/Parser/Parser.php:37
/var/www/html/vendor/j6s/phparch/src/PhpArch.php:57
/var/www/html/vendor/j6s/phparch/src/PhpArch.php:31
/var/www/html/tests/Unit/ArchitectureTest.php:69

Off the top of my head, I don't know a good way of catching this without extending phpdocumentor/type-resolver.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant