Skip to content

Commit 9ff2b30

Browse files
committed
The error message is now reported on the correct token (ref #3028)
1 parent d9b6b38 commit 9ff2b30

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
3636
-- Set the "minimumVisibility" sniff property to "public" to ignore both private and protected methods
3737
-- The default remains at "private", so all methods are checked
3838
-- Thanks to Vincent Langlet for the patch
39+
- The PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket error message is now reported on the closing parenthesis token
40+
-- Previously, the error was being reported on the function keyword, leading to confusing line numbers in the error report
3941
</notes>
4042
<contents>
4143
<dir name="/">

src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function processSingleLineCall(File $phpcsFile, $stackPtr, $openBracket,
272272
$requiredSpacesBeforeClose,
273273
$spaceBeforeClose,
274274
];
275-
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceBeforeCloseBracket', $data);
275+
$fix = $phpcsFile->addFixableError($error, $closer, 'SpaceBeforeCloseBracket', $data);
276276
if ($fix === true) {
277277
$padding = str_repeat(' ', $requiredSpacesBeforeClose);
278278

src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ public function getErrorList()
3535
103 => 1,
3636
111 => 1,
3737
117 => 4,
38-
121 => 1,
39-
125 => 1,
40-
129 => 1,
41-
133 => 1,
42-
138 => 1,
43-
146 => 1,
44-
150 => 1,
45-
154 => 1,
46-
158 => 1,
47-
162 => 1,
48-
167 => 1,
49-
172 => 1,
38+
123 => 1,
39+
127 => 1,
40+
131 => 1,
41+
136 => 1,
42+
143 => 1,
43+
148 => 1,
44+
152 => 1,
45+
156 => 1,
46+
160 => 1,
47+
165 => 1,
48+
170 => 1,
5049
175 => 1,
51-
178 => 1,
50+
178 => 2,
5251
186 => 1,
5352
187 => 1,
5453
194 => 3,

0 commit comments

Comments
 (0)