@@ -16,6 +16,5 @@ |
||
16 | 16 | * |
17 | 17 | * @author Johannes M. Schmitt <[email protected]> |
18 | 18 | */ |
19 | -class RuntimeException extends \RuntimeException implements ExceptionInterface |
|
20 | -{ |
|
19 | +class RuntimeException extends \RuntimeException implements ExceptionInterface { |
|
21 | 20 | } |
@@ -18,12 +18,10 @@ |
||
18 | 18 | * |
19 | 19 | * @author Sullivan Senechal <[email protected]> |
20 | 20 | */ |
21 | -final class ProcessSignaledException extends RuntimeException |
|
22 | -{ |
|
21 | +final class ProcessSignaledException extends RuntimeException { |
|
23 | 22 | private $process; |
24 | 23 | |
25 | - public function __construct(Process $process) |
|
26 | - { |
|
24 | + public function __construct(Process $process) { |
|
27 | 25 | $this->process = $process; |
28 | 26 | |
29 | 27 | parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal())); |
@@ -16,6 +16,5 @@ |
||
16 | 16 | * |
17 | 17 | * @author Romain Neutron <[email protected]> |
18 | 18 | */ |
19 | -class LogicException extends \LogicException implements ExceptionInterface |
|
20 | -{ |
|
19 | +class LogicException extends \LogicException implements ExceptionInterface { |
|
21 | 20 | } |
@@ -20,13 +20,11 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @author Martin Hasoň <[email protected]> |
22 | 22 | */ |
23 | -class ProcessUtils |
|
24 | -{ |
|
23 | +class ProcessUtils { |
|
25 | 24 | /** |
26 | 25 | * This class should not be instantiated. |
27 | 26 | */ |
28 | - private function __construct() |
|
29 | - { |
|
27 | + private function __construct() { |
|
30 | 28 | } |
31 | 29 | |
32 | 30 | /** |
@@ -39,8 +37,7 @@ discard block |
||
39 | 37 | * |
40 | 38 | * @throws InvalidArgumentException In case the input is not valid |
41 | 39 | */ |
42 | - public static function validateInput(string $caller, $input) |
|
43 | - { |
|
40 | + public static function validateInput(string $caller, $input) { |
|
44 | 41 | if (null !== $input) { |
45 | 42 | if (\is_resource($input)) { |
46 | 43 | return $input; |
@@ -18,8 +18,7 @@ |
||
18 | 18 | * |
19 | 19 | * @internal |
20 | 20 | */ |
21 | -interface PipesInterface |
|
22 | -{ |
|
21 | +interface PipesInterface { |
|
23 | 22 | public const CHUNK_SIZE = 16384; |
24 | 23 | |
25 | 24 | /** |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @internal |
20 | 20 | */ |
21 | -abstract class AbstractPipes implements PipesInterface |
|
22 | -{ |
|
21 | +abstract class AbstractPipes implements PipesInterface { |
|
23 | 22 | public $pipes = []; |
24 | 23 | |
25 | 24 | private $inputBuffer = ''; |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | /** |
31 | 30 | * @param resource|string|int|float|bool|\Iterator|null $input |
32 | 31 | */ |
33 | - public function __construct($input) |
|
34 | - { |
|
32 | + public function __construct($input) { |
|
35 | 33 | if (\is_resource($input) || $input instanceof \Iterator) { |
36 | 34 | $this->input = $input; |
37 | 35 | } elseif (\is_string($input)) { |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | /** |
45 | 43 | * {@inheritdoc} |
46 | 44 | */ |
47 | - public function close() |
|
48 | - { |
|
45 | + public function close() { |
|
49 | 46 | foreach ($this->pipes as $pipe) { |
50 | 47 | fclose($pipe); |
51 | 48 | } |
@@ -67,8 +64,7 @@ discard block |
||
67 | 64 | /** |
68 | 65 | * Unblocks streams. |
69 | 66 | */ |
70 | - protected function unblock() |
|
71 | - { |
|
67 | + protected function unblock() { |
|
72 | 68 | if (!$this->blocked) { |
73 | 69 | return; |
74 | 70 | } |
@@ -171,8 +167,7 @@ discard block |
||
171 | 167 | /** |
172 | 168 | * @internal |
173 | 169 | */ |
174 | - public function handleError(int $type, string $msg) |
|
175 | - { |
|
170 | + public function handleError(int $type, string $msg) { |
|
176 | 171 | $this->lastError = $msg; |
177 | 172 | } |
178 | 173 | } |
@@ -20,14 +20,12 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @internal |
22 | 22 | */ |
23 | -class UnixPipes extends AbstractPipes |
|
24 | -{ |
|
23 | +class UnixPipes extends AbstractPipes { |
|
25 | 24 | private $ttyMode; |
26 | 25 | private $ptyMode; |
27 | 26 | private $haveReadSupport; |
28 | 27 | |
29 | - public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport) |
|
30 | - { |
|
28 | + public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport) { |
|
31 | 29 | $this->ttyMode = $ttyMode; |
32 | 30 | $this->ptyMode = $ptyMode; |
33 | 31 | $this->haveReadSupport = $haveReadSupport; |
@@ -38,18 +36,15 @@ discard block |
||
38 | 36 | /** |
39 | 37 | * @return array |
40 | 38 | */ |
41 | - public function __sleep() |
|
42 | - { |
|
39 | + public function __sleep() { |
|
43 | 40 | throw new \BadMethodCallException('Cannot serialize '.__CLASS__); |
44 | 41 | } |
45 | 42 | |
46 | - public function __wakeup() |
|
47 | - { |
|
43 | + public function __wakeup() { |
|
48 | 44 | throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
49 | 45 | } |
50 | 46 | |
51 | - public function __destruct() |
|
52 | - { |
|
47 | + public function __destruct() { |
|
53 | 48 | $this->close(); |
54 | 49 | } |
55 | 50 |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @internal |
26 | 26 | */ |
27 | -class WindowsPipes extends AbstractPipes |
|
28 | -{ |
|
27 | +class WindowsPipes extends AbstractPipes { |
|
29 | 28 | private $files = []; |
30 | 29 | private $fileHandles = []; |
31 | 30 | private $lockHandles = []; |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | ]; |
36 | 35 | private $haveReadSupport; |
37 | 36 | |
38 | - public function __construct($input, bool $haveReadSupport) |
|
39 | - { |
|
37 | + public function __construct($input, bool $haveReadSupport) { |
|
40 | 38 | $this->haveReadSupport = $haveReadSupport; |
41 | 39 | |
42 | 40 | if ($this->haveReadSupport) { |
@@ -91,18 +89,15 @@ discard block |
||
91 | 89 | /** |
92 | 90 | * @return array |
93 | 91 | */ |
94 | - public function __sleep() |
|
95 | - { |
|
92 | + public function __sleep() { |
|
96 | 93 | throw new \BadMethodCallException('Cannot serialize '.__CLASS__); |
97 | 94 | } |
98 | 95 | |
99 | - public function __wakeup() |
|
100 | - { |
|
96 | + public function __wakeup() { |
|
101 | 97 | throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
102 | 98 | } |
103 | 99 | |
104 | - public function __destruct() |
|
105 | - { |
|
100 | + public function __destruct() { |
|
106 | 101 | $this->close(); |
107 | 102 | } |
108 | 103 | |
@@ -193,8 +188,7 @@ discard block |
||
193 | 188 | /** |
194 | 189 | * {@inheritdoc} |
195 | 190 | */ |
196 | - public function close() |
|
197 | - { |
|
191 | + public function close() { |
|
198 | 192 | parent::close(); |
199 | 193 | foreach ($this->fileHandles as $type => $handle) { |
200 | 194 | ftruncate($handle, 0); |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @author Fabien Potencier <[email protected]> |
25 | 25 | */ |
26 | -class PhpProcess extends Process |
|
27 | -{ |
|
26 | +class PhpProcess extends Process { |
|
28 | 27 | /** |
29 | 28 | * @param string $script The PHP script to run (as a string) |
30 | 29 | * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * @param int $timeout The timeout in seconds |
33 | 32 | * @param array|null $php Path to the PHP binary to use with any additional arguments |
34 | 33 | */ |
35 | - public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null) |
|
36 | - { |
|
34 | + public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null) { |
|
37 | 35 | if (null === $php) { |
38 | 36 | $executableFinder = new PhpExecutableFinder(); |
39 | 37 | $php = $executableFinder->find(false); |
@@ -53,16 +51,14 @@ discard block |
||
53 | 51 | /** |
54 | 52 | * {@inheritdoc} |
55 | 53 | */ |
56 | - public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) |
|
57 | - { |
|
54 | + public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) { |
|
58 | 55 | throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class)); |
59 | 56 | } |
60 | 57 | |
61 | 58 | /** |
62 | 59 | * {@inheritdoc} |
63 | 60 | */ |
64 | - public function start(callable $callback = null, array $env = []) |
|
65 | - { |
|
61 | + public function start(callable $callback = null, array $env = []) { |
|
66 | 62 | if (null === $this->getCommandLine()) { |
67 | 63 | throw new RuntimeException('Unable to find the PHP executable.'); |
68 | 64 | } |