在我的应用程序中,我正在使用Symfony/Console包(v.3.2.7),我创建了几个可以正常工作的命令 .

现在我正在尝试自动化一些任务,我在composer.json脚本部分添加了

"scripts": {
        "test": [
            "@php app/console myproject:setup"
        ]
    }

并且命令中的代码是

<?php
namespace MyProject\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
 * Class SetupCommand
 * @package WpSkeletonCLI\Command
 */
class SetupCommand extends Command
{
    protected function configure()
    {
        $this->setName('myproject:setup');
        $this->setDescription('A setup wizard for your brand new skeleton based project.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->getHelper('question')->ask($input, $output, new ConfirmationQuestion('Are you displaying this question?', false));
    }
}

如果我从控制台运行命令,它工作正常,但如果我从编辑器以相同的方式运行命令它不起作用,它没有显示错误,并且没有显示问题 . 我试图添加print命令只是为了知道命令是否正确调用,我可以看到我所有的打印示例(两种方法) .

我在作曲家上也是scripts section,我唯一注意到的是我没有使用Composer Event对象 .

也许Symfony Question Helper与Composer的运行脚本不兼容?