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

Add callable type tracking #16

@j6s

Description

@j6s

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions