From 2fe5450b637172d07f41877e1f0b2579ccfdfef5 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 30 Sep 2024 06:49:26 +0545 Subject: [PATCH 1/2] Fis docs and versions --- docs/creating-a-static-check.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/creating-a-static-check.md b/docs/creating-a-static-check.md index 0b7674c77..c750d1621 100644 --- a/docs/creating-a-static-check.md +++ b/docs/creating-a-static-check.md @@ -17,7 +17,7 @@ use WordPress\Plugin_Check\Traits\Stable_Check; class My_Custom_Check implements Static_Check { use Stable_Check; - + public function get_categories() { // Return an array of check categories. // See the `WordPress\Plugin_Check\Checker\Check_Categories` class for available categories. @@ -45,7 +45,7 @@ use WordPress\Plugin_Check\Traits\Stable_Check; * Check for detecting incorrect casing of the word "WordPress" using PHP CodeSniffer. */ class My_Custom_Check extends Abstract_PHP_CodeSniffer_Check { - + use Stable_Check; /** @@ -64,9 +64,10 @@ class My_Custom_Check extends Abstract_PHP_CodeSniffer_Check { /** * Returns an associative array of arguments to pass to PHPCS. * + * @param Check_Result $result The check result to amend, including the plugin context to check. * @return array An associative array of PHPCS CLI arguments. */ - protected function get_args() { + protected function get_args( Check_Result $result ) { return array( 'extensions' => 'php', 'standard' => 'WordPress', @@ -173,8 +174,8 @@ public function run( Check_Result $result ) { // When an issue is found add a warning. $result->add_message( - false, - 'Warning message content.', + false, + 'Warning message content.', array( 'code' => 'warning_code', 'file' => $plugin_file, From 63b347b008e6d738e3101b44e9cc732edd0713ac Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 30 Sep 2024 06:51:45 +0545 Subject: [PATCH 2/2] Update since versions --- includes/Checker/Abstract_Check_Runner.php | 2 +- includes/Checker/CLI_Runner.php | 2 +- .../Checks/Plugin_Repo/Offloading_Files_Check.php | 10 +++++----- .../Checker/Exception/Invalid_Check_Slug_Exception.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/Checker/Abstract_Check_Runner.php b/includes/Checker/Abstract_Check_Runner.php index f90e95662..368418da3 100644 --- a/includes/Checker/Abstract_Check_Runner.php +++ b/includes/Checker/Abstract_Check_Runner.php @@ -492,7 +492,7 @@ final public function get_checks_to_run() { /** * Checks whether the current environment allows for runtime checks to be used. * - * @since n.e.x.t + * @since 1.2.0 * * @return bool True if runtime checks are allowed, false otherwise. */ diff --git a/includes/Checker/CLI_Runner.php b/includes/Checker/CLI_Runner.php index 57bab8494..53ba12224 100644 --- a/includes/Checker/CLI_Runner.php +++ b/includes/Checker/CLI_Runner.php @@ -181,7 +181,7 @@ protected function get_slug_param() { /** * Checks whether the current environment allows for runtime checks to be used. * - * @since n.e.x.t + * @since 1.2.0 * * @return bool True if runtime checks are allowed, false otherwise. */ diff --git a/includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php b/includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php index 49b3f113b..40bbcc97c 100644 --- a/includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php @@ -16,7 +16,7 @@ /** * Check to detect loading files from external sites. * - * @since n.e.x.t. + * @since 1.2.0. */ class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check { @@ -26,7 +26,7 @@ class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check { /** * Bitwise flags to control check behavior. * - * @since n.e.x.t. + * @since 1.2.0. * @var int */ protected $flags = 0; @@ -36,7 +36,7 @@ class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check { * * Every check must have at least one category. * - * @since n.e.x.t. + * @since 1.2.0. * * @return array The categories for the check. */ @@ -65,7 +65,7 @@ protected function get_args( Check_Result $result ) { * * Every check must have a short description explaining what the check does. * - * @since n.e.x.t. + * @since 1.2.0. * * @return string Description. */ @@ -78,7 +78,7 @@ public function get_description(): string { * * Every check must have a URL with further information about the check. * - * @since n.e.x.t. + * @since 1.2.0. * * @return string The documentation URL. */ diff --git a/includes/Checker/Exception/Invalid_Check_Slug_Exception.php b/includes/Checker/Exception/Invalid_Check_Slug_Exception.php index cd1144f5f..d0617f1bd 100644 --- a/includes/Checker/Exception/Invalid_Check_Slug_Exception.php +++ b/includes/Checker/Exception/Invalid_Check_Slug_Exception.php @@ -12,7 +12,7 @@ /** * Class for an exception thrown when an invalid check slug is provided. * - * @since n.e.x.t + * @since 1.2.0 */ class Invalid_Check_Slug_Exception extends InvalidArgumentException {