diff --git a/WordPress-VIP-Go/ruleset-test.inc b/WordPress-VIP-Go/ruleset-test.inc index bd7e3de6..c4ec4eeb 100644 --- a/WordPress-VIP-Go/ruleset-test.inc +++ b/WordPress-VIP-Go/ruleset-test.inc @@ -341,9 +341,9 @@ $my_theme_options = get_option( 'my_theme', false ); if ( array_key_exists( 'key', $my_theme_options ) ) { } // Error. echo 'My term link'; // Error. -// WordPressVIPMinimum.Functions.DynamicCalls -$my_notokay_func = 'extract'; -$my_notokay_func(); // Error. + + + // WordPressVIPMinimum.Functions.RestrictedFunctions diff --git a/WordPress-VIP-Go/ruleset-test.php b/WordPress-VIP-Go/ruleset-test.php index d8701db4..83cb5514 100644 --- a/WordPress-VIP-Go/ruleset-test.php +++ b/WordPress-VIP-Go/ruleset-test.php @@ -36,7 +36,6 @@ 337 => 1, 341 => 1, 342 => 1, - 346 => 1, 350 => 1, 351 => 1, 352 => 1, diff --git a/WordPress-VIP-Go/ruleset.xml b/WordPress-VIP-Go/ruleset.xml index e3272707..c7eddcf5 100644 --- a/WordPress-VIP-Go/ruleset.xml +++ b/WordPress-VIP-Go/ruleset.xml @@ -6,6 +6,7 @@ + diff --git a/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php b/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php index 2236d44c..3f19977a 100644 --- a/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php +++ b/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php @@ -9,6 +9,7 @@ namespace WordPressVIPMinimum\Sniffs\Functions; +use PHP_CodeSniffer\Sniffs\DeprecatedSniff; use PHP_CodeSniffer\Util\Tokens; use PHPCSUtils\Utils\TextStrings; use WordPressVIPMinimum\Sniffs\Sniff; @@ -26,7 +27,7 @@ * * @link http://php.net/manual/en/migration71.incompatible.php */ -class DynamicCallsSniff extends Sniff { +class DynamicCallsSniff extends Sniff implements DeprecatedSniff { /** * Functions that should not be called dynamically. @@ -194,4 +195,31 @@ private function find_dynamic_calls( $stackPtr ) { $data = [ $this->variables_arr[ $this->tokens[ $stackPtr ]['content'] ] ]; $this->phpcsFile->addError( $message, $stackPtr, 'DynamicCalls', $data ); } + + /** + * Provide the version number in which the sniff was deprecated. + * + * @return string + */ + public function getDeprecationVersion() { + return 'VIP-Coding-Standard v3.1.0'; + } + + /** + * Provide the version number in which the sniff will be removed. + * + * @return string + */ + public function getRemovalVersion() { + return 'VIP-Coding-Standard v4.0.0'; + } + + /** + * Provide a custom message to display with the deprecation. + * + * @return string + */ + public function getDeprecationMessage() { + return ''; + } } diff --git a/WordPressVIPMinimum/ruleset-test.inc b/WordPressVIPMinimum/ruleset-test.inc index a20a8494..3a104038 100644 --- a/WordPressVIPMinimum/ruleset-test.inc +++ b/WordPressVIPMinimum/ruleset-test.inc @@ -303,9 +303,9 @@ $my_theme_options = get_option( 'my_theme', false ); if ( array_key_exists( 'key', $my_theme_options ) ) { } // Error. echo 'My term link'; // Error. -// WordPressVIPMinimum.Functions.DynamicCalls -$my_notokay_func = 'extract'; -$my_notokay_func(); // Error. + + + // WordPressVIPMinimum.Functions.RestrictedFunctions diff --git a/WordPressVIPMinimum/ruleset-test.php b/WordPressVIPMinimum/ruleset-test.php index e78ae6a7..4fc80840 100644 --- a/WordPressVIPMinimum/ruleset-test.php +++ b/WordPressVIPMinimum/ruleset-test.php @@ -81,7 +81,6 @@ 299 => 1, 303 => 1, 304 => 1, - 308 => 1, 312 => 1, 313 => 1, 314 => 1, diff --git a/WordPressVIPMinimum/ruleset.xml b/WordPressVIPMinimum/ruleset.xml index f5bdb847..50379d8d 100644 --- a/WordPressVIPMinimum/ruleset.xml +++ b/WordPressVIPMinimum/ruleset.xml @@ -18,6 +18,11 @@ rule in which to place the exclusion, so this will have to do for now. --> + + +