@@ -340,7 +340,7 @@ public function start(?callable $callback = null, array $env = [])
340
340
}
341
341
342
342
if (!is_dir ($ this ->cwd )) {
343
- throw new RuntimeException (sprintf ('The provided cwd "%s" does not exist. ' , $ this ->cwd ));
343
+ throw new RuntimeException (\ sprintf ('The provided cwd "%s" does not exist. ' , $ this ->cwd ));
344
344
}
345
345
346
346
$ process = @proc_open ($ commandline , $ descriptors , $ this ->processPipes ->pipes , $ this ->cwd , $ envPairs , $ this ->options );
@@ -1197,7 +1197,7 @@ public function setOptions(array $options)
1197
1197
foreach ($ options as $ key => $ value ) {
1198
1198
if (!\in_array ($ key , $ existingOptions )) {
1199
1199
$ this ->options = $ defaultOptions ;
1200
- throw new LogicException (sprintf ('Invalid option "%s" passed to "%s()". Supported options are "%s". ' , $ key , __METHOD__ , implode ('", " ' , $ existingOptions )));
1200
+ throw new LogicException (\ sprintf ('Invalid option "%s" passed to "%s()". Supported options are "%s". ' , $ key , __METHOD__ , implode ('", " ' , $ existingOptions )));
1201
1201
}
1202
1202
$ this ->options [$ key ] = $ value ;
1203
1203
}
@@ -1453,10 +1453,10 @@ private function doSignal(int $signal, bool $throwException): bool
1453
1453
}
1454
1454
1455
1455
if ('\\' === \DIRECTORY_SEPARATOR ) {
1456
- exec (sprintf ('taskkill /F /T /PID %d 2>&1 ' , $ pid ), $ output , $ exitCode );
1456
+ exec (\ sprintf ('taskkill /F /T /PID %d 2>&1 ' , $ pid ), $ output , $ exitCode );
1457
1457
if ($ exitCode && $ this ->isRunning ()) {
1458
1458
if ($ throwException ) {
1459
- throw new RuntimeException (sprintf ('Unable to kill the process (%s). ' , implode (' ' , $ output )));
1459
+ throw new RuntimeException (\ sprintf ('Unable to kill the process (%s). ' , implode (' ' , $ output )));
1460
1460
}
1461
1461
1462
1462
return false ;
@@ -1466,12 +1466,12 @@ private function doSignal(int $signal, bool $throwException): bool
1466
1466
$ ok = @proc_terminate ($ this ->process , $ signal );
1467
1467
} elseif (\function_exists ('posix_kill ' )) {
1468
1468
$ ok = @posix_kill ($ pid , $ signal );
1469
- } elseif ($ ok = proc_open (sprintf ('kill -%d %d ' , $ signal , $ pid ), [2 => ['pipe ' , 'w ' ]], $ pipes )) {
1469
+ } elseif ($ ok = proc_open (\ sprintf ('kill -%d %d ' , $ signal , $ pid ), [2 => ['pipe ' , 'w ' ]], $ pipes )) {
1470
1470
$ ok = false === fgets ($ pipes [2 ]);
1471
1471
}
1472
1472
if (!$ ok ) {
1473
1473
if ($ throwException ) {
1474
- throw new RuntimeException (sprintf ('Error while sending signal "%s". ' , $ signal ));
1474
+ throw new RuntimeException (\ sprintf ('Error while sending signal "%s". ' , $ signal ));
1475
1475
}
1476
1476
1477
1477
return false ;
@@ -1528,7 +1528,7 @@ function ($m) use (&$env, $uid) {
1528
1528
1529
1529
if (!$ comSpec && $ comSpec = (new ExecutableFinder ())->find ('cmd.exe ' )) {
1530
1530
// Escape according to CommandLineToArgvW rules
1531
- $ comSpec = '" ' .preg_replace ('{( \\\\*+)"} ' , '$1$1\" ' , $ comSpec ) .'" ' ;
1531
+ $ comSpec = '" ' .preg_replace ('{( \\\\*+)"} ' , '$1$1\" ' , $ comSpec ).'" ' ;
1532
1532
}
1533
1533
1534
1534
$ cmd = ($ comSpec ?? 'cmd ' ).' /V:ON /E:ON /D /C ( ' .str_replace ("\n" , ' ' , $ cmd ).') ' ;
@@ -1547,7 +1547,7 @@ function ($m) use (&$env, $uid) {
1547
1547
private function requireProcessIsStarted (string $ functionName ): void
1548
1548
{
1549
1549
if (!$ this ->isStarted ()) {
1550
- throw new LogicException (sprintf ('Process must be started before calling "%s()". ' , $ functionName ));
1550
+ throw new LogicException (\ sprintf ('Process must be started before calling "%s()". ' , $ functionName ));
1551
1551
}
1552
1552
}
1553
1553
@@ -1559,7 +1559,7 @@ private function requireProcessIsStarted(string $functionName): void
1559
1559
private function requireProcessIsTerminated (string $ functionName ): void
1560
1560
{
1561
1561
if (!$ this ->isTerminated ()) {
1562
- throw new LogicException (sprintf ('Process must be terminated before calling "%s()". ' , $ functionName ));
1562
+ throw new LogicException (\ sprintf ('Process must be terminated before calling "%s()". ' , $ functionName ));
1563
1563
}
1564
1564
}
1565
1565
@@ -1589,7 +1589,7 @@ private function replacePlaceholders(string $commandline, array $env): string
1589
1589
{
1590
1590
return preg_replace_callback ('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/ ' , function ($ matches ) use ($ commandline , $ env ) {
1591
1591
if (!isset ($ env [$ matches [1 ]]) || false === $ env [$ matches [1 ]]) {
1592
- throw new InvalidArgumentException (sprintf ('Command line is missing a value for parameter "%s": ' , $ matches [1 ]).$ commandline );
1592
+ throw new InvalidArgumentException (\ sprintf ('Command line is missing a value for parameter "%s": ' , $ matches [1 ]).$ commandline );
1593
1593
}
1594
1594
1595
1595
return $ this ->escapeArgument ($ env [$ matches [1 ]]);
0 commit comments