Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d96479d

Browse filesBrowse files
committed
do not let context classes extend the message classes
1 parent 6c3d377 commit d96479d
Copy full SHA for d96479d

File tree

3 files changed

+13
-11
lines changed
Filter options

3 files changed

+13
-11
lines changed

‎src/Symfony/Component/Console/Messenger/RunCommandContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Messenger/RunCommandContext.php
+6-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
/**
1515
* @author Kevin Bond <kevinbond@gmail.com>
1616
*/
17-
final class RunCommandContext extends RunCommandMessage
17+
final class RunCommandContext
1818
{
19-
public function __construct(RunCommandMessage $message, public readonly int $exitCode, public readonly string $output)
20-
{
21-
parent::__construct($message->input, $message->throwOnFailure, $message->catchExceptions);
19+
public function __construct(
20+
public readonly RunCommandMessage $message,
21+
public readonly int $exitCode,
22+
public readonly string $output,
23+
) {
2224
}
2325
}

‎src/Symfony/Component/Process/Messenger/RunProcessContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Messenger/RunProcessContext.php
+5-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
/**
1717
* @author Kevin Bond <kevinbond@gmail.com>
1818
*/
19-
final class RunProcessContext extends RunProcessMessage
19+
final class RunProcessContext
2020
{
2121
public readonly ?int $exitCode;
2222
public readonly ?string $output;
2323
public readonly ?string $errorOutput;
2424

25-
public function __construct(RunProcessMessage $message, Process $process)
26-
{
27-
parent::__construct($message->command, $message->cwd, $message->env, $message->input, $message->timeout);
28-
25+
public function __construct(
26+
public readonly RunProcessMessage $message,
27+
Process $process,
28+
) {
2929
$this->exitCode = $process->getExitCode();
3030
$this->output = $process->isOutputDisabled() ? null : $process->getOutput();
3131
$this->errorOutput = $process->isOutputDisabled() ? null : $process->getErrorOutput();

‎src/Symfony/Component/Process/Tests/Messenger/RunProcessMessageHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/Messenger/RunProcessMessageHandlerTest.php
+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testRunSuccessfulProcess()
2222
{
2323
$context = (new RunProcessMessageHandler())(new RunProcessMessage(['ls'], cwd: __DIR__));
2424

25-
$this->assertSame(['ls'], $context->command);
25+
$this->assertSame(['ls'], $context->message->command);
2626
$this->assertSame(0, $context->exitCode);
2727
$this->assertStringContainsString(basename(__FILE__), $context->output);
2828
}
@@ -32,7 +32,7 @@ public function testRunFailedProcess()
3232
try {
3333
(new RunProcessMessageHandler())(new RunProcessMessage(['invalid']));
3434
} catch (RunProcessFailedException $e) {
35-
$this->assertSame(['invalid'], $e->context->command);
35+
$this->assertSame(['invalid'], $e->context->message->command);
3636
$this->assertSame('\\' === \DIRECTORY_SEPARATOR ? 1 : 127, $e->context->exitCode);
3737

3838
return;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.