Skip to content

Commit

Permalink
The error message is now reported on the correct token (ref #3028)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Oct 30, 2020
1 parent d9b6b38 commit 9ff2b30
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Set the "minimumVisibility" sniff property to "public" to ignore both private and protected methods
-- The default remains at "private", so all methods are checked
-- Thanks to Vincent Langlet for the patch
- The PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket error message is now reported on the closing parenthesis token
-- Previously, the error was being reported on the function keyword, leading to confusing line numbers in the error report
</notes>
<contents>
<dir name="/">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function processSingleLineCall(File $phpcsFile, $stackPtr, $openBracket,
$requiredSpacesBeforeClose,
$spaceBeforeClose,
];
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceBeforeCloseBracket', $data);
$fix = $phpcsFile->addFixableError($error, $closer, 'SpaceBeforeCloseBracket', $data);
if ($fix === true) {
$padding = str_repeat(' ', $requiredSpacesBeforeClose);

Expand Down
25 changes: 12 additions & 13 deletions src/Standards/PSR2/Tests/Methods/FunctionCallSignatureUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@ public function getErrorList()
103 => 1,
111 => 1,
117 => 4,
121 => 1,
125 => 1,
129 => 1,
133 => 1,
138 => 1,
146 => 1,
150 => 1,
154 => 1,
158 => 1,
162 => 1,
167 => 1,
172 => 1,
123 => 1,
127 => 1,
131 => 1,
136 => 1,
143 => 1,
148 => 1,
152 => 1,
156 => 1,
160 => 1,
165 => 1,
170 => 1,
175 => 1,
178 => 1,
178 => 2,
186 => 1,
187 => 1,
194 => 3,
Expand Down

0 comments on commit 9ff2b30

Please sign in to comment.