class ConsoleErrorEvent
Allows to handle throwables thrown while running a command.
@author Wouter de Jong <wouter@wouterj.nl>
Hierarchy
- class \Symfony\Contracts\EventDispatcher\Event implements \Psr\EventDispatcher\StoppableEventInterface
- class \Symfony\Component\Console\Event\ConsoleEvent extends \Symfony\Contracts\EventDispatcher\Event
- class \Symfony\Component\Console\Event\ConsoleErrorEvent extends \Symfony\Component\Console\Event\ConsoleEvent
- class \Symfony\Component\Console\Event\ConsoleEvent extends \Symfony\Contracts\EventDispatcher\Event
Expanded class hierarchy of ConsoleErrorEvent
3 files declare their use of ConsoleErrorEvent
- Application.php in vendor/
symfony/ console/ Application.php - ConsoleEvents.php in vendor/
symfony/ console/ ConsoleEvents.php - ErrorListener.php in vendor/
symfony/ console/ EventListener/ ErrorListener.php
File
-
vendor/
symfony/ console/ Event/ ConsoleErrorEvent.php, line 23
Namespace
Symfony\Component\Console\EventView source
final class ConsoleErrorEvent extends ConsoleEvent {
private int $exitCode;
public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null) {
parent::__construct($command, $input, $output);
}
public function getError() : \Throwable {
return $this->error;
}
public function setError(\Throwable $error) : void {
$this->error = $error;
}
public function setExitCode(int $exitCode) : void {
$this->exitCode = $exitCode;
$r = new \ReflectionProperty($this->error, 'code');
$r->setValue($this->error, $this->exitCode);
}
public function getExitCode() : int {
return $this->exitCode ?? (\is_int($this->error
->getCode()) && 0 !== $this->error
->getCode() ? $this->error
->getCode() : 1);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
ConsoleErrorEvent::$exitCode | private | property | |||
ConsoleErrorEvent::getError | public | function | |||
ConsoleErrorEvent::getExitCode | public | function | |||
ConsoleErrorEvent::setError | public | function | |||
ConsoleErrorEvent::setExitCode | public | function | |||
ConsoleErrorEvent::__construct | public | function | Overrides ConsoleEvent::__construct | ||
ConsoleEvent::getCommand | public | function | Gets the command that is executed. | ||
ConsoleEvent::getInput | public | function | Gets the input instance. | ||
ConsoleEvent::getOutput | public | function | Gets the output instance. | ||
Event::$propagationStopped | private | property | |||
Event::isPropagationStopped | public | function | Is propagation stopped? | Overrides StoppableEventInterface::isPropagationStopped | |
Event::stopPropagation | public | function | Stops the propagation of the event to further event listeners. | 1 |