composer update
This commit is contained in:
+4
-1
@@ -12,7 +12,10 @@
|
||||
namespace Symfony\Component\Console\Event;
|
||||
|
||||
/**
|
||||
* Allows to do things before the command is executed, like skipping the command or changing the input.
|
||||
* Allows to do things before the command is executed, like skipping the command or executing code before the command is
|
||||
* going to be executed.
|
||||
*
|
||||
* Changing the input arguments will have no effect.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ final class ConsoleErrorEvent extends ConsoleEvent
|
||||
private \Throwable $error;
|
||||
private int $exitCode;
|
||||
|
||||
public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
|
||||
public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null)
|
||||
{
|
||||
parent::__construct($command, $input, $output);
|
||||
|
||||
|
||||
+22
-1
@@ -21,15 +21,36 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
final class ConsoleSignalEvent extends ConsoleEvent
|
||||
{
|
||||
private int $handlingSignal;
|
||||
private int|false $exitCode;
|
||||
|
||||
public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
|
||||
public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal, int|false $exitCode = 0)
|
||||
{
|
||||
parent::__construct($command, $input, $output);
|
||||
$this->handlingSignal = $handlingSignal;
|
||||
$this->exitCode = $exitCode;
|
||||
}
|
||||
|
||||
public function getHandlingSignal(): int
|
||||
{
|
||||
return $this->handlingSignal;
|
||||
}
|
||||
|
||||
public function setExitCode(int $exitCode): void
|
||||
{
|
||||
if ($exitCode < 0 || $exitCode > 255) {
|
||||
throw new \InvalidArgumentException('Exit code must be between 0 and 255.');
|
||||
}
|
||||
|
||||
$this->exitCode = $exitCode;
|
||||
}
|
||||
|
||||
public function abortExit(): void
|
||||
{
|
||||
$this->exitCode = false;
|
||||
}
|
||||
|
||||
public function getExitCode(): int|false
|
||||
{
|
||||
return $this->exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-6
@@ -19,16 +19,18 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
* Allows to manipulate the exit code of a command after its execution.
|
||||
*
|
||||
* @author Francesco Levorato <git@flevour.net>
|
||||
* @author Jules Pietri <jules@heahprod.com>
|
||||
*/
|
||||
final class ConsoleTerminateEvent extends ConsoleEvent
|
||||
{
|
||||
private int $exitCode;
|
||||
|
||||
public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
|
||||
{
|
||||
public function __construct(
|
||||
Command $command,
|
||||
InputInterface $input,
|
||||
OutputInterface $output,
|
||||
private int $exitCode,
|
||||
private readonly ?int $interruptingSignal = null,
|
||||
) {
|
||||
parent::__construct($command, $input, $output);
|
||||
|
||||
$this->setExitCode($exitCode);
|
||||
}
|
||||
|
||||
public function setExitCode(int $exitCode): void
|
||||
@@ -40,4 +42,9 @@ final class ConsoleTerminateEvent extends ConsoleEvent
|
||||
{
|
||||
return $this->exitCode;
|
||||
}
|
||||
|
||||
public function getInterruptingSignal(): ?int
|
||||
{
|
||||
return $this->interruptingSignal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user