Skip to content

Commit 58b6521

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents ea043ab + 72d838a commit 58b6521

12 files changed

+85
-85
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ CHANGELOG
2121
-----
2222

2323
* environment variables will always be inherited
24-
* added a second `array $env = array()` argument to the `start()`, `run()`,
24+
* added a second `array $env = []` argument to the `start()`, `run()`,
2525
`mustRun()`, and `restart()` methods of the `Process` class
26-
* added a second `array $env = array()` argument to the `start()` method of the
26+
* added a second `array $env = []` argument to the `start()` method of the
2727
`PhpProcess` class
2828
* the `ProcessUtils::escapeArgument()` method has been removed
2929
* the `areEnvironmentVariablesInherited()`, `getOptions()`, and `setOptions()`

ExecutableFinder.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
class ExecutableFinder
2121
{
22-
private $suffixes = array('.exe', '.bat', '.cmd', '.com');
22+
private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
2323

2424
/**
2525
* Replaces default suffixes of executable.
@@ -48,11 +48,11 @@ public function addSuffix($suffix)
4848
*
4949
* @return string|null The executable path or default value
5050
*/
51-
public function find($name, $default = null, array $extraDirs = array())
51+
public function find($name, $default = null, array $extraDirs = [])
5252
{
5353
if (ini_get('open_basedir')) {
5454
$searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
55-
$dirs = array();
55+
$dirs = [];
5656
foreach ($searchPath as $path) {
5757
// Silencing against https://bugs.php.net/69240
5858
if (@is_dir($path)) {
@@ -70,7 +70,7 @@ public function find($name, $default = null, array $extraDirs = array())
7070
);
7171
}
7272

73-
$suffixes = array('');
73+
$suffixes = [''];
7474
if ('\\' === \DIRECTORY_SEPARATOR) {
7575
$pathExt = getenv('PATHEXT');
7676
$suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);

InputStream.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class InputStream implements \IteratorAggregate
2222
{
2323
/** @var callable|null */
2424
private $onEmpty = null;
25-
private $input = array();
25+
private $input = [];
2626
private $open = true;
2727

2828
/**

PhpExecutableFinder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function find($includeArgs = true)
5454
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
5555

5656
// PHP_BINARY return the current sapi executable
57-
if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
57+
if (PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) {
5858
return PHP_BINARY.$args;
5959
}
6060

@@ -76,7 +76,7 @@ public function find($includeArgs = true)
7676
return $php;
7777
}
7878

79-
$dirs = array(PHP_BINDIR);
79+
$dirs = [PHP_BINDIR];
8080
if ('\\' === \DIRECTORY_SEPARATOR) {
8181
$dirs[] = 'C:\xampp\php\\';
8282
}
@@ -91,7 +91,7 @@ public function find($includeArgs = true)
9191
*/
9292
public function findArguments()
9393
{
94-
$arguments = array();
94+
$arguments = [];
9595
if ('phpdbg' === \PHP_SAPI) {
9696
$arguments[] = '-qrr';
9797
}

PhpProcess.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(string $script, string $cwd = null, array $env = nul
3737
if (false === $php = $php ?? $executableFinder->find(false)) {
3838
$php = null;
3939
} else {
40-
$php = array_merge(array($php), $executableFinder->findArguments());
40+
$php = array_merge([$php], $executableFinder->findArguments());
4141
}
4242
if ('phpdbg' === \PHP_SAPI) {
4343
$file = tempnam(sys_get_temp_dir(), 'dbg');
@@ -65,7 +65,7 @@ public function setPhpBinary($php)
6565
/**
6666
* {@inheritdoc}
6767
*/
68-
public function start(callable $callback = null, array $env = array())
68+
public function start(callable $callback = null, array $env = [])
6969
{
7070
if (null === $this->getCommandLine()) {
7171
throw new RuntimeException('Unable to find the PHP executable.');

Pipes/AbstractPipes.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
abstract class AbstractPipes implements PipesInterface
2222
{
23-
public $pipes = array();
23+
public $pipes = [];
2424

2525
private $inputBuffer = '';
2626
private $input;
@@ -49,7 +49,7 @@ public function close()
4949
foreach ($this->pipes as $pipe) {
5050
fclose($pipe);
5151
}
52-
$this->pipes = array();
52+
$this->pipes = [];
5353
}
5454

5555
/**
@@ -117,8 +117,8 @@ protected function write()
117117
}
118118
}
119119

120-
$r = $e = array();
121-
$w = array($this->pipes[0]);
120+
$r = $e = [];
121+
$w = [$this->pipes[0]];
122122

123123
// let's have a look if something changed in streams
124124
if (false === @stream_select($r, $w, $e, 0, 0)) {
@@ -130,7 +130,7 @@ protected function write()
130130
$written = fwrite($stdin, $this->inputBuffer);
131131
$this->inputBuffer = substr($this->inputBuffer, $written);
132132
if (isset($this->inputBuffer[0])) {
133-
return array($this->pipes[0]);
133+
return [$this->pipes[0]];
134134
}
135135
}
136136

@@ -145,7 +145,7 @@ protected function write()
145145
if (isset($data[0])) {
146146
$this->inputBuffer = $data;
147147

148-
return array($this->pipes[0]);
148+
return [$this->pipes[0]];
149149
}
150150
}
151151
if (feof($input)) {
@@ -164,7 +164,7 @@ protected function write()
164164
fclose($this->pipes[0]);
165165
unset($this->pipes[0]);
166166
} elseif (!$w) {
167-
return array($this->pipes[0]);
167+
return [$this->pipes[0]];
168168
}
169169
}
170170

Pipes/UnixPipes.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -48,42 +48,42 @@ public function getDescriptors()
4848
if (!$this->haveReadSupport) {
4949
$nullstream = fopen('/dev/null', 'c');
5050

51-
return array(
52-
array('pipe', 'r'),
51+
return [
52+
['pipe', 'r'],
5353
$nullstream,
5454
$nullstream,
55-
);
55+
];
5656
}
5757

5858
if ($this->ttyMode) {
59-
return array(
60-
array('file', '/dev/tty', 'r'),
61-
array('file', '/dev/tty', 'w'),
62-
array('file', '/dev/tty', 'w'),
63-
);
59+
return [
60+
['file', '/dev/tty', 'r'],
61+
['file', '/dev/tty', 'w'],
62+
['file', '/dev/tty', 'w'],
63+
];
6464
}
6565

6666
if ($this->ptyMode && Process::isPtySupported()) {
67-
return array(
68-
array('pty'),
69-
array('pty'),
70-
array('pty'),
71-
);
67+
return [
68+
['pty'],
69+
['pty'],
70+
['pty'],
71+
];
7272
}
7373

74-
return array(
75-
array('pipe', 'r'),
76-
array('pipe', 'w'), // stdout
77-
array('pipe', 'w'), // stderr
78-
);
74+
return [
75+
['pipe', 'r'],
76+
['pipe', 'w'], // stdout
77+
['pipe', 'w'], // stderr
78+
];
7979
}
8080

8181
/**
8282
* {@inheritdoc}
8383
*/
8484
public function getFiles()
8585
{
86-
return array();
86+
return [];
8787
}
8888

8989
/**
@@ -94,18 +94,18 @@ public function readAndWrite($blocking, $close = false)
9494
$this->unblock();
9595
$w = $this->write();
9696

97-
$read = $e = array();
97+
$read = $e = [];
9898
$r = $this->pipes;
9999
unset($r[0]);
100100

101101
// let's have a look if something changed in streams
102-
set_error_handler(array($this, 'handleError'));
102+
set_error_handler([$this, 'handleError']);
103103
if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
104104
restore_error_handler();
105105
// if a system call has been interrupted, forget about it, let's try again
106106
// otherwise, an error occurred, let's reset pipes
107107
if (!$this->hasSystemCallBeenInterrupted()) {
108-
$this->pipes = array();
108+
$this->pipes = [];
109109
}
110110

111111
return $read;

Pipes/WindowsPipes.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
*/
2727
class WindowsPipes extends AbstractPipes
2828
{
29-
private $files = array();
30-
private $fileHandles = array();
31-
private $lockHandles = array();
32-
private $readBytes = array(
29+
private $files = [];
30+
private $fileHandles = [];
31+
private $lockHandles = [];
32+
private $readBytes = [
3333
Process::STDOUT => 0,
3434
Process::STDERR => 0,
35-
);
35+
];
3636
private $haveReadSupport;
3737

3838
public function __construct($input, bool $haveReadSupport)
@@ -44,10 +44,10 @@ public function __construct($input, bool $haveReadSupport)
4444
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
4545
//
4646
// @see https://bugs.php.net/bug.php?id=51800
47-
$pipes = array(
47+
$pipes = [
4848
Process::STDOUT => Process::OUT,
4949
Process::STDERR => Process::ERR,
50-
);
50+
];
5151
$tmpDir = sys_get_temp_dir();
5252
$lastError = 'unknown reason';
5353
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
@@ -98,21 +98,21 @@ public function getDescriptors()
9898
if (!$this->haveReadSupport) {
9999
$nullstream = fopen('NUL', 'c');
100100

101-
return array(
102-
array('pipe', 'r'),
101+
return [
102+
['pipe', 'r'],
103103
$nullstream,
104104
$nullstream,
105-
);
105+
];
106106
}
107107

108108
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800)
109109
// We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650
110110
// So we redirect output within the commandline and pass the nul device to the process
111-
return array(
112-
array('pipe', 'r'),
113-
array('file', 'NUL', 'w'),
114-
array('file', 'NUL', 'w'),
115-
);
111+
return [
112+
['pipe', 'r'],
113+
['file', 'NUL', 'w'],
114+
['file', 'NUL', 'w'],
115+
];
116116
}
117117

118118
/**
@@ -130,7 +130,7 @@ public function readAndWrite($blocking, $close = false)
130130
{
131131
$this->unblock();
132132
$w = $this->write();
133-
$read = $r = $e = array();
133+
$read = $r = $e = [];
134134

135135
if ($blocking) {
136136
if ($w) {
@@ -186,6 +186,6 @@ public function close()
186186
flock($this->lockHandles[$type], LOCK_UN);
187187
fclose($this->lockHandles[$type]);
188188
}
189-
$this->fileHandles = $this->lockHandles = array();
189+
$this->fileHandles = $this->lockHandles = [];
190190
}
191191
}

0 commit comments

Comments
 (0)