handleSignal example

if ($this->dispatcher) {
                // We register application signals, so that we can dispatch the event                 foreach ($this->signalsToDispatchEvent as $signal) {
                    $event = new ConsoleSignalEvent($command$input$output$signal);

                    $this->signalRegistry->register($signalfunction D$signal) use ($event$command$commandSignals) {
                        $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
                        $exitCode = $event->getExitCode();

                        // If the command is signalable, we call the handleSignal() method                         if (\in_array($signal$commandSignals, true)) {
                            $exitCode = $command->handleSignal($signal$exitCode);
                            // BC layer for Symfony <= 5                             if (null === $exitCode) {
                                trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command));
                                $exitCode = 0;
                            }
                        }

                        if (false !== $exitCode) {
                            exit($exitCode);
                        }
                    });
                }
if ($this->dispatcher) {
                // We register application signals, so that we can dispatch the event                 foreach ($this->signalsToDispatchEvent as $signal) {
                    $event = new ConsoleSignalEvent($command$input$output$signal);

                    $this->signalRegistry->register($signalfunction D$signal) use ($event$command$commandSignals) {
                        $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
                        $exitCode = $event->getExitCode();

                        // If the command is signalable, we call the handleSignal() method                         if (\in_array($signal$commandSignals, true)) {
                            $exitCode = $command->handleSignal($signal$exitCode);
                            // BC layer for Symfony <= 5                             if (null === $exitCode) {
                                trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command));
                                $exitCode = 0;
                            }
                        }

                        if (false !== $exitCode) {
                            exit($exitCode);
                        }
                    });
                }
Home | Imprint | This part of the site doesn't use cookies.