ClassKeywordFixerTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Tests\Fixer\LanguageConstruct;
  13. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  14. /**
  15. * @internal
  16. *
  17. * @covers \PhpCsFixer\Fixer\LanguageConstruct\ClassKeywordFixer
  18. */
  19. final class ClassKeywordFixerTest extends AbstractFixerTestCase
  20. {
  21. /**
  22. * @dataProvider provideFixCases
  23. */
  24. public function testFix(string $expected, ?string $input = null): void
  25. {
  26. $this->doTest($expected, $input);
  27. }
  28. /**
  29. * @return iterable<array{0: string, 1?: ?string}>
  30. */
  31. public static function provideFixCases(): iterable
  32. {
  33. yield [
  34. '<?php
  35. echo \PhpCsFixer\\FixerDefinition\\CodeSample::class;
  36. echo \'Foo\Bar\Baz\';
  37. echo \PhpCsFixer\\FixerDefinition\\CodeSample::class;
  38. echo \PhpCsFixer\\FixerDefinition\\CodeSample::class;
  39. ',
  40. '<?php
  41. echo "PhpCsFixer\\FixerDefinition\\CodeSample";
  42. echo \'Foo\Bar\Baz\';
  43. echo \'PhpCsFixer\FixerDefinition\CodeSample\';
  44. echo \'\PhpCsFixer\FixerDefinition\CodeSample\';
  45. ',
  46. ];
  47. }
  48. }