DeprecatedFixer.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of PHP CS Fixer.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. namespace PhpCsFixer\Tests\Fixtures;
  12. use PhpCsFixer\AbstractFixer;
  13. use PhpCsFixer\Fixer\ConfigurableFixerInterface;
  14. use PhpCsFixer\Fixer\DeprecatedFixerInterface;
  15. use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
  16. use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
  17. use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
  18. use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
  19. use PhpCsFixer\Tokenizer\Tokens;
  20. final class DeprecatedFixer extends AbstractFixer implements DeprecatedFixerInterface, ConfigurableFixerInterface
  21. {
  22. public function getDefinition(): FixerDefinitionInterface
  23. {
  24. throw new \LogicException('Not implemented.');
  25. }
  26. public function isCandidate(Tokens $tokens): bool
  27. {
  28. throw new \LogicException('Not implemented.');
  29. }
  30. public function doSomethingWithCreateConfigDefinition(): FixerConfigurationResolver
  31. {
  32. return $this->createConfigurationDefinition();
  33. }
  34. public function getSuccessorsNames(): array
  35. {
  36. return ['testA', 'testB'];
  37. }
  38. public function getName(): string
  39. {
  40. return 'Vendor4/foo';
  41. }
  42. protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
  43. {
  44. }
  45. protected function createConfigurationDefinition(): FixerConfigurationResolverInterface
  46. {
  47. return new FixerConfigurationResolver([
  48. (new FixerOptionBuilder('foo', 'Foo.'))->getOption()
  49. ]);
  50. }
  51. }