Closed aaa2000 closed 8 years ago
Hello @aaa2000,
Thanks for reporting the issue. I just tested this with following commands:
composer global require phpro/grumphp
mkdir test && cd test
git init
composer require symfony/console:2.1
grumphp configure # Here I added PHPCS as task
grumphp run
I do not retrieve the exception. Can you tell us how to reproduce the described issue?
The global packages are always prepended to the autloader, and should be used before the project packages. Maybe one of the paths is wrong on your system?
Thanks!
I get this error at step grumphp configure
.
grumphp configure -v
[InvalidArgumentException]
The helper "question" is not defined.
Exception trace:
() at /home/user/grumphp-bug-83/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php:79
Symfony\Component\Console\Helper\HelperSet->get() at /home/user/grumphp-bug-83/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:541
Symfony\Component\Console\Command\Command->getHelper() at /home/user/.composer/vendor/phpro/grumphp/src/GrumPHP/Console/Command/ConfigureCommand.php:119
GrumPHP\Console\Command\ConfigureCommand->buildConfiguration() at /home/user/.composer/vendor/phpro/grumphp/src/GrumPHP/Console/Command/ConfigureCommand.php:89
GrumPHP\Console\Command\ConfigureCommand->execute() at /home/user/grumphp-bug-83/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:239
Symfony\Component\Console\Command\Command->run() at /home/user/grumphp-bug-83/vendor/symfony/console/Symfony/Component/Console/Application.php:193
Symfony\Component\Console\Application->doRun() at /home/user/grumphp-bug-83/vendor/symfony/console/Symfony/Component/Console/Application.php:106
Symfony\Component\Console\Application->run() at /home/user/.composer/vendor/phpro/grumphp/bin/grumphp:32
configure
My global package composer global show -i
.
...
phpro/grumphp v0.7.0 A composer plugin that enables source code quality checks.
symfony/console v3.0.0 Symfony Console Component
...
I will try tomorrow the steps on a VM or another computer, and I will try another version of grumphp.
I can't reproduce the bug on the VM. You are right, I certainly have one of the paths wrong on my system. Sorry for the inconvenience.
Thanks.
I had the problem because I have an auto_prepend_file with the global composer autoload file in order to use var_dumper. https://symfony.com/doc/current/components/var_dumper/introduction.html
sudo sh -c "echo 'auto_prepend_file = \"/home/vagrant/.composer/vendor/autoload.php\"' > /etc/php5/cli/conf.d/30-global_composer.ini"
Cool, did not know about that one. But indeed: that can result in some strange behaviour. I don't think that we can do something about that: the file gets loaded and next de project file is prepended to the autoloading queue. So the project autoload will win.
When the installation of grumphp is global, a wrong dependency could be use by grumphp
bin/grumphp use the symfony/console=2.1.0 project dependency instead of global symfony/console dependency
At the moment, I do a hack in my global bin/grumphp to autoload only my global autoload