Phpdocumentor: Error : Missing argument 1 for phpDocumentor\Descriptor\Collection::get()

Created on 25 Dec 2016  路  9Comments  路  Source: phpDocumentor/phpDocumentor

Hi, I lead the project on PHPOffice/PHPPresentation.

I use phpdoc since a while with the command :

./vendor/bin/phpdoc -q -d ./src -t ./build/docs --template="responsive-twig"

The version used is :

"phpdocumentor/phpdocumentor":"2.*"

But now I have the following error (Stack Trace)

$ ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --template="responsive-twig"

PHP Warning:  Missing argument 1 for phpDocumentor\Descriptor\Collection::get(), called in /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php on line 672 and defined in /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Descriptor/Collection.php on line 72

PHP Stack trace:

PHP   1. {main}() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/bin/phpdoc:0
PHP   2. phpDocumentor\Application->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/bin/phpdoc:24
PHP   3. Symfony\Component\Console\Application->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Application.php:183
PHP   4. Symfony\Component\Console\Application->doRun() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:124
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:193
PHP   6. Symfony\Component\Console\Command\Command->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:850
PHP   7. phpDocumentor\Command\Project\RunCommand->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Command/Command.php:257
PHP   8. Symfony\Component\Console\Command\Command->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Command/Project/RunCommand.php:275
PHP   9. phpDocumentor\Transformer\Command\Project\TransformCommand->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Command/Command.php:257
PHP  10. phpDocumentor\Console\Output\Output->writeTimedLog() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php:206
PHP  11. call_user_func_array:{/home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59}() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59
PHP  12. phpDocumentor\Transformer\Transformer->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59
PHP  13. phpDocumentor\Transformer\Transformer->transformProject() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:141
PHP  14. phpDocumentor\Transformer\Transformer->applyTransformationToProject() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:275
PHP  15. phpDocumentor\Plugin\Twig\Writer\Twig->transform() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:312
PHP  16. Twig_Environment->render() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Plugin/Twig/Writer/Twig.php:116
PHP  17. Twig_Template->render() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Environment.php:362
PHP  18. Twig_Template->display() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:411
PHP  19. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  20. __TwigTemplate_ec16ff7d9a402f0b6cfc1ae1e4337a93deb94953404b64a5c550438544e01e48->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  21. Twig_Template->display() /tmp/phpdoc-twig-cache/8a/8ae14a3e6f7a76b8c829686c7715462e9a6aeab94ec49ea05f4daf3d8e0b17c0.php:41
PHP  22. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  23. __TwigTemplate_20952fe886e04f4ad5054d816920ebfa852c467232629f199db11637e3f7b321->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  24. Twig_Template->displayBlock() /tmp/phpdoc-twig-cache/ef/ef47605a2aecb2071c0793a1b5c281f2b168eb8e52d15b427a3f11399658300d.php:78
PHP  25. __TwigTemplate_ec16ff7d9a402f0b6cfc1ae1e4337a93deb94953404b64a5c550438544e01e48->block_content() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:215
PHP  26. Twig_Template->display() /tmp/phpdoc-twig-cache/8a/8ae14a3e6f7a76b8c829686c7715462e9a6aeab94ec49ea05f4daf3d8e0b17c0.php:286
PHP  27. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  28. __TwigTemplate_bf8d06c24f56bf3584958f686f216ef9c928b57d5630e8c15e06d33c32a4fe24->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  29. Twig_Template->getAttribute() /tmp/phpdoc-twig-cache/30/303030731510c66d7efc71bbb838dd40dcb85ef62602920cc2097002a70a77b4.php:35
PHP  30. phpDocumentor\Descriptor\Collection->get() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:672

PHP Notice:  Undefined variable: index in /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Descriptor/Collection.php on line 74

PHP Stack trace:
PHP   1. {main}() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/bin/phpdoc:0
PHP   2. phpDocumentor\Application->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/bin/phpdoc:24
PHP   3. Symfony\Component\Console\Application->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Application.php:183
PHP   4. Symfony\Component\Console\Application->doRun() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:124
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:193
PHP   6. Symfony\Component\Console\Command\Command->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Application.php:850
PHP   7. phpDocumentor\Command\Project\RunCommand->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Command/Command.php:257
PHP   8. Symfony\Component\Console\Command\Command->run() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Command/Project/RunCommand.php:275
PHP   9. phpDocumentor\Transformer\Command\Project\TransformCommand->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/symfony/console/Command/Command.php:257
PHP  10. phpDocumentor\Console\Output\Output->writeTimedLog() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php:206
PHP  11. call_user_func_array:{/home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59}() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59
PHP  12. phpDocumentor\Transformer\Transformer->execute() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Console/Output/Output.php:59
PHP  13. phpDocumentor\Transformer\Transformer->transformProject() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:141
PHP  14. phpDocumentor\Transformer\Transformer->applyTransformationToProject() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:275
PHP  15. phpDocumentor\Plugin\Twig\Writer\Twig->transform() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Transformer/Transformer.php:312
PHP  16. Twig_Environment->render() /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Plugin/Twig/Writer/Twig.php:116
PHP  17. Twig_Template->render() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Environment.php:362
PHP  18. Twig_Template->display() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:411
PHP  19. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  20. __TwigTemplate_ec16ff7d9a402f0b6cfc1ae1e4337a93deb94953404b64a5c550438544e01e48->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  21. Twig_Template->display() /tmp/phpdoc-twig-cache/8a/8ae14a3e6f7a76b8c829686c7715462e9a6aeab94ec49ea05f4daf3d8e0b17c0.php:41
PHP  22. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  23. __TwigTemplate_20952fe886e04f4ad5054d816920ebfa852c467232629f199db11637e3f7b321->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  24. Twig_Template->displayBlock() /tmp/phpdoc-twig-cache/ef/ef47605a2aecb2071c0793a1b5c281f2b168eb8e52d15b427a3f11399658300d.php:78
PHP  25. __TwigTemplate_ec16ff7d9a402f0b6cfc1ae1e4337a93deb94953404b64a5c550438544e01e48->block_content() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:215
PHP  26. Twig_Template->display() /tmp/phpdoc-twig-cache/8a/8ae14a3e6f7a76b8c829686c7715462e9a6aeab94ec49ea05f4daf3d8e0b17c0.php:286
PHP  27. Twig_Template->displayWithErrorHandling() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:403
PHP  28. __TwigTemplate_bf8d06c24f56bf3584958f686f216ef9c928b57d5630e8c15e06d33c32a4fe24->doDisplay() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:432
PHP  29. Twig_Template->getAttribute() /tmp/phpdoc-twig-cache/30/303030731510c66d7efc71bbb838dd40dcb85ef62602920cc2097002a70a77b4.php:35
PHP  30. phpDocumentor\Descriptor\Collection->get() /home/travis/build/PHPOffice/PHPPresentation/vendor/twig/twig/lib/Twig/Template.php:672

PHP Notice:  Undefined variable: index in /home/travis/build/PHPOffice/PHPPresentation/vendor/phpdocumentor/phpdocumentor/src/phpDocumentor/Descriptor/Collection.php on line 7
bug template

Most helpful comment

Looks like this is an issue in the template. I will try to investigate how to fix this.

All 9 comments

I'm having this issue locally to now (I didn't before).
As far as I can see it's after the update of twig/twig (v1.26.1 => v1.31.0) that the error started appearing. (or any version in between)

I did a little try/error. The last version of twig that works is 1.27.
So, a (not so nice) solution is to add a dependency in PHPOffice to "twig/twig":"1.27", overriding the one defined in phpDocumentor.

Looks like this is an issue in the template. I will try to investigate how to fix this.

@Progi1984 and @troosan is this still an issue? I have cloned the repo and used the following command in an attempt to reproduce the issue:

php -d error_reporting=-1 -d display_errors=stderr ./vendor/bin/phpdoc -d ./src -t ./build/docs --template="responsive-twig" -vvvv --force

But no issues popped up when I ran this ..

@mvriel Yes, the problem is always here. If i remove the dependency "twig/twig":"1.27", the problem appears.

I'm unable to duplicate this, on PHP 7.0.15 and 5.5.9 (both on Ubuntu), whether running phpdoc from its own sandbox installation, or running it from vendor/bin of a PHPPresentation sandbox installation.

@Progi1984 I'm guessing that you are running phpdoc from the vendor/bin of your PHPPresentation sandbox installation. If so, I think we'll need a copy of your composer.lock file in order to duplicate the issue, since it's not committed to your repo. As an aside, if it is indeed a local composer.lock file in your sandbox that is locking in your own installation's dependencies, then I wonder if a composer update would clear the issue for you. Right now, twig/twig is at 1.33.2, and has potentially cleared whatever might be the original source of this bug.

@Progi1984 @ashnazg Indeed it seems to be working now.
version v1.33.1 still had the problem but version v1.33.2 (released 2017-04-21) indeed fixed the issue.

I expect this issue to be resolved since phpdocumentor itself already contains twig v1.33.2. But we allow lower versions. Feel free to reopen this issue when you think we need to solve something in our code.

I confirm it is fixed :)

Was this page helpful?
0 / 5 - 0 ratings