NoAliasLanguageConstructCallFixerTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. yield [
  31. '<?php exit;',
  32. '<?php die;',
  33. ];
  34. yield [
  35. '<?php exit ("foo");',
  36. '<?php die ("foo");',
  37. ];
  38. yield [
  39. '<?php exit (1); EXIT(1);',
  40. '<?php DIE (1); EXIT(1);',
  41. ];
  42. yield [
  43. '<?php
  44. echo "die";
  45. // die;
  46. /* die(1); */
  47. echo $die;
  48. echo $die(1);
  49. echo $$die;
  50. ',
  51. ];
  52. }
  53. }