Skip to content

Commit 8eb6dc5

Browse files
CS fixes
1 parent e2a61c1 commit 8eb6dc5

14 files changed

+32
-29
lines changed

Exception/ProcessFailedException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ public function __construct(Process $process)
2828
throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
2929
}
3030

31-
$error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
31+
$error = \sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
3232
$process->getCommandLine(),
3333
$process->getExitCode(),
3434
$process->getExitCodeText(),
3535
$process->getWorkingDirectory()
3636
);
3737

3838
if (!$process->isOutputDisabled()) {
39-
$error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
39+
$error .= \sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
4040
$process->getOutput(),
4141
$process->getErrorOutput()
4242
);

Exception/ProcessSignaledException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(Process $process)
2626
{
2727
$this->process = $process;
2828

29-
parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
29+
parent::__construct(\sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
3030
}
3131

3232
public function getProcess(): Process

Exception/ProcessTimedOutException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(Process $process, int $timeoutType)
3131
$this->process = $process;
3232
$this->timeoutType = $timeoutType;
3333

34-
parent::__construct(sprintf(
34+
parent::__construct(\sprintf(
3535
'The process "%s" exceeded the timeout of %s seconds.',
3636
$process->getCommandLine(),
3737
$this->getExceededTimeout()
@@ -67,7 +67,7 @@ public function getExceededTimeout(): ?float
6767
return match ($this->timeoutType) {
6868
self::TYPE_GENERAL => $this->process->getTimeout(),
6969
self::TYPE_IDLE => $this->process->getIdleTimeout(),
70-
default => throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)),
70+
default => throw new \LogicException(\sprintf('Unknown timeout type "%d".', $this->timeoutType)),
7171
};
7272
}
7373
}

ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function find(string $name, ?string $default = null, array $extraDirs = [
7474
$suffixes = $this->suffixes;
7575
$suffixes = array_merge($suffixes, $pathExt ? explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']);
7676
}
77-
$suffixes = '' !== pathinfo($name, PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']);
77+
$suffixes = '' !== pathinfo($name, \PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']);
7878
foreach ($suffixes as $suffix) {
7979
foreach ($dirs as $dir) {
8080
if ('' === $dir) {

InputStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function write(mixed $input)
5050
return;
5151
}
5252
if ($this->isClosed()) {
53-
throw new RuntimeException(sprintf('"%s" is closed.', static::class));
53+
throw new RuntimeException(\sprintf('"%s" is closed.', static::class));
5454
}
5555
$this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
5656
}

PhpProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(string $script, ?string $cwd = null, ?array $env = n
5252

5353
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
5454
{
55-
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
55+
throw new LogicException(\sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
5656
}
5757

5858
/**

PhpSubprocess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(array $command, ?string $cwd = null, ?array $env = n
7575

7676
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
7777
{
78-
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
78+
throw new LogicException(\sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
7979
}
8080

8181
public function start(?callable $callback = null, array $env = []): void

Pipes/AbstractPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function write(): ?array
101101
} elseif (!isset($this->inputBuffer[0])) {
102102
if (!\is_string($input)) {
103103
if (!\is_scalar($input)) {
104-
throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
104+
throw new InvalidArgumentException(\sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
105105
}
106106
$input = (string) $input;
107107
}

Pipes/WindowsPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(mixed $input, bool $haveReadSupport)
5353
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
5454
for ($i = 0;; ++$i) {
5555
foreach ($pipes as $pipe => $name) {
56-
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
56+
$file = \sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
5757

5858
if (!$h = fopen($file.'.lock', 'w')) {
5959
if (file_exists($file.'.lock')) {

Process.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public function start(?callable $callback = null, array $env = [])
340340
}
341341

342342
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));
344344
}
345345

346346
$process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
@@ -1197,7 +1197,7 @@ public function setOptions(array $options)
11971197
foreach ($options as $key => $value) {
11981198
if (!\in_array($key, $existingOptions)) {
11991199
$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)));
12011201
}
12021202
$this->options[$key] = $value;
12031203
}
@@ -1453,10 +1453,10 @@ private function doSignal(int $signal, bool $throwException): bool
14531453
}
14541454

14551455
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);
14571457
if ($exitCode && $this->isRunning()) {
14581458
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)));
14601460
}
14611461

14621462
return false;
@@ -1466,12 +1466,12 @@ private function doSignal(int $signal, bool $throwException): bool
14661466
$ok = @proc_terminate($this->process, $signal);
14671467
} elseif (\function_exists('posix_kill')) {
14681468
$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)) {
14701470
$ok = false === fgets($pipes[2]);
14711471
}
14721472
if (!$ok) {
14731473
if ($throwException) {
1474-
throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
1474+
throw new RuntimeException(\sprintf('Error while sending signal "%s".', $signal));
14751475
}
14761476

14771477
return false;
@@ -1528,7 +1528,7 @@ function ($m) use (&$env, $uid) {
15281528

15291529
if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) {
15301530
// Escape according to CommandLineToArgvW rules
1531-
$comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec) .'"';
1531+
$comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec).'"';
15321532
}
15331533

15341534
$cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
@@ -1547,7 +1547,7 @@ function ($m) use (&$env, $uid) {
15471547
private function requireProcessIsStarted(string $functionName): void
15481548
{
15491549
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));
15511551
}
15521552
}
15531553

@@ -1559,7 +1559,7 @@ private function requireProcessIsStarted(string $functionName): void
15591559
private function requireProcessIsTerminated(string $functionName): void
15601560
{
15611561
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));
15631563
}
15641564
}
15651565

@@ -1589,7 +1589,7 @@ private function replacePlaceholders(string $commandline, array $env): string
15891589
{
15901590
return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
15911591
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);
15931593
}
15941594

15951595
return $this->escapeArgument($env[$matches[1]]);

0 commit comments

Comments
 (0)