Skip to content

Commit ab6caa0

Browse files
committed
Changelog + minor error message change for #2234
1 parent aed6c39 commit ab6caa0

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

package.xml

+14
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
2626
</stability>
2727
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
2828
<notes>
29+
- The Generic.Formatting.NoSpaceAfterCast sniff has been deprecated and will be removed in version 4
30+
-- The functionality of this sniff is now available in the Generic.Formatting.SpaceAfterCast sniff
31+
--- Include the Generic.Formatting.SpaceAfterCast sniff and set the "spacing" property to "0"
32+
-- As soon as possible, replace all instances of the old sniff code with the new sniff code and property setting
33+
--- The existing sniff will continue to work until version 4 has been released
34+
2935
- Rule include patterns in a ruleset.xml file are now evaluated as OR instead of AND
3036
-- Previously, a file had to match every include pattern and no exclude patterns to be included
3137
-- Now, a file must match at least one include pattern and no exclude patterns to be included
@@ -110,6 +116,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
110116
-- Thanks to Chris Wilkinson for the patch
111117
- Generic.PHP.CharacterBeforePHPOpeningTag now ignores a BOM at the start of the file
112118
-- Thanks to Chris Wilkinson for the patch
119+
- Generic.Formatting.SpaceAfterCast now has a setting to specify how many spaces are required after a type cast
120+
-- Default remains 1
121+
-- Override the "spacing" setting in a ruleset.xml file to change
122+
-- Thanks to Juliette Reinders Folmer for the patch
123+
- Generic.Formatting.SpaceAfterCast now has a setting to ignore newline characters after a type cast
124+
-- Default remains FALSE, so newlines are not allowed
125+
-- Override the "ignoreNewlines" setting in a ruleset.xml file to change
126+
-- Thanks to Juliette Reinders Folmer for the patch
113127
- Generic.Formatting.SpaceAfterNot now has a setting to specify how many spaces are required after a NOT operator
114128
-- Default remains 1
115129
-- Override the "spacing" setting in a ruleset.xml file to change

src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php

+3-12
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,10 @@ public function process(File $phpcsFile, $stackPtr)
8181
return;
8282
}
8383

84-
$maybePlural = '';
85-
if ($this->spacing !== 1) {
86-
$maybePlural = 's';
87-
}
88-
8984
$nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
9085
if ($nextNonEmpty !== $nextNonWhitespace) {
91-
$error = 'Expected %s space%s after cast statement; comment found';
92-
$data = [
93-
$this->spacing,
94-
$maybePlural,
95-
];
86+
$error = 'Expected %s space(s) after cast statement; comment found';
87+
$data = [$this->spacing];
9688
$phpcsFile->addError($error, $stackPtr, 'CommentFound', $data);
9789

9890
if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
@@ -117,10 +109,9 @@ public function process(File $phpcsFile, $stackPtr)
117109
return;
118110
}
119111

120-
$error = 'Expected %s space%s after cast statement; %s found';
112+
$error = 'Expected %s space(s) after cast statement; %s found';
121113
$data = [
122114
$this->spacing,
123-
$maybePlural,
124115
$found,
125116
];
126117

0 commit comments

Comments
 (0)