NoAliasLanguageConstructCallFixerTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer>
  20. */
  21. final class NoAliasLanguageConstructCallFixerTest extends AbstractFixerTestCase
  22. {
  23. /**
  24. * @dataProvider provideFixCases
  25. */
  26. public function testFix(string $expected, ?string $input = null): void
  27. {
  28. $this->doTest($expected, $input);
  29. }
  30. /**
  31. * @return iterable<array{0: string, 1?: string}>
  32. */
  33. public static function provideFixCases(): iterable
  34. {
  35. yield [
  36. '<?php exit;',
  37. '<?php die;',
  38. ];
  39. yield [
  40. '<?php exit ("foo");',
  41. '<?php die ("foo");',
  42. ];
  43. yield [
  44. '<?php exit (1); EXIT(1);',
  45. '<?php DIE (1); EXIT(1);',
  46. ];
  47. yield [
  48. '<?php
  49. echo "die";
  50. // die;
  51. /* die(1); */
  52. echo $die;
  53. echo $die(1);
  54. echo $$die;
  55. ',
  56. ];
  57. }
  58. }