Skip to content

Commit 3837f44

Browse files
committed
refactor: remove support for array-based process invocation
1 parent c2cb281 commit 3837f44

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

packages/process/src/GenericProcessExecutor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
final class GenericProcessExecutor implements ProcessExecutor
99
{
10-
public function start(array|string|PendingProcess $command): InvokedSystemProcess
10+
public function start(string|PendingProcess $command): InvokedSystemProcess
1111
{
1212
$pending = $this->createPendingProcess($command);
1313
$command = $this->createSymfonyProcess($pending);
@@ -16,7 +16,7 @@ public function start(array|string|PendingProcess $command): InvokedSystemProces
1616
return new InvokedSystemProcess($command);
1717
}
1818

19-
public function run(array|string|PendingProcess $command): ProcessResult
19+
public function run(string|PendingProcess $command): ProcessResult
2020
{
2121
return $this->start($command)->wait();
2222
}

packages/process/src/ProcessExecutor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ interface ProcessExecutor
77
/**
88
* Runs the given process.
99
*
10-
* @param string[]|string|PendingProcess $command
10+
* @param string|PendingProcess $command
1111
*/
12-
public function run(array|string|PendingProcess $command): ProcessResult;
12+
public function run(string|PendingProcess $command): ProcessResult;
1313

1414
/**
1515
* Invokes the given process asynchronously.
1616
*
17-
* @param string[]|string|PendingProcess $command
17+
* @param string|PendingProcess $command
1818
*/
19-
public function start(array|string|PendingProcess $command): InvokedProcess;
19+
public function start(string|PendingProcess $command): InvokedProcess;
2020

2121
/**
2222
* Returns a pool of processes, which can be executed.

packages/process/src/Testing/RestrictedProcessExecutor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
final class RestrictedProcessExecutor implements ProcessExecutor
1313
{
14-
public function run(array|string|PendingProcess $command): ProcessResult
14+
public function run(string|PendingProcess $command): ProcessResult
1515
{
1616
throw ProcessExecutionWasForbidden::forPendingProcess($command);
1717
}
1818

19-
public function start(array|string|PendingProcess $command): InvokedSystemProcess
19+
public function start(string|PendingProcess $command): InvokedSystemProcess
2020
{
2121
throw ProcessExecutionWasForbidden::forPendingProcess($command);
2222
}

packages/process/src/Testing/TestingProcessExecutor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
public bool $allowRunningActualProcesses = false,
2929
) {}
3030

31-
public function run(array|string|PendingProcess $command): ProcessResult
31+
public function run(string|PendingProcess $command): ProcessResult
3232
{
3333
if ($result = $this->findMockedProcess($command)) {
3434
return $this->recordExecution($command, $result);
@@ -41,7 +41,7 @@ public function run(array|string|PendingProcess $command): ProcessResult
4141
return $this->recordExecution($command, $this->start($command)->wait());
4242
}
4343

44-
public function start(array|string|PendingProcess $command): InvokedProcess
44+
public function start(string|PendingProcess $command): InvokedProcess
4545
{
4646
if ($processResult = $this->findInvokedProcessDescription($command)) {
4747
$this->recordExecution($command, $process = new InvokedTestingProcess($processResult));
@@ -69,7 +69,7 @@ public function concurrently(iterable $pool): ProcessPoolResults
6969
return $this->pool($pool)->start()->wait();
7070
}
7171

72-
private function findMockedProcess(array|string|PendingProcess $command): ?ProcessResult
72+
private function findMockedProcess(string|PendingProcess $command): ?ProcessResult
7373
{
7474
$process = $this->createPendingProcess($command);
7575

@@ -92,7 +92,7 @@ private function findMockedProcess(array|string|PendingProcess $command): ?Proce
9292
return null;
9393
}
9494

95-
private function findInvokedProcessDescription(array|string|PendingProcess $command): ?InvokedProcessDescription
95+
private function findInvokedProcessDescription(string|PendingProcess $command): ?InvokedProcessDescription
9696
{
9797
$process = $this->createPendingProcess($command);
9898

@@ -111,7 +111,7 @@ private function findInvokedProcessDescription(array|string|PendingProcess $comm
111111
return null;
112112
}
113113

114-
private function recordExecution(array|string|PendingProcess $command, InvokedProcess|ProcessResult $result): ProcessResult
114+
private function recordExecution(string|PendingProcess $command, InvokedProcess|ProcessResult $result): ProcessResult
115115
{
116116
$process = $this->createPendingProcess($command);
117117
$result = match (true) {

tests/Integration/Process/ProcessExecutorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
namespace Tests\Tempest\Integration\Process;
44

5-
use PHPUnit\Framework\ExpectationFailedException;
65
use Tempest\Process\InvokedProcess;
76
use Tempest\Process\ProcessExecutor;
87
use Tempest\Process\ProcessResult;
9-
use Tempest\Process\Testing\InvokedProcessDescription;
108
use Tests\Tempest\Integration\FrameworkIntegrationTestCase;
119

1210
final class ProcessExecutorTest extends FrameworkIntegrationTestCase

0 commit comments

Comments
 (0)