* 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\AttributeNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Raffaele Carelle * * @internal * * @covers \PhpCsFixer\Fixer\AttributeNotation\GeneralAttributeRemoveFixer * * @requires PHP 8.0 * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\AttributeNotation\GeneralAttributeRemoveFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\AttributeNotation\GeneralAttributeRemoveFixer */ final class GeneralAttributeRemoveFixerTest extends AbstractFixerTestCase { /** * @param _AutogeneratedInputConfiguration $configuration * * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $configuration = []): void { $this->fixer->configure($configuration); $this->doTest($expected, $input); } /** * @return iterable}> */ public static function provideFixCases(): iterable { yield 'Explicit in namespace' => [ ' ['A\B\Bar', 'Test\A\B\Quux'], ], ]; yield 'Explicit in global namespace' => [ ' ['\A\B\Qux', '\Corge', 'A\B\Bar'], ], ]; yield 'Multiple namespaces' => [ ' ['A\B\Bar', 'Test\AB\Baz', 'A\B\Quux', 'A\B\Baz', 'A\B\Foo', '\AB\Baz'], ], ]; yield 'With whitespaces' => [ ' ['A\B\Foo', 'Test\A\B\Quux', 'A\B\Baz'], ], ]; yield 'With docblock' => [ ' ['Test\Corge', '\A\B\Qux'], ], ]; yield 'With comments' => [ ' ['Test\A\B\Quux', 'A\B\Bar', 'Test\Corge', 'A\B\Baz', 'A\B\Foo', '\A\B\Qux'], ], ]; yield 'With multiple attributes' => [ ' ['A\B\Foo', '\A\B\Qux'], ], ]; yield 'Multiline with no trailing comma' => [ ' ['A\B\Foo', '\A\B\Qux', 'A\B\Baz', 'Test\A\B\Quux', 'A\B\Bar', 'Test\Corge'], ], ]; yield 'Multiple with comments' => [ ' ['A\B\Foo', 'Test\Corge'], ], ]; } }