Skip to content

Commit 0cb0ed7

Browse files
committed
minor #4892 CombineNestedDirnameFixer - Add space after comma (julienfalque)
This PR was merged into the 2.15 branch. Discussion ---------- CombineNestedDirnameFixer - Add space after comma Ref: #3475 (comment). Commits ------- afa4ca8 CombineNestedDirnameFixer - Add space after comma
2 parents adc54c1 + afa4ca8 commit 0cb0ed7

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private function combineDirnames(Tokens $tokens, array $dirnameInfoArray)
225225
$prev = $tokens->getPrevMeaningfulToken($outerDirnameInfo['end']);
226226
$items = [];
227227
if (!$tokens[$prev]->equals(',')) {
228-
$items[] = new Token(',');
228+
$items = [new Token(','), new Token([T_WHITESPACE, ' '])];
229229
}
230230
$items[] = $levelsToken;
231231
$tokens->insertAt($outerDirnameInfo['end'], $items);

tests/Fixer/FunctionNotation/CombineNestedDirnameFixerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ public function provideFixCases()
4848
'<?php dirname($path, 3);',
4949
],
5050
[
51-
'<?php dirname($path,2);',
51+
'<?php dirname($path, 2);',
5252
'<?php dirname(dirname($path));',
5353
],
5454
[
55-
'<?php dirname /* a */ ( /* b */ /* c */ $path /* d */,2);',
55+
'<?php dirname /* a */ ( /* b */ /* c */ $path /* d */, 2);',
5656
'<?php dirname /* a */ ( /* b */ dirname( /* c */ $path) /* d */);',
5757
],
5858
[
59-
'<?php dirname($path,3);',
59+
'<?php dirname($path, 3);',
6060
'<?php dirname(\dirname(dirname($path)));',
6161
],
6262
[
63-
'<?php dirname($path,4);',
63+
'<?php dirname($path, 4);',
6464
'<?php dirname(dirname($path, 3));',
6565
],
6666
[
@@ -72,7 +72,7 @@ public function provideFixCases()
7272
'<?php dirname(dirname($path, 2), 3);',
7373
],
7474
[
75-
'<?php dirname($path,5);',
75+
'<?php dirname($path, 5);',
7676
'<?php dirname(dirname(dirname($path), 3));',
7777
],
7878
[
@@ -88,11 +88,11 @@ public function provideFixCases()
8888
'<?php foo\dirname(dirname($path));',
8989
],
9090
[
91-
'<?php dirname(foo(dirname($path,2)),2);',
91+
'<?php dirname(foo(dirname($path, 2)), 2);',
9292
'<?php dirname(dirname(foo(dirname(dirname($path)))));',
9393
],
9494
[
95-
'<?php new dirname(dirname($path,2));',
95+
'<?php new dirname(dirname($path, 2));',
9696
'<?php new dirname(dirname(dirname($path)));',
9797
],
9898
];
@@ -122,7 +122,7 @@ public function provideFix73Cases()
122122
{
123123
return [
124124
[
125-
'<?php dirname($path,3);',
125+
'<?php dirname($path, 3);',
126126
'<?php dirname(dirname(dirname($path, ), ));',
127127
],
128128
[

tests/Fixtures/Integration/misc/combine_nested_dirname,no_trailing_whitespace.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Integration of fixers: combine_nested_dirname,no_trailing_whitespace.
77
--EXPECT--
88
<?php
99
dirname($path
10-
,3);
10+
, 3);
1111

1212
--INPUT--
1313
<?php

tests/Fixtures/Integration/misc/combine_nested_dirname,no_whitespace_in_blank_line.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Integration of fixers: combine_nested_dirname,no_whitespace_in_blank_line.
88
<?php
99
dirname(
1010
$path
11-
,2);
11+
, 2);
1212

1313
--INPUT--
1414
<?php

tests/Fixtures/Integration/priority/combine_nested_dirname,no_spaces_inside_parenthesis.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Integration of fixers: combine_nested_dirname,no_spaces_inside_parenthesis.
66
{"php": 70000}
77
--EXPECT--
88
<?php
9-
dirname ($path ,2);
9+
dirname ($path , 2);
1010

1111
--INPUT--
1212
<?php

tests/Fixtures/Integration/priority/dir_constant,combine_nested_dirname.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Integration of fixers: dir_constant,combine_nested_dirname.
66
{"php": 70000}
77
--EXPECT--
88
<?php
9-
dirname(__DIR__,2);
9+
dirname(__DIR__, 2);
1010

1111
--INPUT--
1212
<?php

0 commit comments

Comments
 (0)