diff --git a/WordPressVIPMinimum/Sniffs/Variables/VariableAnalysisSniff.php b/WordPressVIPMinimum/Sniffs/Variables/VariableAnalysisSniff.php deleted file mode 100644 index 18e1ed27..00000000 --- a/WordPressVIPMinimum/Sniffs/Variables/VariableAnalysisSniff.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @copyright 2011-2012 Sam Graham - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -namespace WordPressVIPMinimum\Sniffs\Variables; - -use PHP_CodeSniffer\Files\File; - -/** - * Checks for undefined function variables. - * - * This sniff checks that all function variables - * are defined in the function body. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Sam Graham - * @copyright 2011 Sam Graham - * @link http://pear.php.net/package/PHP_CodeSniffer - * - * @deprecated 2.2.0 Use the `VariableAnalysis.CodeAnalysis.VariableAnalysis` sniff instead. - * This `WordPressVIPMinimum.Variables.VariableAnalysis sniff will be removed in VIPCS 3.0.0. - */ -class VariableAnalysisSniff extends \VariableAnalysis\Sniffs\CodeAnalysis\VariableAnalysisSniff { - - /** - * Keep track of whether the warnings have been thrown to prevent - * the messages being thrown for every token triggering the sniff. - * - * @since 2.2.0 - * - * @var array - */ - private $thrown = [ - 'DeprecatedSniff' => false, - 'FoundPropertyForDeprecatedSniff' => false, - ]; - - /** - * Don't use. - * - * @since 2.2.0 Added to allow for throwing the deprecation notices. - * @deprecated 2.2.0 - * - * @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 int|void Integer stack pointer to skip forward or void to continue - * normal file processing. - */ - public function process( File $phpcsFile, $stackPtr ) { - - if ( $this->thrown['DeprecatedSniff'] === false ) { - $this->thrown['DeprecatedSniff'] = $phpcsFile->addWarning( - 'The "WordPressVIPMinimum.Variables.VariableAnalysis" sniff has been deprecated. Use the "VariableAnalysis.CodeAnalysis.VariableAnalysis" sniff instead. Please update your custom ruleset.', - 0, - 'DeprecatedSniff' - ); - } - if ( ! empty( $this->exclude ) && $this->thrown['FoundPropertyForDeprecatedSniff'] === false ) { - $this->thrown['FoundPropertyForDeprecatedSniff'] = $phpcsFile->addWarning( - 'The "WordPressVIPMinimum.Variables.VariableAnalysis" sniff has been deprecated. Use the "CodeAnalysis.VariableAnalysis" sniff instead. "exclude" property setting found. Please update your custom ruleset.', - 0, - 'FoundPropertyForDeprecatedSniff' - ); - } - - parent::process( $phpcsFile, $stackPtr ); - } -} diff --git a/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.inc b/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.inc deleted file mode 100644 index 2c8d0347..00000000 --- a/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.inc +++ /dev/null @@ -1,29 +0,0 @@ -bar(); // Undefined $this in trait OK. - } - function bar() {} -} - -function test() { - try { - do_something_silly(); - } catch ( Exception $e ) {} // OK. -} - -class MyClass { - function my_function() { - return function() { - $this->my_callback(); // OK - new VariableAnalysis doesn't flag $this as undefined in closure. - }; - } - - function my_callback() {} - } diff --git a/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.php b/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.php deleted file mode 100644 index f32045fd..00000000 --- a/WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.php +++ /dev/null @@ -1,41 +0,0 @@ - => - */ - public function getErrorList() { - return []; - } - - /** - * Returns the lines where warnings should occur. - * - * @return array => - */ - public function getWarningList() { - return [ - 1 => 1, - 5 => 2, - ]; - } -} diff --git a/WordPressVIPMinimum/ruleset.xml b/WordPressVIPMinimum/ruleset.xml index 25833535..ae8347d4 100644 --- a/WordPressVIPMinimum/ruleset.xml +++ b/WordPressVIPMinimum/ruleset.xml @@ -153,32 +153,4 @@ - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - -