diff --git a/src/Standards/Squiz/Docs/WhiteSpace/LanguageConstructSpacingStandard.xml b/src/Standards/Squiz/Docs/WhiteSpace/LanguageConstructSpacingStandard.xml deleted file mode 100644 index 85838ec329..0000000000 --- a/src/Standards/Squiz/Docs/WhiteSpace/LanguageConstructSpacingStandard.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - "hi"; - ]]> - - - "hi"; - ]]> - - - diff --git a/src/Standards/Squiz/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php b/src/Standards/Squiz/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php deleted file mode 100644 index 7890dd5fd6..0000000000 --- a/src/Standards/Squiz/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php +++ /dev/null @@ -1,128 +0,0 @@ - - * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * - * @deprecated 3.3.0 Use the Generic.WhiteSpace.LanguageConstructSpacing sniff instead. - */ - -namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace; - -use PHP_CodeSniffer\Files\File; -use PHP_CodeSniffer\Sniffs\DeprecatedSniff; -use PHP_CodeSniffer\Sniffs\Sniff; -use PHP_CodeSniffer\Util; - -class LanguageConstructSpacingSniff implements Sniff, DeprecatedSniff -{ - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return [ - T_ECHO, - T_PRINT, - T_RETURN, - T_INCLUDE, - T_INCLUDE_ONCE, - T_REQUIRE, - T_REQUIRE_ONCE, - T_NEW, - ]; - - }//end register() - - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param int $stackPtr The position of the current token in - * the stack passed in $tokens. - * - * @return void - */ - public function process(File $phpcsFile, $stackPtr) - { - $tokens = $phpcsFile->getTokens(); - - if (isset($tokens[($stackPtr + 1)]) === false) { - // Skip if there is no next token. - return; - } - - if ($tokens[($stackPtr + 1)]['code'] === T_SEMICOLON) { - // No content for this language construct. - return; - } - - if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { - $content = $tokens[($stackPtr + 1)]['content']; - if ($content !== ' ') { - $error = 'Language constructs must be followed by a single space; expected 1 space but found "%s"'; - $data = [Util\Common::prepareForOutput($content)]; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectSingle', $data); - if ($fix === true) { - $phpcsFile->fixer->replaceToken(($stackPtr + 1), ' '); - } - } - } else if ($tokens[($stackPtr + 1)]['code'] !== T_OPEN_PARENTHESIS) { - $error = 'Language constructs must be followed by a single space; expected "%s" but found "%s"'; - $data = [ - $tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'], - $tokens[$stackPtr]['content'].$tokens[($stackPtr + 1)]['content'], - ]; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); - if ($fix === true) { - $phpcsFile->fixer->addContent($stackPtr, ' '); - } - }//end if - - }//end process() - - - /** - * Provide the version number in which the sniff was deprecated. - * - * @return string - */ - public function getDeprecationVersion() - { - return 'v3.3.0'; - - }//end getDeprecationVersion() - - - /** - * Provide the version number in which the sniff will be removed. - * - * @return string - */ - public function getRemovalVersion() - { - return 'v4.0.0'; - - }//end getRemovalVersion() - - - /** - * Provide a custom message to display with the deprecation. - * - * @return string - */ - public function getDeprecationMessage() - { - return 'Use the Generic.WhiteSpace.LanguageConstructSpacing sniff instead.'; - - }//end getDeprecationMessage() - - -}//end class diff --git a/src/Standards/Squiz/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc b/src/Standards/Squiz/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc deleted file mode 100644 index e8f2edad38..0000000000 --- a/src/Standards/Squiz/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - */ - -namespace PHP_CodeSniffer\Standards\Squiz\Tests\WhiteSpace; - -use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; - -/** - * Unit test class for the LanguageConstructSpacing sniff. - * - * @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\LanguageConstructSpacingSniff - */ -final class LanguageConstructSpacingUnitTest extends AbstractSniffUnitTest -{ - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array - */ - public function getErrorList() - { - return [ - 3 => 1, - 7 => 1, - 11 => 1, - 15 => 1, - 19 => 1, - 23 => 1, - 27 => 1, - 31 => 1, - 34 => 1, - 35 => 1, - 39 => 1, - ]; - - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return []; - - }//end getWarningList() - - -}//end class diff --git a/src/Standards/Squiz/ruleset.xml b/src/Standards/Squiz/ruleset.xml index 82f5270ada..2f28c8d3e8 100644 --- a/src/Standards/Squiz/ruleset.xml +++ b/src/Standards/Squiz/ruleset.xml @@ -110,11 +110,6 @@ 0 - - - 0 - -