Skip to content

Commit 6841a7e

Browse files
committed
Add support for 'php -i' in php subcommand
1 parent 651ab4d commit 6841a7e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Command/PhpCommand.php

100644100755
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Symfony\Component\Console\Command\Command;
77
use Symfony\Component\Console\Input\InputArgument;
88
use Symfony\Component\Console\Input\InputInterface;
9+
use Symfony\Component\Console\Input\InputOption;
910
use Symfony\Component\Console\Output\OutputInterface;
1011

1112
class PhpCommand extends Command
@@ -16,13 +17,20 @@ protected function configure()
1617
$this->setName("php");
1718
$this->setDescription("Runs the PHP CLI built from source");
1819

19-
$this->addArgument("args", InputArgument::IS_ARRAY | InputArgument::REQUIRED, "arguments to pass to the PHP CLI");
20+
$this->addOption("info", "-i", InputOption::VALUE_NONE, "show PHP information");
21+
22+
$this->addArgument("args", InputArgument::IS_ARRAY, "arguments to pass to the PHP CLI");
2023
}
2124

2225
protected function execute(InputInterface $input, OutputInterface $output)
2326
{
27+
$arguments = $input->getArgument('args');
28+
if ($input->hasOption('info')) {
29+
$arguments[] = '-i';
30+
}
31+
2432
$dockerImage = new DockerImage();
25-
$process = $dockerImage->createProcess('run-cli', $input->getArgument('args'));
33+
$process = $dockerImage->createProcess('run-cli', $arguments);
2634
$process->setTimeout(null);
2735

2836
return ConsoleProcessBridge::runProcessFromConsole($process, $input, $output);

0 commit comments

Comments
 (0)