Skip to content

Commit 6aa9556

Browse files
committed
style: cs fix [skip ci][ci skip]
1 parent e0a5ff5 commit 6aa9556

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/Helper/Shell.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Shell
5151

5252
const DEFAULT_STDOUT_WIN = ['pipe', 'w'];
5353
const DEFAULT_STDOUT_NIX = ['pipe', 'w'];
54-
54+
5555
const DEFAULT_STDERR_WIN = ['pipe', 'w'];
5656
const DEFAULT_STDERR_NIX = ['pipe', 'w'];
5757

@@ -119,6 +119,7 @@ protected function prepareDescriptors(?array $stdin = null, ?array $stdout = nul
119119
if (!$stderr) {
120120
$stderr = $win ? self::DEFAULT_STDERR_WIN : self::DEFAULT_STDERR_NIX;
121121
}
122+
122123
return [
123124
self::STDIN_DESCRIPTOR_KEY => $stdin,
124125
self::STDOUT_DESCRIPTOR_KEY => $stdout,
@@ -132,6 +133,7 @@ protected function isWindows(): bool
132133
if (defined('PHP_OS')) {
133134
return 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); // May be 'WINNT' or 'WIN32' or 'Windows'
134135
}
136+
135137
return '\\' === DIRECTORY_SEPARATOR; // Fallback - Less reliable (Windows 7...)
136138
}
137139

@@ -208,16 +210,17 @@ public function setOptions(
208210

209211
return $this;
210212
}
211-
213+
212214
/**
213215
* execute
214216
* Execute the command with optional stdin, stdout and stderr which override the defaults
215-
* If async is set to true, the process will be executed in the background
216-
*
217-
* @param bool $async - default false
218-
* @param ?array $stdin - default null (loads default descriptor)
219-
* @param ?array $stdout - default null (loads default descriptor)
220-
* @param ?array $stderr - default null (loads default descriptor)
217+
* If async is set to true, the process will be executed in the background.
218+
*
219+
* @param bool $async - default false
220+
* @param ?array $stdin - default null (loads default descriptor)
221+
* @param ?array $stdout - default null (loads default descriptor)
222+
* @param ?array $stderr - default null (loads default descriptor)
223+
*
221224
* @return self
222225
*/
223226
public function execute(bool $async = false, ?array $stdin = null, ?array $stdout = null, ?array $stderr = null): self
@@ -264,6 +267,7 @@ private function setOutputStreamNonBlocking(): bool
264267
if (!is_resource($this->pipes[self::STDOUT_DESCRIPTOR_KEY])) {
265268
return false;
266269
}
270+
267271
return stream_set_blocking($this->pipes[self::STDOUT_DESCRIPTOR_KEY], false);
268272
}
269273

@@ -278,6 +282,7 @@ public function getOutput(): string
278282
if (!is_resource($this->pipes[self::STDOUT_DESCRIPTOR_KEY])) {
279283
return '';
280284
}
285+
281286
return stream_get_contents($this->pipes[self::STDOUT_DESCRIPTOR_KEY]);
282287
}
283288

@@ -286,6 +291,7 @@ public function getErrorOutput(): string
286291
if (!is_resource($this->pipes[self::STDERR_DESCRIPTOR_KEY])) {
287292
return '';
288293
}
294+
289295
return stream_get_contents($this->pipes[self::STDERR_DESCRIPTOR_KEY]);
290296
}
291297

tests/Helper/ShellTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function test_get_output()
2424

2525
$shell->execute();
2626

27-
$this->assertSame("hello", trim($shell->getOutput())); // trim to remove trailing newline which is OS dependent
27+
$this->assertSame('hello', trim($shell->getOutput())); // trim to remove trailing newline which is OS dependent
2828
$this->assertSame(0, $shell->getExitCode());
2929
}
3030

tests/Output/ColorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ public function test_colors()
5353
$c = new Color;
5454

5555
// We use PHP_EOL here because it is platform dependent and eol tag will be replaced by it.
56-
$this->assertSame(PHP_EOL."abc".PHP_EOL, $c->colors('<eol>abc</eol>'));
56+
$this->assertSame(PHP_EOL . 'abc' . PHP_EOL, $c->colors('<eol>abc</eol>'));
5757
$this->assertSame("\033[0;31mRed\033[0m", $c->colors('<red>Red</end>'));
58-
$this->assertSame("\033[1;31mBoldRed".PHP_EOL."\033[0m", $c->colors('<boldRed>BoldRed<eol/></end>'));
59-
$this->assertSame("\033[0;36;42mBgGreenCyan\033[0m".PHP_EOL, $c->colors('<bgGreenCyan>BgGreenCyan</end><eol>'));
58+
$this->assertSame("\033[1;31mBoldRed" . PHP_EOL . "\033[0m", $c->colors('<boldRed>BoldRed<eol/></end>'));
59+
$this->assertSame("\033[0;36;42mBgGreenCyan\033[0m" . PHP_EOL, $c->colors('<bgGreenCyan>BgGreenCyan</end><eol>'));
6060
$this->assertSame(
61-
"\033[0;31mRed\033[0m".PHP_EOL."Normal".PHP_EOL."\033[1;37mBOLD\033[0m",
61+
"\033[0;31mRed\033[0m" . PHP_EOL . 'Normal' . PHP_EOL . "\033[1;37mBOLD\033[0m",
6262
$c->colors("<red>Red</end>\r\nNormal\n<bold>BOLD</end>")
6363
);
6464
}

0 commit comments

Comments
 (0)