Skip to content

Commit 89ac295

Browse files
committed
Add missing return types
1 parent 39cbf15 commit 89ac295

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

Exception/ProcessFailedException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function __construct(Process $process)
4747
$this->process = $process;
4848
}
4949

50+
/**
51+
* @return Process
52+
*/
5053
public function getProcess()
5154
{
5255
return $this->process;

Exception/ProcessTimedOutException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function __construct(Process $process, int $timeoutType)
3838
));
3939
}
4040

41+
/**
42+
* @return Process
43+
*/
4144
public function getProcess()
4245
{
4346
return $this->process;
@@ -59,7 +62,7 @@ public function isIdleTimeout()
5962
return self::TYPE_IDLE === $this->timeoutType;
6063
}
6164

62-
public function getExceededTimeout()
65+
public function getExceededTimeout(): ?float
6366
{
6467
return match ($this->timeoutType) {
6568
self::TYPE_GENERAL => $this->process->getTimeout(),

Process.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public function mustRun(callable $callback = null, array $env = []): static
285285
* @param callable|null $callback A PHP callback to run whenever there is some
286286
* output available on STDOUT or STDERR
287287
*
288+
* @return void
289+
*
288290
* @throws RuntimeException When process can't be launched
289291
* @throws RuntimeException When process is already running
290292
* @throws LogicException In case a callback is provided and output has been disabled
@@ -1140,6 +1142,8 @@ public function setInput(mixed $input): static
11401142
* In case you run a background process (with the start method), you should
11411143
* trigger this method regularly to ensure the process timeout
11421144
*
1145+
* @return void
1146+
*
11431147
* @throws ProcessTimedOutException In case the timeout was reached
11441148
*/
11451149
public function checkTimeout()
@@ -1180,6 +1184,8 @@ public function getStartTime(): float
11801184
*
11811185
* Enabling the "create_new_console" option allows a subprocess to continue
11821186
* to run after the main process exited, on both Windows and *nix
1187+
*
1188+
* @return void
11831189
*/
11841190
public function setOptions(array $options)
11851191
{
@@ -1275,6 +1281,8 @@ protected function buildCallback(callable $callback = null): \Closure
12751281
* Updates the status of the process, reads pipes.
12761282
*
12771283
* @param bool $blocking Whether to use a blocking read call
1284+
*
1285+
* @return void
12781286
*/
12791287
protected function updateStatus(bool $blocking)
12801288
{
@@ -1323,7 +1331,7 @@ protected function isSigchildEnabled(): bool
13231331
*
13241332
* @throws LogicException in case output has been disabled or process is not started
13251333
*/
1326-
private function readPipesForOutput(string $caller, bool $blocking = false)
1334+
private function readPipesForOutput(string $caller, bool $blocking = false): void
13271335
{
13281336
if ($this->outputDisabled) {
13291337
throw new LogicException('Output has been disabled.');
@@ -1358,7 +1366,7 @@ private function validateTimeout(?float $timeout): ?float
13581366
* @param bool $blocking Whether to use blocking calls or not
13591367
* @param bool $close Whether to close file handles or not
13601368
*/
1361-
private function readPipes(bool $blocking, bool $close)
1369+
private function readPipes(bool $blocking, bool $close): void
13621370
{
13631371
$result = $this->processPipes->readAndWrite($blocking, $close);
13641372

@@ -1407,7 +1415,7 @@ private function close(): int
14071415
/**
14081416
* Resets data related to the latest run of the process.
14091417
*/
1410-
private function resetProcessData()
1418+
private function resetProcessData(): void
14111419
{
14121420
$this->starttime = null;
14131421
$this->callback = null;
@@ -1528,7 +1536,7 @@ function ($m) use (&$env, $uid) {
15281536
*
15291537
* @throws LogicException if the process has not run
15301538
*/
1531-
private function requireProcessIsStarted(string $functionName)
1539+
private function requireProcessIsStarted(string $functionName): void
15321540
{
15331541
if (!$this->isStarted()) {
15341542
throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
@@ -1540,7 +1548,7 @@ private function requireProcessIsStarted(string $functionName)
15401548
*
15411549
* @throws LogicException if the process is not yet terminated
15421550
*/
1543-
private function requireProcessIsTerminated(string $functionName)
1551+
private function requireProcessIsTerminated(string $functionName): void
15441552
{
15451553
if (!$this->isTerminated()) {
15461554
throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));

0 commit comments

Comments
 (0)