You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

3 years ago
  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\Console;
  11. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  12. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  13. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  14. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  15. /**
  16. * Contains all events dispatched by an Application.
  17. *
  18. * @author Francesco Levorato <git@flevour.net>
  19. */
  20. final class ConsoleEvents
  21. {
  22. /**
  23. * The COMMAND event allows you to attach listeners before any command is
  24. * executed by the console. It also allows you to modify the command, input and output
  25. * before they are handed to the command.
  26. *
  27. * @Event("Symfony\Component\Console\Event\ConsoleCommandEvent")
  28. */
  29. public const COMMAND = 'console.command';
  30. /**
  31. * The SIGNAL event allows you to perform some actions
  32. * after the command execution was interrupted.
  33. *
  34. * @Event("Symfony\Component\Console\Event\ConsoleSignalEvent")
  35. */
  36. public const SIGNAL = 'console.signal';
  37. /**
  38. * The TERMINATE event allows you to attach listeners after a command is
  39. * executed by the console.
  40. *
  41. * @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent")
  42. */
  43. public const TERMINATE = 'console.terminate';
  44. /**
  45. * The ERROR event occurs when an uncaught exception or error appears.
  46. *
  47. * This event allows you to deal with the exception/error or
  48. * to modify the thrown exception.
  49. *
  50. * @Event("Symfony\Component\Console\Event\ConsoleErrorEvent")
  51. */
  52. public const ERROR = 'console.error';
  53. /**
  54. * Event aliases.
  55. *
  56. * These aliases can be consumed by RegisterListenersPass.
  57. */
  58. public const ALIASES = [
  59. ConsoleCommandEvent::class => self::COMMAND,
  60. ConsoleErrorEvent::class => self::ERROR,
  61. ConsoleSignalEvent::class => self::SIGNAL,
  62. ConsoleTerminateEvent::class => self::TERMINATE,
  63. ];
  64. }