Skip to content

Commit f584e6d

Browse files
committed
Merge branch '2.14' into 2.15
2 parents 1ce01cb + b69fb30 commit f584e6d

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private function ensureFunctionFullyMultiline(Tokens $tokens, $startFunctionInde
390390
continue;
391391
}
392392

393-
if ($token->equals(',')) {
393+
if ($token->equals(',') && !$tokens[$tokens->getNextMeaningfulToken($index)]->equals(')')) {
394394
$this->fixNewline($tokens, $index, $indentation);
395395
}
396396
}

tests/Fixer/FunctionNotation/MethodArgumentSpaceFixerTest.php

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,26 @@ public function provideFixCases()
192192
['keep_multiple_spaces_after_comma' => true],
193193
],
194194
'skip array' => [
195-
'<?php array(10 , 20 ,30);',
195+
'<?php array(10 , 20 ,30); $foo = [ 10,50 , 60 ] ?>',
196196
],
197197
'list call with trailing comma' => [
198198
'<?php list($path, $mode, ) = foo();',
199199
'<?php list($path, $mode,) = foo();',
200200
],
201+
'list call with trailing comma multi line' => [
202+
'<?php
203+
list(
204+
$a,
205+
$b,
206+
) = foo();
207+
',
208+
'<?php
209+
list(
210+
$a ,
211+
$b ,
212+
) = foo();
213+
',
214+
],
201215
'inline comments with spaces' => [
202216
'<?php xyz($a=10, /*comment1*/ $b=2000, /*comment2*/ $c=30);',
203217
'<?php xyz($a=10, /*comment1*/ $b=2000,/*comment2*/ $c=30);',
@@ -969,4 +983,47 @@ functionCall(
969983

970984
$this->doTest($expected, $input);
971985
}
986+
987+
/**
988+
* @param string $expected
989+
* @param null|string $input
990+
* @param null|array $config
991+
*
992+
* @requires PHP 7.3
993+
* @dataProvider provideFix73Cases
994+
*/
995+
public function testFix73($expected, $input = null, array $config = null)
996+
{
997+
if (null !== $config) {
998+
$this->fixer->configure($config);
999+
}
1000+
1001+
$this->doTest($expected, $input);
1002+
}
1003+
1004+
public function provideFix73Cases()
1005+
{
1006+
return [
1007+
[
1008+
'<?php
1009+
functionCall(
1010+
1,
1011+
2,
1012+
3,
1013+
);',
1014+
'<?php
1015+
functionCall(
1016+
1, 2,
1017+
3,
1018+
);',
1019+
[
1020+
'on_multiline' => 'ensure_fully_multiline',
1021+
],
1022+
],
1023+
[
1024+
'<?php foo(1, 2, 3, );',
1025+
'<?php foo(1,2,3,);',
1026+
],
1027+
];
1028+
}
9721029
}

0 commit comments

Comments
 (0)