* 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 Adam Marczuk * * @internal * * @covers \PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer */ final class WhitespaceAfterCommaInArrayFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public function provideFixCases(): array { return [ //old style array [ ' function( $x ,$y) { return [$x , $y]; }, $y ];', ' function( $x ,$y) { return [$x ,$y]; },$y ];', ], // associative array (old) [ ' $a , "b" => "b", 3=>$this->foo(), "d" => 30 );', ' $a , "b" => "b",3=>$this->foo(), "d" => 30 );', ], // associative array (short) [ ' $a , "b"=>"b", 3 => $this->foo(), "d" =>30];', ' $a , "b"=>"b",3 => $this->foo(), "d" =>30];', ], // nested arrays [ ' $a, "b" => "b", 3=> [5, 6, 7] , "d" => array(1, 2, 3 , 4)];', ' $a, "b" => "b",3=> [5,6, 7] , "d" => array(1, 2,3 ,4)];', ], // multi line array [ '$a, "b"=> "b", 3 => $this->foo(), "d" => 30];', ], // multi line array [ 'doTest($expected, $input); } public function provideFixPhp74Cases(): array { return [ [ '