-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Description
When incorporating phpdoc-md into a project, my composer installed phpdocumentor/reflection-docblock
version 4.3.0. Version 4 of reflection-docblock adds a dependency on webmozart/assert
, which they use to assert values passed into methods since reflection-docblock version 3.x. The DocBlock
constructor now requires the first variable be a string, which makes the assertion throw this exception:
kage@derp:~/github/phpdoc-md$ bin/phpdoc-md
PHP Fatal error: Clean\PhpDocMd\Markdown\GitHub\ClassInfo::__toString -> InvalidArgumentException: Expected a string. Got: ReflectionMethod in /home/kage/github/phpdoc-md/vendor/webmozart/assert/src/Assert.php:1081
Stack trace:
#0 /home/kage/github/phpdoc-md/vendor/webmozart/assert/src/Assert.php(174): Webmozart\Assert\Assert::reportInvalidArgument('Expected a stri...')
#1 /home/kage/github/phpdoc-md/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php(59): Webmozart\Assert\Assert::string(Object(ReflectionMethod))
#2 /home/kage/github/phpdoc-md/src/ClassParser.php(58): phpDocumentor\Reflection\DocBlock->__construct(Object(ReflectionMethod))
#3 /home/kage/github/phpdoc-md/src/ClassParser.php(50): Clean\PhpDocMd\ClassParser->getMethodDetails(Object(ReflectionMethod))
#4 /home/kage/github/phpdoc-md/src/Markdown/ClassInfo.php(32): Clean\PhpDocMd\ClassParser->getMethodsDetails()
#5 /home/kage/github/phpdoc-md/vendor/clean/view/src/AbstractView.php(92): Clean\PhpDocMd\Markdown\ClassInfo->render()
#6 [internal function]: Clean\ in /home/kage/github/phpdoc-md/vendor/clean/view/src/AbstractView.php on line 108
PHP version: PHP 7.0
Suggestions:
- (difficult, recommended) Refactor instantiation of
DocBlock
insrc/ClassParser.php
. Tried this myself but it led to more failures. - (easy, not recommended) Change
composer.json
to requirephpdocumentor/reflection-docblock
only at^2.0
. This is not recommended because the 2.x version is no longer maintained, but is what I did in my project for an immediate fix.
Metadata
Metadata
Assignees
Labels
No labels