PhpdocAnnotationWithoutDotFixerTest.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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\Fixer\Phpdoc;
  12. use PhpCsFixer\Test\AbstractFixerTestCase;
  13. /**
  14. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer
  19. */
  20. final class PhpdocAnnotationWithoutDotFixerTest extends AbstractFixerTestCase
  21. {
  22. /**
  23. * @param string $expected
  24. * @param null|string $input
  25. *
  26. * @dataProvider provideFixCases
  27. */
  28. public function testFix($expected, $input = null)
  29. {
  30. $this->doTest($expected, $input);
  31. }
  32. public function provideFixCases()
  33. {
  34. return array(
  35. array(
  36. '<?php
  37. /**
  38. * Summary.
  39. *
  40. * Description.
  41. *
  42. * @param string|null $str some string
  43. * @param string $genrb Optional. The path to the "genrb" executable
  44. * @param string $ellipsis1 Ellipsis is this: ...
  45. * @param string $ellipsis2 Ellipsis is this: 。。。
  46. * @param string $ellipsis3 Ellipsis is this: …
  47. * @param bool $isStr Is it a string?
  48. * @param int $int Some multiline
  49. * description. With many dots.
  50. *
  51. * @return array result array
  52. *
  53. * @SomeCustomAnnotation This is important sentence that must not be modified.
  54. */',
  55. '<?php
  56. /**
  57. * Summary.
  58. *
  59. * Description.
  60. *
  61. * @param string|null $str Some string.
  62. * @param string $genrb Optional. The path to the "genrb" executable
  63. * @param string $ellipsis1 Ellipsis is this: ...
  64. * @param string $ellipsis2 Ellipsis is this: 。。。
  65. * @param string $ellipsis3 Ellipsis is this: …
  66. * @param bool $isStr Is it a string?
  67. * @param int $int Some multiline
  68. * description. With many dots.
  69. *
  70. * @return array Result array。
  71. *
  72. * @SomeCustomAnnotation This is important sentence that must not be modified.
  73. */',
  74. ),
  75. array(
  76. // invalid char inside line won't crash the fixer
  77. '<?php
  78. /**
  79. * @var string This: '.chr(174).' is an odd character.
  80. * @var string This: '.chr(174).' is an odd character 2nd time。
  81. */',
  82. ),
  83. array(
  84. '<?php
  85. /**
  86. * @deprecated since version 2. Use emergency() which is PSR-3 compatible.
  87. */',
  88. ),
  89. array(
  90. '<?php
  91. /**
  92. * @internal This method is public to be usable as callback. It should not
  93. * be used in user code.
  94. */',
  95. ),
  96. array(
  97. '<?php
  98. /**
  99. * @deprecated this is
  100. * deprecated
  101. */',
  102. '<?php
  103. /**
  104. * @deprecated This is
  105. * deprecated.
  106. */',
  107. ),
  108. array(
  109. '<?php
  110. /**
  111. * @return bool|null returns `true` if the class has a single-column ID
  112. * and Returns `false` otherwise
  113. */',
  114. '<?php
  115. /**
  116. * @return bool|null Returns `true` if the class has a single-column ID
  117. * and Returns `false` otherwise.
  118. */',
  119. ),
  120. );
  121. }
  122. }