Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit a19477c

Browse files
committed
Allow Symfony 4 and avoid deprecation warning with Symfony 3.4
1 parent 3a2ecdf commit a19477c

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"minimum-stability": "beta",
1414
"require": {
1515
"php": "^5.6 || ~7.0",
16-
"symfony/process": "^2.8 || ^3.1",
16+
"symfony/process": "^2.8 || ^3.1 || ^4.0",
1717
"ext-curl": "*",
1818
"ext-zip": "*"
1919
},
@@ -25,7 +25,7 @@
2525
"php-mock/php-mock-phpunit": "^1.1",
2626
"php-coveralls/php-coveralls": "^1.0.2",
2727
"guzzle/guzzle": "^3.4.1",
28-
"symfony/var-dumper": "^3.3"
28+
"symfony/var-dumper": "^3.3 || ^4.0"
2929
},
3030
"autoload": {
3131
"psr-4": {

lib/Remote/Service/DriverService.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,20 @@ protected static function checkExecutable($executable)
145145
*/
146146
private function createProcess()
147147
{
148-
$processBuilder = (new ProcessBuilder())
149-
->setPrefix($this->executable)
150-
->setArguments($this->args)
151-
->addEnvironmentVariables($this->environment);
148+
// BC: ProcessBuilder deprecated since Symfony 3.4 and removed in Symfony 4.0.
149+
if (class_exists(ProcessBuilder::class)
150+
&& false === mb_strpos('@deprecated', (new \ReflectionClass(ProcessBuilder::class))->getDocComment())
151+
) {
152+
$processBuilder = (new ProcessBuilder())
153+
->setPrefix($this->executable)
154+
->setArguments($this->args)
155+
->addEnvironmentVariables($this->environment);
156+
157+
return $processBuilder->getProcess();
158+
}
159+
// Safe to use since Symfony 3.3
160+
$commandLine = array_merge([$this->executable], $this->args);
152161

153-
return $processBuilder->getProcess();
162+
return new Process($commandLine, null, $this->environment);
154163
}
155164
}

0 commit comments

Comments
 (0)