* 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\EmptyLoopBodyFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ControlStructure\EmptyLoopBodyFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\ControlStructure\EmptyLoopBodyFixer */ final class EmptyLoopBodyFixerTest extends AbstractFixerTestCase { /** * @param _AutogeneratedInputConfiguration $config * * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $config = []): void { if ([] === $config) { $this->doTest($expected, $input); $this->fixer->configure(['style' => 'braces']); if (null === $input) { $this->doTest($expected, $input); } else { $this->doTest($input, $expected); } } else { $this->fixer->configure($config); $this->doTest($expected, $input); } } public static function provideFixCases(): iterable { yield 'simple "while"' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' 'semicolon'], ]; yield 'empty "foreach" with comment' => [ 'add($f); }', ]; } }