* 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\Phpdoc; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Gert de Pagter * * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocLineSpanFixer */ final class PhpdocLineSpanFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $config = []): void { $this->fixer->configure($config); $this->doTest($expected, $input); } public function provideFixCases(): array { return [ 'It does not change doc blocks if not needed' => [ ' [ ' [ ' 'single', 'const' => 'single', 'method' => 'single', ], ], 'It does change complicated doc blocks to single if configured to do so' => [ ' 'single', ], ], 'It does not changes doc blocks from single if configured to do so' => [ ' 'single', 'const' => 'single', 'method' => 'single', ], ], 'It can be configured to change certain elements to single line' => [ ' 'single', ], ], 'It wont change a doc block to single line if it has multiple useful lines' => [ ' 'single', ], ], 'It updates doc blocks correctly, even with more indentation' => [ ' 'single', ], ], 'It can convert empty doc blocks' => [ ' 'single', ], ], 'It can update doc blocks of static properties' => [ ' [ ' [ 'fixer->configure($config); $this->doTest($expected, $input); } public function provideFix71Cases() { return [ 'It can handle constants with visibility' => [ ' 'single', ], ], ]; } /** * @requires PHP 7.4 * @dataProvider provideFixPhp74Cases * * @param string $input */ public function testFixPhp74(string $expected, string $input = null, array $config = []): void { $this->fixer->configure($config); $this->doTest($expected, $input); } public function provideFixPhp74Cases() { return [ 'It can handle properties with type declaration' => [ ' 'single', ], ], 'It can handle properties with array type declaration' => [ ' 'single', ], ], ]; } }