FixerFileProcessedEvent.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. namespace PhpCsFixer;
  13. use Symfony\Contracts\EventDispatcher\Event;
  14. /**
  15. * Event that is fired when file was processed by Fixer.
  16. *
  17. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  18. *
  19. * @internal
  20. */
  21. final class FixerFileProcessedEvent extends Event
  22. {
  23. /**
  24. * Event name.
  25. */
  26. public const NAME = 'fixer.file_processed';
  27. public const STATUS_INVALID = 1;
  28. public const STATUS_SKIPPED = 2;
  29. public const STATUS_NO_CHANGES = 3;
  30. public const STATUS_FIXED = 4;
  31. public const STATUS_EXCEPTION = 5;
  32. public const STATUS_LINT = 6;
  33. private int $status;
  34. private ?string $fileRelativePath;
  35. private ?string $fileHash;
  36. public function __construct(int $status, ?string $fileRelativePath = null, ?string $fileHash = null)
  37. {
  38. $this->status = $status;
  39. $this->fileRelativePath = $fileRelativePath;
  40. $this->fileHash = $fileHash;
  41. }
  42. public function getStatus(): int
  43. {
  44. return $this->status;
  45. }
  46. public function getFileRelativePath(): ?string
  47. {
  48. return $this->fileRelativePath;
  49. }
  50. public function getFileHash(): ?string
  51. {
  52. return $this->fileHash;
  53. }
  54. }