* 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 Jonathan Gruber * * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocParamOrderFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocParamOrderFixer> */ final class PhpdocParamOrderFixerTest extends AbstractFixerTestCase { public function testNoChanges(): void { $expected = <<<'EOT' doTest($expected); } public function testNoChangesMultiple(): void { $expected = <<<'EOT' doTest($expected); } public function testOnlyParamsUntyped(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testOnlyParamsUntypedMixed(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testOnlyParamsTyped(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testOnlyParamsUndocumented(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testOnlyParamsSuperfluousAnnotation(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testOnlyParamsSuperfluousAnnotations(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsUntyped(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsTyped(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsDescription(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsMultilineDescription(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testComplexTypes(): void { $expected = <<<'EOT' |string $c * @param array $d * @param ?Foo $e * @param \Closure(( $b is Bar ? bool : int)): $this $f */ public function m($a, $b, $c, $d, $e, $f) {} } EOT; $input = <<<'EOT' |string $c * @param Foo|Bar $b * @param array $d * @param ?Foo $e * @param \Closure(( $b is Bar ? bool : int)): $this $f * @param Foo[]|\Bar\Baz $a */ public function m($a, $b, $c, $d, $e, $f) {} } EOT; $this->doTest($expected, $input); } public function testVariousMethodDeclarations(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsWithOtherAnnotationsInBetween(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testParamsBlankLines(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testNestedPhpdoc(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testMultiNestedPhpdoc(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testMultipleNestedPhpdoc(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testNonMatchingParamName(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testPlainFunction(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testCommentsInSignature(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testClosure(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testArrowFunction(): void { $expected = <<<'EOT' null; EOT; $input = <<<'EOT' null; EOT; $this->doTest($expected, $input); } public function testInterface(): void { $expected = <<<'EOT' doTest($expected, $input); } public function testPhp7ParamTypes(): void { $expected = <<<'EOT' doTest($expected, $input); } }