NoAliasLanguageConstructCallFixerTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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\Alias;
  13. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  14. /**
  15. * @internal
  16. *
  17. * @covers \PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer
  18. */
  19. final class NoAliasLanguageConstructCallFixerTest 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. public static function provideFixCases(): iterable
  29. {
  30. return [
  31. [
  32. '<?php exit;',
  33. '<?php die;',
  34. ],
  35. [
  36. '<?php exit ("foo");',
  37. '<?php die ("foo");',
  38. ],
  39. [
  40. '<?php exit (1); EXIT(1);',
  41. '<?php DIE (1); EXIT(1);',
  42. ],
  43. [
  44. '<?php
  45. echo "die";
  46. // die;
  47. /* die(1); */
  48. echo $die;
  49. echo $die(1);
  50. echo $$die;
  51. ',
  52. ],
  53. ];
  54. }
  55. }