From 2b9b78e050ba457dda7975ea33e2390cfc59d87c Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 9 Dec 2023 18:42:03 +0100 Subject: [PATCH] fix(Adapaters/Process) shim fromShellCommandline method --- .../Symfony/Component/Process/Process.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Adapters/Symfony/Component/Process/Process.php b/src/Adapters/Symfony/Component/Process/Process.php index 1ebae185c..05bdcb45e 100644 --- a/src/Adapters/Symfony/Component/Process/Process.php +++ b/src/Adapters/Symfony/Component/Process/Process.php @@ -79,4 +79,22 @@ public function createNewConsole(): void $options['bypass_shell'] = true; $optionsReflectionProperty->setValue($this, $options); } + + /** + * @param array $arguments + */ + public static function __callStatic(string $name, array $arguments):mixed + { + if ($name === 'fromShellCommandline') { + $command = array_shift($arguments); + $process = new self([], ...$arguments); // @phpstan-ignore-line + $processCommandLineProperty = new \ReflectionProperty(SymfonyProcess::class, 'commandline'); + $processCommandLineProperty->setAccessible(true); + $processCommandLineProperty->setValue($process, $command); + + return $process; + } + + return null; + } }