ConfigurableFixerInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Fixer;
  13. use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException;
  14. use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
  15. /**
  16. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  17. */
  18. interface ConfigurableFixerInterface extends FixerInterface
  19. {
  20. /**
  21. * Set configuration.
  22. *
  23. * New configuration must override current one, not patch it.
  24. * Using empty array makes fixer to use default configuration
  25. * (or reset configuration from previously configured back to default one).
  26. *
  27. * Some fixers may have no configuration, then - simply don't implement this interface.
  28. * Other ones may have configuration that will change behavior of fixer,
  29. * eg `php_unit_strict` fixer allows to configure which methods should be fixed.
  30. * Finally, some fixers need configuration to work, eg `header_comment`.
  31. *
  32. * @param array<string, mixed> $configuration configuration depends on Fixer
  33. *
  34. * @throws InvalidFixerConfigurationException
  35. */
  36. public function configure(array $configuration): void;
  37. /**
  38. * Defines the available configuration options of the fixer.
  39. */
  40. public function getConfigurationDefinition(): FixerConfigurationResolverInterface;
  41. }