Skip to content

Commit

Permalink
fix(Adapaters/Process) shim fromShellCommandline method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Dec 9, 2023
1 parent 4edec26 commit 2b9b78e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Adapters/Symfony/Component/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,22 @@ public function createNewConsole(): void
$options['bypass_shell'] = true;
$optionsReflectionProperty->setValue($this, $options);
}

/**
* @param array<mixed> $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;
}
}

0 comments on commit 2b9b78e

Please sign in to comment.