【发布时间】:2020-09-13 14:16:30
【问题描述】:
我正在使用 Symfony 控制台应用程序并尝试将 phpstan 的输出作为控制台命令的输入:
vendor/bin/phpstan analyse | bin/wte analyse
目前命令按预期运行,但如何将 phpstan 的输出传递给bin/wte analyse 命令?
// AnalyseCommand.php
final class AnalyseCommand extends Command
{
public const NAME = 'analyse';
/**
* @var SymfonyStyle
*/
private $symfonyStyle;
public function __construct(SymfonyStyle $symfonyStyle)
{
$this->symfonyStyle = $symfonyStyle;
parent::__construct();
}
public function execute(InputInterface $input, OutputInterface $output): int
{
// Get phpstan output in here.
return ShellCode::SUCCESS;
}
protected function configure(): void
{
$this->setName(self::NAME);
$this->setDescription('Find an error');
}
}
【问题讨论】:
标签: php symfony stdin symfony-console