Skip to content

Commit 71f7468

Browse files
committed
Improved the error message when Squiz.ControlStructures.ControlSignature detects a newline after the closing parenthesis
1 parent 6f42a49 commit 71f7468

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
3636
- NOWDOC tokens are now considered conditions, just as HEREDOC tokens are
3737
-- This makes it easier to find the start and end of a NOWDOC from any token within it
3838
-- Thanks to Michał Bundyra for the patch
39+
- Improved the error message when Squiz.ControlStructures.ControlSignature detects a newline after the closing parenthesis
3940
- Fixed bug #1465 : Generic.WhiteSpace.ScopeIndent reports incorrect errors when indenting double arrows in short arrays
4041
- Fixed bug #1478 : Indentation in fallthrough CASE that contains a closure
4142
- Fixed bug #1497 : Fatal error if composer prepend-autoloader is set to false

src/Standards/Squiz/Sniffs/ControlStructures/ControlSignatureSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ public function process(File $phpcsFile, $stackPtr)
106106

107107
if ($content !== ' ') {
108108
$error = 'Expected 1 space after closing parenthesis; found %s';
109-
if (trim($content) === '') {
109+
if ($tokens[$closer]['line'] !== $tokens[$opener]['line']) {
110+
$found = 'newline';
111+
} else if (trim($content) === '') {
110112
$found = strlen($content);
111113
} else {
112114
$found = '"'.str_replace($phpcsFile->eolChar, '\n', $content).'"';

0 commit comments

Comments
 (0)