26
26
*/
27
27
class WindowsPipes extends AbstractPipes
28
28
{
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 = [
33
33
Process::STDOUT => 0 ,
34
34
Process::STDERR => 0 ,
35
- ) ;
35
+ ] ;
36
36
private $ haveReadSupport ;
37
37
38
38
public function __construct ($ input , bool $ haveReadSupport )
@@ -44,10 +44,10 @@ public function __construct($input, bool $haveReadSupport)
44
44
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
45
45
//
46
46
// @see https://bugs.php.net/bug.php?id=51800
47
- $ pipes = array (
47
+ $ pipes = [
48
48
Process::STDOUT => Process::OUT ,
49
49
Process::STDERR => Process::ERR ,
50
- ) ;
50
+ ] ;
51
51
$ tmpDir = sys_get_temp_dir ();
52
52
$ lastError = 'unknown reason ' ;
53
53
set_error_handler (function ($ type , $ msg ) use (&$ lastError ) { $ lastError = $ msg ; });
@@ -98,21 +98,21 @@ public function getDescriptors()
98
98
if (!$ this ->haveReadSupport ) {
99
99
$ nullstream = fopen ('NUL ' , 'c ' );
100
100
101
- return array (
102
- array ( 'pipe ' , 'r ' ) ,
101
+ return [
102
+ [ 'pipe ' , 'r ' ] ,
103
103
$ nullstream ,
104
104
$ nullstream ,
105
- ) ;
105
+ ] ;
106
106
}
107
107
108
108
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800)
109
109
// We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650
110
110
// 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
+ ] ;
116
116
}
117
117
118
118
/**
@@ -130,7 +130,7 @@ public function readAndWrite($blocking, $close = false)
130
130
{
131
131
$ this ->unblock ();
132
132
$ w = $ this ->write ();
133
- $ read = $ r = $ e = array () ;
133
+ $ read = $ r = $ e = [] ;
134
134
135
135
if ($ blocking ) {
136
136
if ($ w ) {
@@ -186,6 +186,6 @@ public function close()
186
186
flock ($ this ->lockHandles [$ type ], LOCK_UN );
187
187
fclose ($ this ->lockHandles [$ type ]);
188
188
}
189
- $ this ->fileHandles = $ this ->lockHandles = array () ;
189
+ $ this ->fileHandles = $ this ->lockHandles = [] ;
190
190
}
191
191
}
0 commit comments