Skip to content

Commit 5fd4c32

Browse files
Use the PHP long array syntax
1 parent f9a9eaa commit 5fd4c32

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

components/process.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ a command in a sub-process::
2727
use Symfony\Component\Process\Process;
2828
use Symfony\Component\Process\Exception\ProcessFailedException;
2929

30-
$process = new Process(['ls', '-lsa']);
30+
$process = new Process(array('ls', '-lsa'));
3131
$process->run();
3232

3333
// executes after the command finishes
@@ -55,7 +55,7 @@ You can also use the :class:`Symfony\\Component\\Process\\Process` class with th
5555
foreach construct to get the output while it is generated. By default, the loop waits
5656
for new output before going to the next iteration::
5757

58-
$process = new Process(['ls', '-lsa']);
58+
$process = new Process(array('ls', '-lsa'));
5959
$process->start();
6060

6161
foreach ($process as $type => $data) {
@@ -72,7 +72,7 @@ for new output before going to the next iteration::
7272
it is generated. That iterator is exposed via the ``getIterator()`` method
7373
to allow customizing its behavior::
7474

75-
$process = new Process(['ls', '-lsa']);
75+
$process = new Process(array('ls', '-lsa'));
7676
$process->start();
7777
$iterator = $process->getIterator($process::ITER_SKIP_ERR | $process::ITER_KEEP_OUTPUT);
7878
foreach ($iterator as $data) {
@@ -90,7 +90,7 @@ with a non-zero code)::
9090
use Symfony\Component\Process\Exception\ProcessFailedException;
9191
use Symfony\Component\Process\Process;
9292

93-
$process = new Process(['ls', '-lsa']);
93+
$process = new Process(array('ls', '-lsa'));
9494

9595
try {
9696
$process->mustRun();
@@ -125,7 +125,7 @@ with a non-zero code)::
125125
$process = new Process('echo %MESSAGE%');
126126

127127
// On both Unix-like and Windows
128-
$process->run(null, ['MESSAGE' => 'Something to output']);
128+
$process->run(null, 'MESSAGE' => 'Something to output']);
129129

130130
Getting real-time Process Output
131131
--------------------------------
@@ -137,7 +137,7 @@ anonymous function to the
137137

138138
use Symfony\Component\Process\Process;
139139

140-
$process = new Process(['ls', '-lsa']);
140+
$process = new Process(array('ls', '-lsa'));
141141
$process->run(function ($type, $buffer) {
142142
if (Process::ERR === $type) {
143143
echo 'ERR > '.$buffer;
@@ -156,7 +156,7 @@ process, the :method:`Symfony\\Component\\Process\\Process::isRunning` method
156156
to check if the process is done and the
157157
:method:`Symfony\\Component\\Process\\Process::getOutput` method to get the output::
158158

159-
$process = new Process(['ls', '-lsa']);
159+
$process = new Process(array('ls', '-lsa'));
160160
$process->start();
161161

162162
while ($process->isRunning()) {
@@ -168,7 +168,7 @@ to check if the process is done and the
168168
You can also wait for a process to end if you started it asynchronously and
169169
are done doing other stuff::
170170

171-
$process = new Process(['ls', '-lsa']);
171+
$process = new Process(array('ls', '-lsa'));
172172
$process->start();
173173

174174
// ... do other things
@@ -207,7 +207,7 @@ are done doing other stuff::
207207
a callback that is called repeatedly whilst the process is still running, passing
208208
in the output and its type::
209209

210-
$process = new Process(['ls', '-lsa']);
210+
$process = new Process(array('ls', '-lsa'));
211211
$process->start();
212212

213213
$process->wait(function ($type, $buffer) {
@@ -226,7 +226,7 @@ Before a process is started, you can specify its standard input using either the
226226
of the constructor. The provided input can be a string, a stream resource or a
227227
Traversable object::
228228

229-
$process = new Process(['cat']);
229+
$process = new Process('cat']);
230230
$process->setInput('foobar');
231231
$process->run();
232232

@@ -239,7 +239,7 @@ provides the :class:`Symfony\\Component\\Process\\InputStream` class::
239239
$input = new InputStream();
240240
$input->write('foo');
241241

242-
$process = new Process(['cat']);
242+
$process = new Process(array('cat'));
243243
$process->setInput($input);
244244
$process->start();
245245

@@ -265,7 +265,7 @@ The input of a process can also be defined using `PHP streams`_::
265265

266266
$stream = fopen('php://temporary', 'w+');
267267

268-
$process = new Process(['cat']);
268+
$process = new Process(array('cat'));
269269
$process->setInput($stream);
270270
$process->start();
271271

@@ -291,7 +291,7 @@ is sent to the running process. The default signal sent to a process is ``SIGKIL
291291
Please read the :ref:`signal documentation below<reference-process-signal>`
292292
to find out more about signal handling in the Process component::
293293

294-
$process = new Process(['ls', '-lsa']);
294+
$process = new Process(array('ls', '-lsa'));
295295
$process->start();
296296

297297
// ... do other things
@@ -320,7 +320,7 @@ timeout (in seconds)::
320320

321321
use Symfony\Component\Process\Process;
322322

323-
$process = new Process(['ls', '-lsa']);
323+
$process = new Process(array('ls', '-lsa'));
324324
$process->setTimeout(3600);
325325
$process->run();
326326

@@ -352,7 +352,7 @@ considers the time since the last output was produced by the process::
352352

353353
use Symfony\Component\Process\Process;
354354

355-
$process = new Process(['something-with-variable-runtime']);
355+
$process = new Process(array('something-with-variable-runtime'));
356356
$process->setTimeout(3600);
357357
$process->setIdleTimeout(60);
358358
$process->run();
@@ -368,7 +368,7 @@ When running a program asynchronously, you can send it POSIX signals with the
368368

369369
use Symfony\Component\Process\Process;
370370

371-
$process = new Process(['find', '/', '-name', 'rabbit']);
371+
$process = new Process(array('find', '/', '-name', 'rabbit'));
372372
$process->start();
373373

374374
// will send a SIGKILL to the process
@@ -382,7 +382,7 @@ You can access the `pid`_ of a running process with the
382382

383383
use Symfony\Component\Process\Process;
384384

385-
$process = new Process(['/usr/bin/php', 'worker.php']);
385+
$process = new Process(array('/usr/bin/php', 'worker.php'));
386386
$process->start();
387387

388388
$pid = $process->getPid();
@@ -397,7 +397,7 @@ Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and
397397

398398
use Symfony\Component\Process\Process;
399399

400-
$process = new Process(['/usr/bin/php', 'worker.php']);
400+
$process = new Process(array('/usr/bin/php', 'worker.php'));
401401
$process->disableOutput();
402402
$process->run();
403403

0 commit comments

Comments
 (0)