PhpdocNoAccessFixerTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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\Phpdoc;
  13. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  14. /**
  15. * @author Graham Campbell <hello@gjcampbell.co.uk>
  16. *
  17. * @internal
  18. *
  19. * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocNoAccessFixer
  20. *
  21. * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocNoAccessFixer>
  22. */
  23. final class PhpdocNoAccessFixerTest extends AbstractFixerTestCase
  24. {
  25. /**
  26. * @dataProvider provideFixCases
  27. */
  28. public function testFix(string $expected, ?string $input = null): void
  29. {
  30. $this->doTest($expected, $input);
  31. }
  32. /**
  33. * @return iterable<array{0: string, 1?: string}>
  34. */
  35. public static function provideFixCases(): iterable
  36. {
  37. yield 'access' => [
  38. <<<'PHP'
  39. <?php
  40. /**
  41. */
  42. PHP,
  43. <<<'PHP'
  44. <?php
  45. /**
  46. * @access public
  47. */
  48. PHP,
  49. ];
  50. yield 'many' => [
  51. <<<'PHP'
  52. <?php
  53. /**
  54. * Hello!
  55. * @notaccess bar
  56. */
  57. PHP,
  58. <<<'PHP'
  59. <?php
  60. /**
  61. * Hello!
  62. * @access private
  63. * @notaccess bar
  64. * @access foo
  65. */
  66. PHP,
  67. ];
  68. yield 'do nothing' => [
  69. <<<'PHP'
  70. <?php
  71. /**
  72. * @var access
  73. */
  74. PHP,
  75. ];
  76. }
  77. }