8000 [Process] Code clean up · symfony/symfony@4882777 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4882777

Browse files
committed
[Process] Code clean up
1 parent 7b8acbc commit 4882777

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Symfony/Component/Process/ProcessBuilder.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ProcessBuilder
2020
{
2121
private $arguments;
2222
private $cwd;
23-
private $env;
23+
private $env = array();
2424
private $stdin;
2525
private $timeout;
2626
private $options;
@@ -63,10 +63,6 @@ public function inheritEnvironmentVariables($inheritEnv = true)
6363

6464
public function setEnv($name, $value)
6565
{
66-
if (null === $this->env) {
67-
$this->env = array();
68-
}
69-
7066
$this->env[$name] = $value;
7167

7268
return $this;
@@ -117,7 +113,7 @@ public function getProcess()
117113
$script = implode(' ', array_map('escapeshellarg', $this->arguments));
118114
}
119115

120-
$env = $this->inheritEnv && $_ENV ? ($this->env ?: array()) + $_ENV : $this->env;
116+
$env = $this->inheritEnv && $_ENV ? $this->env + $_ENV : $this->env;
121117

122118
return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options);
123119
}

0 commit comments

Comments
 (0)
0