* 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\ArrayNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Jared Henderson * * @internal * * @covers \PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer */ final class TrimArraySpacesFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFixCases(): iterable { return [ [ ' "bar");', ' "bar" );', ], [ ' "bar"];', ' "bar" ];', ], [ 'method(), Foo::doSomething());', 'method(), Foo::doSomething() );', ], [ 'method(), Foo::doSomething()];', 'method(), Foo::doSomething() ];', ], [ "method( \$a,\$b, \$c,\t\t \$d ), Foo::doSomething()];", "method( \$a,\$b, \$c,\t\t \$d ), Foo::doSomething() ];", ], [ "method( \$a,\$b, \$c,\t\t \$d ), \$bar -> doSomething( ['baz']));", "method( \$a,\$b, \$c,\t\t \$d ), \$bar -> doSomething( [ 'baz']) );", ], [ ' 'bar', 'baz' => \$x[ 4], 'hash' => array(1,2,3)));", " 'bar', 'baz' => \$x[ 4], 'hash' => array(1,2,3 )) );", ], // crazy nested garbage pile #2 [ ' 2, // comment ); ', ], [ ' 1, "b" => 2); }', ' 1, "b" => 2 ); }', ], [ ' 1, "b" => 2]; }', ' 1, "b" => 2 ]; }', ], ]; } }