I'm using a Symfony console application and trying to passed the output of phpstan as the input of my console command:
vendor/bin/phpstan analyse | bin/wte analyse
Currently the commands run as expected, but how can I pass the output of phpstan into the bin/wte analyse
command?
// 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');
}
}
Symfony Console doesn't have any feature dealing with standard input. But it's not needed, because you are still on PHP and can use any native features.