/* Decoded by unphp.net */ * 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\Basic; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\Basic\BracesPositionFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Basic\BracesPositionFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\Basic\BracesPositionFixer */ final class BracesPositionFixerTest 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); } public static function provideFixCases(): iterable { yield 'if (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'else (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'elseif (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'else if (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'for (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'foreach (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'while (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'do while (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'switch (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'try catch finally (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'class (default)' => [ ' [ ' 'same_line'], ]; yield 'function (default)' => [ ' [ ' 'same_line'], ]; yield 'anonymous function (default)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'with blank lines inside braces' => [ ' [ ' [ ' 'same_line'], ]; yield 'next line with multiline signature' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with newline before closing parenthesis' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with newline in signature but not before closing parenthesis' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'anonymous class (same line)' => [ ' [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with multiline signature and return type' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with multiline signature and return type (nullable)' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with multiline signature and return type (array)' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with multiline signature and return type (class name)' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with newline before closing parenthesis and return type' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with newline before closing parenthesis and callable type' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'next line with newline in signature but not before closing parenthesis and return type' => [ ' 'next_line_unless_newline_at_signature_end'], ]; yield 'multiple elseifs' => [ ' [ ' [ ' [ ' [ 'doTest($expected, $input); } public static function provideFix80Cases(): iterable { yield 'function (multiline + union return)' => [ ' [ ' [ 'doTest($expected, $input); } public static function provideFix81Cases(): iterable { yield 'function (multiline + intersection return)' => [ 'doTest($expected, $input); } public static function provideFix82Cases(): iterable { yield 'function (multiline + DNF return)' => [ '