* Dariusz RumiƄski * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Tests\Fixer\ControlStructure; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer */ final class EmptyLoopConditionFixerTest extends AbstractFixerTestCase { /** * @param _AutogeneratedInputConfiguration $config * * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $config = []): void { $this->fixer->configure($config); $this->doTest($expected, $input); } public static function provideFixCases(): iterable { yield 'from `for` to `while`' => [ ' [ ' [ ' 'for'], ]; yield 'from `do while` to `for`' => [ ' 'for'], ]; yield 'multiple `do while` to `while`' => [ ' [ ' [ ' [ ' 'for'], ]; // space cases yield 'lot of space' => [ ' [ ' 'for'], ]; yield 'not empty `for` condition' => [ ' [ ' [ ' 'for'], ]; } }