vendor/symfony/messenger/EventListener/DispatchPcntlSignalListener.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Messenger\EventListener;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\Messenger\Event\WorkerRunningEvent;
  13. /**
  14. * @author Tobias Schultze <http://tobion.de>
  15. */
  16. class DispatchPcntlSignalListener implements EventSubscriberInterface
  17. {
  18. public function onWorkerRunning(): void
  19. {
  20. pcntl_signal_dispatch();
  21. }
  22. public static function getSubscribedEvents()
  23. {
  24. if (!\function_exists('pcntl_signal_dispatch')) {
  25. return [];
  26. }
  27. return [
  28. WorkerRunningEvent::class => ['onWorkerRunning', 100],
  29. ];
  30. }
  31. }