* 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; /** * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer */ final class PhpdocTypesOrderFixerTest extends AbstractFixerTestCase { /** * @param string $expected * @param null|string $input * * @dataProvider provideFixWithAlphaAlgorithmAndNullAlwaysFirstCases */ public function testFix($expected, $input = null) { $this->doTest($expected, $input); } /** * @param string $expected * @param null|string $input * * @dataProvider provideFixCases */ public function testFixWithNullFirst($expected, $input = null) { $this->fixer->configure([ 'sort_algorithm' => 'none', 'null_adjustment' => 'always_first', ]); $this->doTest($expected, $input); } public function provideFixCases() { return [ [ ' Foo */', '|null Foo */', ], [ '> Foo */', '>|null Foo */', ], [ ' */', ' */', ], [ ' */', ' */', ], [ '> */', '> */', ], [ ' */', ' */', ], [ '>>>> */', '>>>> */', ], [ 'fixer->configure([ 'sort_algorithm' => 'none', 'null_adjustment' => 'always_last', ]); $this->doTest($expected, $input); } public function provideFixWithNullLastCases() { return [ [ '|null Foo */', ' Foo */', ], [ '>|null Foo */', '> Foo */', ], [ ' */', ' */', ], [ ' */', ' */', ], [ '> */', '> */', ], [ ' */', ' */', ], [ '>>>> */', '>>>> */', ], [ 'fixer->configure([ 'sort_algorithm' => 'alpha', 'null_adjustment' => 'none', ]); $this->doTest($expected, $input); } public function provideFixWithAlphaAlgorithmCases() { return [ [ '|null Foo */', ' Foo */', ], [ '>|null Foo */', '> Foo */', ], [ ' */', ' */', ], [ ' */', ' */', ], [ '> */', '> */', ], [ ' */', ' */', ], [ '>>>> */', '>>>> */', ], [ 'fixer->configure([ 'sort_algorithm' => 'alpha', 'null_adjustment' => 'always_first', ]); $this->doTest($expected, $input); } public function provideFixWithAlphaAlgorithmAndNullAlwaysFirstCases() { return [ [ ' Foo */', ], [ '> Foo */', ], [ ' */', ' */', ], [ ' */', ' */', ], [ '> */', '> */', ], [ ' */', ' */', ], [ '>>>> */', '>>>> */', ], [ 'fixer->configure([ 'sort_algorithm' => 'alpha', 'null_adjustment' => 'always_last', ]); $this->doTest($expected, $input); } public function provideFixWithAlphaAlgorithmAndNullAlwaysLastCases() { return [ [ '|null Foo */', ' Foo */', ], [ '>|null Foo */', '> Foo */', ], [ ' */', ' */', ], [ ' */', ' */', ], [ '> */', '> */', ], [ ' */', ' */', ], [ '>>>> */', '>>>> */', ], [ '