diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7573980e..89a2418505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1651,7 +1651,7 @@ Additionally, thanks to [Alexander Turek][@derrabus] for consulting on the repo - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch - Squiz.WhiteSpace.SuperfluousWhitespace no longer throws errors for spacing between functions and properties in anon classes - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch -- Zend.Files.ClosingTag no longer adds a semi-colon during fixing of a file that only contains a comment +- Zend.Files.ClosingTag no longer adds a semicolon during fixing of a file that only contains a comment - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch - Zend.NamingConventions.ValidVariableName now supports variables inside anonymous classes correctly - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch diff --git a/src/Files/File.php b/src/Files/File.php index 4d6414251b..08c82a277e 100644 --- a/src/Files/File.php +++ b/src/Files/File.php @@ -2260,7 +2260,7 @@ public function getTokensAsString($start, $length, $origContent=false) * be returned. * @param bool $local If true, tokens outside the current statement * will not be checked. IE. checking will stop - * at the previous semi-colon found. + * at the previous semicolon found. * * @return int|false * @see findNext() @@ -2341,7 +2341,7 @@ public function findPrevious( * be returned. * @param bool $local If true, tokens outside the current statement * will not be checked. i.e., checking will stop - * at the next semi-colon found. + * at the next semicolon found. * * @return int|false * @see findPrevious() diff --git a/src/Standards/Generic/Docs/CodeAnalysis/EmptyPHPStatementStandard.xml b/src/Standards/Generic/Docs/CodeAnalysis/EmptyPHPStatementStandard.xml index 5652f657af..6b96c825aa 100644 --- a/src/Standards/Generic/Docs/CodeAnalysis/EmptyPHPStatementStandard.xml +++ b/src/Standards/Generic/Docs/CodeAnalysis/EmptyPHPStatementStandard.xml @@ -20,11 +20,11 @@ - + ; if (true) { @@ -32,7 +32,7 @@ if (true) { } ]]> - + ;;; if (true) { diff --git a/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php b/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php index 3ebfccc04d..4ecf630378 100644 --- a/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php +++ b/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php @@ -2,7 +2,7 @@ /** * Checks against empty PHP statements. * - * - Check against two semi-colons with no executable code in between. + * - Check against two semicolons with no executable code in between. * - Check against an empty PHP open - close tag combination. * * @author Juliette Reinders Folmer @@ -76,7 +76,7 @@ public function process(File $phpcsFile, $stackPtr) return; } - // Else, it's something like `if (foo) {};` and the semi-colon is not needed. + // Else, it's something like `if (foo) {};` and the semicolon is not needed. } if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { @@ -91,7 +91,7 @@ public function process(File $phpcsFile, $stackPtr) } $fix = $phpcsFile->addFixableWarning( - 'Empty PHP statement detected: superfluous semi-colon.', + 'Empty PHP statement detected: superfluous semicolon.', $stackPtr, 'SemicolonWithoutCodeDetected' ); @@ -101,7 +101,7 @@ public function process(File $phpcsFile, $stackPtr) if ($tokens[$prevNonEmpty]['code'] === T_OPEN_TAG || $tokens[$prevNonEmpty]['code'] === T_OPEN_TAG_WITH_ECHO ) { - // Check for superfluous whitespace after the semi-colon which will be + // Check for superfluous whitespace after the semicolon which will be // removed as the `" /> - + diff --git a/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php b/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php index 1882fd970a..39c69c8b02 100644 --- a/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php +++ b/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php @@ -152,10 +152,10 @@ public function process(File $phpcsFile, $stackPtr) } } while ($next !== false); - // Remove closing curly,semi-colon and any whitespace between last child and closing curly. + // Remove closing curly, semicolon and any whitespace between last child and closing curly. $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($closingCurly + 1), null, true); if ($next === false || $tokens[$next]['code'] !== T_SEMICOLON) { - // Parse error, forgotten semi-colon. + // Parse error, forgotten semicolon. $next = $closingCurly; } diff --git a/src/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php b/src/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php index d51431bfc1..9030468b8d 100644 --- a/src/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php +++ b/src/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php @@ -1,6 +1,6 @@ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) @@ -73,7 +73,7 @@ public function process(File $phpcsFile, $stackPtr) return; } - // There is a semi-colon, so now find the last token in the statement. + // There is a semicolon, so now find the last token in the statement. $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($endOfThisStatement - 1), null, true); $found = $tokens[($endOfThisStatement - 1)]['length']; if ($tokens[$prevNonEmpty]['line'] !== $tokens[$endOfThisStatement]['line']) { diff --git a/src/Standards/Squiz/Sniffs/Commenting/LongConditionClosingCommentSniff.php b/src/Standards/Squiz/Sniffs/Commenting/LongConditionClosingCommentSniff.php index 439fc38a81..7c06e42942 100644 --- a/src/Standards/Squiz/Sniffs/Commenting/LongConditionClosingCommentSniff.php +++ b/src/Standards/Squiz/Sniffs/Commenting/LongConditionClosingCommentSniff.php @@ -156,7 +156,7 @@ public function process(File $phpcsFile, $stackPtr) } if ($startCondition['code'] === T_MATCH) { - // Move the stackPtr to after the semi-colon/comma if there is one. + // Move the stackPtr to after the semicolon/comma if there is one. $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); if ($nextToken !== false && ($tokens[$nextToken]['code'] === T_SEMICOLON diff --git a/src/Standards/Squiz/Sniffs/Strings/EchoedStringsSniff.php b/src/Standards/Squiz/Sniffs/Strings/EchoedStringsSniff.php index c167d024c4..ec516a99a6 100644 --- a/src/Standards/Squiz/Sniffs/Strings/EchoedStringsSniff.php +++ b/src/Standards/Squiz/Sniffs/Strings/EchoedStringsSniff.php @@ -51,7 +51,7 @@ public function process(File $phpcsFile, $stackPtr) $end = $phpcsFile->findNext([T_SEMICOLON, T_CLOSE_TAG], $stackPtr, null, false); - // If the token before the semi-colon is not a closing parenthesis, then we are not concerned. + // If the token before the semicolon is not a closing parenthesis, then we are not concerned. $prev = $phpcsFile->findPrevious(T_WHITESPACE, ($end - 1), null, true); if ($tokens[$prev]['code'] !== T_CLOSE_PARENTHESIS) { $phpcsFile->recordMetric($stackPtr, 'Brackets around echoed strings', 'no'); diff --git a/src/Standards/Squiz/Sniffs/WhiteSpace/SemicolonSpacingSniff.php b/src/Standards/Squiz/Sniffs/WhiteSpace/SemicolonSpacingSniff.php index e10c5cee71..dbf719d20e 100644 --- a/src/Standards/Squiz/Sniffs/WhiteSpace/SemicolonSpacingSniff.php +++ b/src/Standards/Squiz/Sniffs/WhiteSpace/SemicolonSpacingSniff.php @@ -59,7 +59,7 @@ public function process(File $phpcsFile, $stackPtr) $nonSpace = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 2), null, true); - // Detect whether this is a semi-colon for a condition in a `for()` control structure. + // Detect whether this is a semicolon for a condition in a `for()` control structure. $forCondition = false; if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { $nestedParens = $tokens[$stackPtr]['nested_parenthesis']; diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc index e6d386f5c9..d10bd98008 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc @@ -111,7 +111,7 @@ for ( // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesAfterOpen 0 // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesBeforeClose 0 -// Test with semi-colon not belonging to for. +// Test with semicolon not belonging to for. for ($i = function() { return $this->i ; }; $i < function() { return $this->max; }; $i++) {} for ($i = function() { return $this->i; }; $i < function() { return $this->max; } ; $i++) {} diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc.fixed b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc.fixed index 61adc66302..85214c03e2 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc.fixed +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.inc.fixed @@ -77,7 +77,7 @@ for ( $i = 0; $i < 10; $i++ ) {} // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesAfterOpen 0 // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesBeforeClose 0 -// Test with semi-colon not belonging to for. +// Test with semicolon not belonging to for. for ($i = function() { return $this->i ; }; $i < function() { return $this->max; }; $i++) {} for ($i = function() { return $this->i; }; $i < function() { return $this->max; }; $i++) {} diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js index cfda6c12fc..3023a644f9 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js @@ -117,7 +117,7 @@ for ( // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesAfterOpen 0 // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesBeforeClose 0 -// Test with semi-colon not belonging to for. +// Test with semicolon not belonging to for. for (i = function() {self.widgetLoaded(widget.id) ; }; i < function() {self.widgetLoaded(widget.id);}; i++) {} for (i = function() {self.widgetLoaded(widget.id);}; i < function() {self.widgetLoaded(widget.id);} ; i++) {} diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed index 00ced64377..dcfd03bdc2 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed @@ -83,7 +83,7 @@ for ( i = 0; i < 10; i++ ) {} // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesAfterOpen 0 // phpcs:set Squiz.ControlStructures.ForLoopDeclaration requiredSpacesBeforeClose 0 -// Test with semi-colon not belonging to for. +// Test with semicolon not belonging to for. for (i = function() {self.widgetLoaded(widget.id) ; }; i < function() {self.widgetLoaded(widget.id);}; i++) {} for (i = function() {self.widgetLoaded(widget.id);}; i < function() {self.widgetLoaded(widget.id);}; i++) {} diff --git a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc index 49eaa2b633..1d3ccebc9f 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc +++ b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc @@ -77,7 +77,7 @@ class MyOtherClass $varQ = 'string', $varR = 123; - // Intentionally missing a semi-colon for testing. + // Intentionally missing a semicolon for testing. public $varS, $varT diff --git a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed index 4c116c76ad..d4e8a39e16 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed +++ b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed @@ -72,7 +72,7 @@ class MyOtherClass $varQ = 'string', $varR = 123; - // Intentionally missing a semi-colon for testing. + // Intentionally missing a semicolon for testing. public $varS, $varT diff --git a/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc b/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc index 393f48454b..60f87e5bc5 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc +++ b/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc @@ -18,14 +18,14 @@ $sum = $a /* + $b + $c */ ; /* - * Test that the sniff does *not* throw incorrect errors for semi-colons in + * Test that the sniff does *not* throw incorrect errors for semicolons in * "empty" parts of a `for` control structure. */ for ($i = 1; ; $i++) {} for ( ; $ptr >= 0; $ptr-- ) {} for ( ; ; ) {} -// But it should when the semi-colon in a `for` follows a comment (but shouldn't move the semi-colon). +// But it should when the semicolon in a `for` follows a comment (but shouldn't move the semicolon). for ( /* Deliberately left empty. */ ; $ptr >= 0; $ptr-- ) {} for ( $i = 1 ; /* Deliberately left empty. */ ; $i++ ) {} diff --git a/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc.fixed b/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc.fixed index 0d06324dec..b4dc0f13ec 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc.fixed +++ b/src/Standards/Squiz/Tests/WhiteSpace/SemicolonSpacingUnitTest.inc.fixed @@ -18,14 +18,14 @@ $sum = $a; /* + $b + $c */ /* - * Test that the sniff does *not* throw incorrect errors for semi-colons in + * Test that the sniff does *not* throw incorrect errors for semicolons in * "empty" parts of a `for` control structure. */ for ($i = 1; ; $i++) {} for ( ; $ptr >= 0; $ptr-- ) {} for ( ; ; ) {} -// But it should when the semi-colon in a `for` follows a comment (but shouldn't move the semi-colon). +// But it should when the semicolon in a `for` follows a comment (but shouldn't move the semicolon). for ( /* Deliberately left empty. */; $ptr >= 0; $ptr-- ) {} for ( $i = 1; /* Deliberately left empty. */; $i++ ) {}