From 1a87845eb3dedb059f8c0c070a40eeda53e5b525 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Sun, 29 Sep 2024 12:02:38 +0200 Subject: [PATCH 01/21] tradermarks check with acronym allowed --- .../Checks/Plugin_Repo/Trademarks_Check.php | 37 ++++++++++++++++++- .../load.php | 16 ++++++++ .../Checker/Checks/Trademarks_Check_Tests.php | 6 +++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/phpunit/testdata/plugins/test-trademarks-plugin-header-acronym/load.php diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index 16de65d2e..d092661e2 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -137,7 +137,8 @@ class Trademarks_Check extends Abstract_File_Check { 'wordpress', 'wordpess', 'wpress', - 'wp-', + 'wp', // it's allowed, but shows a warning. + 'wc', // it's allowed, but shows a warning. 'wp-mail-smtp-', 'yandex-', 'yahoo-', @@ -146,6 +147,18 @@ class Trademarks_Check extends Abstract_File_Check { 'you-tube-', ); + /** + * Lists of trademarks that are allowed but shows in acronym. + * + * @since n.e.x.t. + * + * @var string[] + */ + const FOR_USE_ACRONYM = array( + 'wp', + 'wc', + ); + /** * Lists of trademarks that are allowed as 'for-whatever' ONLY. * @@ -348,6 +361,17 @@ private function validate_name_has_no_trademarks( $plugin_name ) { esc_html( $plugin_name ), esc_html( trim( $check, '-' ) ) ); + } elseif ( + trim( $check, '-' ) === $check + && in_array( $check, self::FOR_USE_ACRONYM, true ) + ) { + // Trademarks that are allowed to use with Acronym. + $message = sprintf( + /* translators: 1: plugin slug, 2: found trademarked term */ + __( 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used within your plugin name, unless your plugin name will not change to full name. For example: You can use WP but not WordPress.', 'plugin-check' ), + esc_html( $plugin_name ), + esc_html( trim( $check, '-' ) ) + ); } elseif ( trim( $check, '-' ) === $check ) { // Trademarks that do NOT end in "-" indicate slug cannot contain term at all. $message = sprintf( @@ -395,6 +419,17 @@ private function validate_slug_has_no_trademarks( $plugin_slug ) { esc_html( $plugin_slug ), esc_html( trim( $check, '-' ) ) ); + } elseif ( + trim( $check, '-' ) === $check + && in_array( $check, self::FOR_USE_ACRONYM, true ) + ) { + // Trademarks that are allowed to use with Acronym. + $message = sprintf( + /* translators: 1: plugin slug, 2: found trademarked term */ + __( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" which can be used within in your plugin slug, unless your plugin name will not change to the full name. For example: You can use WP but not WordPress.', 'plugin-check' ), + esc_html( $plugin_slug ), + esc_html( trim( $check, '-' ) ) + ); } elseif ( trim( $check, '-' ) === $check ) { // Trademarks that do NOT end in "-" indicate slug cannot contain term at all. $message = sprintf( diff --git a/tests/phpunit/testdata/plugins/test-trademarks-plugin-header-acronym/load.php b/tests/phpunit/testdata/plugins/test-trademarks-plugin-header-acronym/load.php new file mode 100644 index 000000000..ad7aa092f --- /dev/null +++ b/tests/phpunit/testdata/plugins/test-trademarks-plugin-header-acronym/load.php @@ -0,0 +1,16 @@ + array( + Trademarks_Check::TYPE_NAME, + 'test-trademarks-plugin-header-acronym/load.php', + 'load.php', + 'The plugin name includes a restricted term. Your plugin name - "WP Example String" - contains the restricted term "wp" which can be used within your plugin name, unless your plugin name will not change to full name. For example: You can use WP but not WordPress.', + ), 'Plugin headers - WooCommerce String for WooCommerce' => array( Trademarks_Check::TYPE_NAME, 'test-trademarks-plugin-header-woocommerce-string-for-woocommerce/load.php', From 5ae0f53b61cc2ebdd59879dc7ac400432b2b0630 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Sun, 29 Sep 2024 12:07:10 +0200 Subject: [PATCH 02/21] phplint --- tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php index 2dd8b1903..787c721fe 100644 --- a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php @@ -75,7 +75,7 @@ public function data_trademarks_check() { 'load.php', 'The plugin name includes a restricted term. Your chosen plugin name - "WooCommerce Example String" - contains the restricted term "woocommerce" which cannot be used within in your plugin name, unless your plugin name ends with "for woocommerce". The term must still not appear anywhere else in your name.', ), - 'Plugin headers - WP Example String' => array( + 'Plugin headers - WP Example String' => array( Trademarks_Check::TYPE_NAME, 'test-trademarks-plugin-header-acronym/load.php', 'load.php', From 09aef008f20ad9cf588ad4234684a8944414e203 Mon Sep 17 00:00:00 2001 From: David Perez Date: Mon, 30 Sep 2024 08:17:44 +0200 Subject: [PATCH 03/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Nilambar Sharma --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index d092661e2..f8c00d9a9 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -150,7 +150,7 @@ class Trademarks_Check extends Abstract_File_Check { /** * Lists of trademarks that are allowed but shows in acronym. * - * @since n.e.x.t. + * @since 1.2.0 * * @var string[] */ From 1af79deda41c6c623c8d673b7469516f1afff46e Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 1 Oct 2024 10:41:22 +0200 Subject: [PATCH 04/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Pascal Birchler --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index f8c00d9a9..2303b9ffd 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -365,7 +365,7 @@ private function validate_name_has_no_trademarks( $plugin_name ) { trim( $check, '-' ) === $check && in_array( $check, self::FOR_USE_ACRONYM, true ) ) { - // Trademarks that are allowed to use with Acronym. + // Trademarks that are allowed to use as an acronym. $message = sprintf( /* translators: 1: plugin slug, 2: found trademarked term */ __( 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used within your plugin name, unless your plugin name will not change to full name. For example: You can use WP but not WordPress.', 'plugin-check' ), From 0428d7a56ed9c4240bc8029f6af5a7f4bb71d278 Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 1 Oct 2024 10:41:33 +0200 Subject: [PATCH 05/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Pascal Birchler --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index 2303b9ffd..953f7edec 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -368,7 +368,7 @@ private function validate_name_has_no_trademarks( $plugin_name ) { // Trademarks that are allowed to use as an acronym. $message = sprintf( /* translators: 1: plugin slug, 2: found trademarked term */ - __( 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used within your plugin name, unless your plugin name will not change to full name. For example: You can use WP but not WordPress.', 'plugin-check' ), + __( 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used , as long as you don\'t change it to the full name. For example: You can use WP but not WordPress.', 'plugin-check' ), esc_html( $plugin_name ), esc_html( trim( $check, '-' ) ) ); From c92dd13e5c70caf49501ca900a9624e86f8d7f28 Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 1 Oct 2024 10:41:43 +0200 Subject: [PATCH 06/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Pascal Birchler --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index 953f7edec..35f064d52 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -426,7 +426,7 @@ private function validate_slug_has_no_trademarks( $plugin_slug ) { // Trademarks that are allowed to use with Acronym. $message = sprintf( /* translators: 1: plugin slug, 2: found trademarked term */ - __( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" which can be used within in your plugin slug, unless your plugin name will not change to the full name. For example: You can use WP but not WordPress.', 'plugin-check' ), + __( 'The plugin slug includes a restricted term. Your plugin slug - "%1$s" - contains the restricted term "%2$s" which can be used within the plugin slug, as long as you don\'t use the full name in the plugin name. For example: You can use WP but not WordPress.', 'plugin-check' ), esc_html( $plugin_slug ), esc_html( trim( $check, '-' ) ) ); From 5a73db811c96ec8d2d39cce8ff5915f2ce8c39f6 Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 1 Oct 2024 10:42:03 +0200 Subject: [PATCH 07/21] Update tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php Co-authored-by: Pascal Birchler --- tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php index 787c721fe..2e8797af0 100644 --- a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php @@ -79,7 +79,7 @@ public function data_trademarks_check() { Trademarks_Check::TYPE_NAME, 'test-trademarks-plugin-header-acronym/load.php', 'load.php', - 'The plugin name includes a restricted term. Your plugin name - "WP Example String" - contains the restricted term "wp" which can be used within your plugin name, unless your plugin name will not change to full name. For example: You can use WP but not WordPress.', + 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used , as long as you don\'t change it to the full name. For example: You can use WP but not WordPress.', ), 'Plugin headers - WooCommerce String for WooCommerce' => array( Trademarks_Check::TYPE_NAME, From a323a1eabdd836105e6471f9e4740133b5d1ba3c Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 1 Oct 2024 10:43:21 +0200 Subject: [PATCH 08/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Pascal Birchler --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index 35f064d52..cfd2f37b5 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -148,7 +148,7 @@ class Trademarks_Check extends Abstract_File_Check { ); /** - * Lists of trademarks that are allowed but shows in acronym. + * Lists of allowed acronyms of trademarks. * * @since 1.2.0 * From b21361d37957522463acbfb335fadccba0fe5f13 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 1 Oct 2024 10:45:02 +0200 Subject: [PATCH 09/21] changed name constant --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index cfd2f37b5..296cb27e2 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -154,7 +154,7 @@ class Trademarks_Check extends Abstract_File_Check { * * @var string[] */ - const FOR_USE_ACRONYM = array( + const ALLOWED_ACRONYMS = array( 'wp', 'wc', ); @@ -363,7 +363,7 @@ private function validate_name_has_no_trademarks( $plugin_name ) { ); } elseif ( trim( $check, '-' ) === $check - && in_array( $check, self::FOR_USE_ACRONYM, true ) + && in_array( $check, self::ALLOWED_ACRONYMS, true ) ) { // Trademarks that are allowed to use as an acronym. $message = sprintf( @@ -421,7 +421,7 @@ private function validate_slug_has_no_trademarks( $plugin_slug ) { ); } elseif ( trim( $check, '-' ) === $check - && in_array( $check, self::FOR_USE_ACRONYM, true ) + && in_array( $check, self::ALLOWED_ACRONYMS, true ) ) { // Trademarks that are allowed to use with Acronym. $message = sprintf( From 9c107c2537ab7a86bb4792fb4963db7c42d55bf6 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 1 Oct 2024 22:13:50 +0200 Subject: [PATCH 10/21] fix tests --- tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php index 2e8797af0..1470b2d3b 100644 --- a/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Trademarks_Check_Tests.php @@ -79,7 +79,7 @@ public function data_trademarks_check() { Trademarks_Check::TYPE_NAME, 'test-trademarks-plugin-header-acronym/load.php', 'load.php', - 'The plugin name includes a restricted term. Your plugin name - "%1$s" - contains the restricted term "%2$s" which can be used , as long as you don\'t change it to the full name. For example: You can use WP but not WordPress.', + 'The plugin name includes a restricted term. Your plugin name - "WP Example String" - contains the restricted term "wp" which can be used , as long as you don\'t change it to the full name. For example: You can use WP but not WordPress.', ), 'Plugin headers - WooCommerce String for WooCommerce' => array( Trademarks_Check::TYPE_NAME, From 15d2d438c409a81cb8e7e4dd3620f0937c711b54 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 11 Nov 2024 17:11:02 -0800 Subject: [PATCH 11/21] Ensure runtime environment is set up before testing Universal_Runtime_Preparation. --- .../Universal_Runtime_Preparation_Tests.php | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/Checker/Preparations/Universal_Runtime_Preparation_Tests.php b/tests/phpunit/tests/Checker/Preparations/Universal_Runtime_Preparation_Tests.php index c805b0e21..0cd416c96 100644 --- a/tests/phpunit/tests/Checker/Preparations/Universal_Runtime_Preparation_Tests.php +++ b/tests/phpunit/tests/Checker/Preparations/Universal_Runtime_Preparation_Tests.php @@ -9,16 +9,43 @@ use WordPress\Plugin_Check\Checker\Check_Context; use WordPress\Plugin_Check\Checker\Preparations\Universal_Runtime_Preparation; +use WordPress\Plugin_Check\Checker\Runtime_Environment_Setup; use WP_UnitTestCase; class Universal_Runtime_Preparation_Tests extends WP_UnitTestCase { + /** + * Storage for preparation cleanups that need to be run after a test. + * + * @var array + */ + private $cleanups = array(); + + public function tear_down() { + if ( count( $this->cleanups ) > 0 ) { + $this->cleanups = array_reverse( $this->cleanups ); + foreach ( $this->cleanups as $cleanup ) { + $cleanup(); + } + $this->cleanups = array(); + } + parent::tear_down(); + } + public function test_prepare() { $check_context = new Check_Context( plugin_basename( WP_PLUGIN_CHECK_MAIN_FILE ) ); + // The runtime environment must be prepared manually before regular runtime preparations. + $runtime = new Runtime_Environment_Setup(); + $runtime->set_up(); + $this->cleanups[] = function () use ( $runtime ) { + $runtime->clean_up(); + }; + $universal_runtime_preparation = new Universal_Runtime_Preparation( $check_context ); - $cleanup = $universal_runtime_preparation->prepare(); + $cleanup = $universal_runtime_preparation->prepare(); + $this->cleanups[] = $cleanup; $this->assertTrue( has_filter( 'option_active_plugins' ) ); $this->assertTrue( has_filter( 'default_option_active_plugins' ) ); @@ -32,6 +59,9 @@ public function test_prepare() { $cleanup(); + // If this is reached, the universal runtime preparation cleanup was already done, so we can remove it again. + array_pop( $this->cleanups ); + $this->assertFalse( has_filter( 'option_active_plugins' ) ); $this->assertFalse( has_filter( 'default_option_active_plugins' ) ); $this->assertFalse( has_filter( 'stylesheet' ) ); From 9703245dc5109f47747f36de8564f1605f962638 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Tue, 12 Nov 2024 14:02:39 -0800 Subject: [PATCH 12/21] Fix another instance of missing Runtime_Environment_Setup. --- .../Plugin_Request_Utility_Tests.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/Utilities/Plugin_Request_Utility_Tests.php b/tests/phpunit/tests/Utilities/Plugin_Request_Utility_Tests.php index fc760ca26..80a36513d 100644 --- a/tests/phpunit/tests/Utilities/Plugin_Request_Utility_Tests.php +++ b/tests/phpunit/tests/Utilities/Plugin_Request_Utility_Tests.php @@ -11,6 +11,7 @@ use WordPress\Plugin_Check\Checker\Checks; use WordPress\Plugin_Check\Checker\Checks\General\I18n_Usage_Check; use WordPress\Plugin_Check\Checker\CLI_Runner; +use WordPress\Plugin_Check\Checker\Runtime_Environment_Setup; use WordPress\Plugin_Check\Test_Data\Runtime_Check; use WordPress\Plugin_Check\Test_Utils\Traits\With_Mock_Filesystem; use WordPress\Plugin_Check\Utilities\Plugin_Request_Utility; @@ -90,6 +91,16 @@ public function test_initialize_runner_with_ajax() { $_REQUEST['action'] = 'plugin_check_run_checks'; $_REQUEST['plugin'] = 'plugin-check'; + /* + * The runtime environment must be prepared manually before regular runtime preparations. + * This is necessary because in reality it happens in a separate AJAX request before. + */ + $runtime = new Runtime_Environment_Setup(); + $runtime->set_up(); + $this->cleanups[] = function () use ( $runtime ) { + $runtime->clean_up(); + }; + Plugin_Request_Utility::initialize_runner(); $this->cleanups[] = function () { Plugin_Request_Utility::destroy_runner(); @@ -109,7 +120,7 @@ public function test_initialize_runner_with_ajax() { public function test_destroy_runner_with_cli() { define( 'WP_CLI', true ); - global $wpdb, $table_prefix, $wp_actions; + global $wp_actions; $this->set_up_mock_filesystem(); @@ -151,7 +162,6 @@ function ( $checks ) { unset( $_SERVER['argv'] ); $wp_actions['muplugins_loaded'] = $muplugins_loaded; - $wpdb->set_prefix( $table_prefix ); $this->assertTrue( $prepared ); $this->assertTrue( $cleanup ); @@ -159,7 +169,7 @@ function ( $checks ) { } public function test_destroy_runner_with_ajax() { - global $wpdb, $table_prefix, $wp_actions; + global $wp_actions; $this->set_up_mock_filesystem(); @@ -168,6 +178,16 @@ public function test_destroy_runner_with_ajax() { $_REQUEST['plugin'] = 'plugin-check'; $_REQUEST['checks'] = array( 'runtime_check' ); + /* + * The runtime environment must be prepared manually before regular runtime preparations. + * This is necessary because in reality it happens in a separate AJAX request before. + */ + $runtime = new Runtime_Environment_Setup(); + $runtime->set_up(); + $this->cleanups[] = function () use ( $runtime ) { + $runtime->clean_up(); + }; + add_filter( 'wp_plugin_check_checks', function ( $checks ) { @@ -196,7 +216,6 @@ function ( $checks ) { $cleanup = ! has_filter( 'option_active_plugins' ); $runner = Plugin_Request_Utility::get_runner(); - $wpdb->set_prefix( $table_prefix ); $wp_actions['muplugins_loaded'] = $muplugins_loaded; $this->assertTrue( $prepared ); From 7be1dc4a9a66bba7fae667b6109c0d7cee533c1e Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 13 Nov 2024 22:19:54 +0100 Subject: [PATCH 13/21] Update includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php Co-authored-by: Nilambar Sharma --- includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php index afa03fb4a..cf181fa03 100644 --- a/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php @@ -150,7 +150,7 @@ class Trademarks_Check extends Abstract_File_Check { /** * Lists of allowed acronyms of trademarks. * - * @since 1.2.0 + * @since 1.3.0 * * @var string[] */ From 7f56cb33981f30851606e5daa88925b635bb99b8 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 18 Nov 2024 21:26:54 +0545 Subject: [PATCH 14/21] Bump min php support to 7.4 --- .github/workflows/behat-test.yml | 4 +--- .github/workflows/php-test.yml | 5 +---- CONTRIBUTING.md | 2 +- composer.json | 4 ++-- composer.lock | 6 +++--- phpcs-sniffs/composer.json | 6 +++--- phpcs-sniffs/composer.lock | 6 +++--- phpcs-sniffs/phpcs.xml.dist | 2 +- phpcs.xml.dist | 2 +- plugin.php | 4 ++-- 10 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index de9b8c633..85e664fb6 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -60,8 +60,6 @@ jobs: fail-fast: true matrix: php: - - '7.2' - - '7.3' - '7.4' - '8.0' - '8.1' @@ -70,7 +68,7 @@ jobs: - php: '8.2' wordpress: 'latest' coverage: true - - php: '7.2' + - php: '7.4' wordpress: '6.3' - php: '8.3' wordpress: 'trunk' diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index bb7d48eec..03bc69be9 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -48,13 +48,12 @@ jobs: fail-fast: true matrix: php: - - '7.3' - '7.4' - '8.0' - '8.1' wordpress: [ 'latest' ] include: - - php: '7.2' + - php: '7.4' wordpress: '6.3' - php: '8.2' wordpress: 'latest' @@ -115,8 +114,6 @@ jobs: fail-fast: true matrix: php: - - '7.2' - - '7.3' - '7.4' - '8.0' - '8.1' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41a9bd898..c240bbeab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Thank you for your interest in contributing to the Plugin Check plugin! In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Plugin Check plugin must follow these requirements: - **WordPress**: The plugin's minimum WordPress version requirement is 6.3. -- **PHP**: Always match the latest WordPress version. The minimum required version right now is 7.2.24. +- **PHP**: The plugin's minimum PHP version requirement is 7.4. ## Guidelines diff --git a/composer.json b/composer.json index e654e06db..d23f2c8a7 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "GPL-2.0-or-later", "type": "wordpress-plugin", "require": { - "php": ">=7.2.24", + "php": ">=7.4", "ext-json": "*", "afragen/wordpress-plugin-readme-parser": "dev-master#67fba498d0b112acf84386b95e4905c539a33f0b", "automattic/vipwpcs": "^3.0.0", @@ -56,7 +56,7 @@ "phpstan/extension-installer": true }, "platform": { - "php": "7.2.24" + "php": "7.4" } }, "scripts": { diff --git a/composer.lock b/composer.lock index f90aa24b8..2a01919ba 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e1f6b4abdc63a16d7d5a7609f6df578a", + "content-hash": "3aab6089bbe13e7a4c81438da8f72ad6", "packages": [ { "name": "afragen/wordpress-plugin-readme-parser", @@ -6489,12 +6489,12 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.2.24", + "php": ">=7.4", "ext-json": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.2.24" + "php": "7.4" }, "plugin-api-version": "2.6.0" } diff --git a/phpcs-sniffs/composer.json b/phpcs-sniffs/composer.json index 321eea251..7258b4dba 100644 --- a/phpcs-sniffs/composer.json +++ b/phpcs-sniffs/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.2.24", + "php": ">=7.4", "ext-libxml": "*", "ext-tokenizer": "*", "ext-xmlreader": "*", @@ -38,7 +38,7 @@ "dealerdirect/phpcodesniffer-composer-installer": true }, "platform": { - "php": "7.2.24" + "php": "7.4" } }, "scripts": { @@ -67,4 +67,4 @@ "lint": "Lint PHP files against parse errors.", "run-tests": "Run all the unit tests for the Plugin Check Coding Standards sniffs." } -} \ No newline at end of file +} diff --git a/phpcs-sniffs/composer.lock b/phpcs-sniffs/composer.lock index 4f32ab0cb..b76221c75 100644 --- a/phpcs-sniffs/composer.lock +++ b/phpcs-sniffs/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e3f2033f9c52ac5eab10852c851d3007", + "content-hash": "49ca6c46b9685eb474d91448a1b9444f", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -2050,14 +2050,14 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.2.24", + "php": ">=7.4", "ext-libxml": "*", "ext-tokenizer": "*", "ext-xmlreader": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.2.24" + "php": "7.4" }, "plugin-api-version": "2.6.0" } diff --git a/phpcs-sniffs/phpcs.xml.dist b/phpcs-sniffs/phpcs.xml.dist index 337d86812..9f61b589c 100644 --- a/phpcs-sniffs/phpcs.xml.dist +++ b/phpcs-sniffs/phpcs.xml.dist @@ -37,7 +37,7 @@ - + diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 178470c80..436717cd8 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -3,7 +3,7 @@ Sniffs for WordPress plugins, with minor modifications for Performance - + diff --git a/plugin.php b/plugin.php index 8de444180..a905b6c3d 100644 --- a/plugin.php +++ b/plugin.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/WordPress/plugin-check * Description: Plugin Check is a WordPress.org tool which provides checks to help plugins meet the directory requirements and follow various best practices. * Requires at least: 6.3 - * Requires PHP: 7.2.24 + * Requires PHP: 7.4 * Version: 1.2.0 * Author: WordPress Performance Team and Plugin Review Team * License: GPLv2 or later @@ -17,7 +17,7 @@ use WordPress\Plugin_Check\Plugin_Main; define( 'WP_PLUGIN_CHECK_VERSION', '1.2.0' ); -define( 'WP_PLUGIN_CHECK_MINIMUM_PHP', '7.2.24' ); +define( 'WP_PLUGIN_CHECK_MINIMUM_PHP', '7.4' ); define( 'WP_PLUGIN_CHECK_MAIN_FILE', __FILE__ ); define( 'WP_PLUGIN_CHECK_PLUGIN_DIR_PATH', plugin_dir_path( WP_PLUGIN_CHECK_MAIN_FILE ) ); define( 'WP_PLUGIN_CHECK_PLUGIN_DIR_URL', plugin_dir_url( WP_PLUGIN_CHECK_MAIN_FILE ) ); From 805e6617eb8080b93f2a27ff7e665fed02162254 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 19 Nov 2024 10:21:44 +0545 Subject: [PATCH 15/21] Update CONTRIBUTING.md Co-authored-by: Mukesh Panchal --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c240bbeab..f6ec40341 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Thank you for your interest in contributing to the Plugin Check plugin! In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Plugin Check plugin must follow these requirements: - **WordPress**: The plugin's minimum WordPress version requirement is 6.3. -- **PHP**: The plugin's minimum PHP version requirement is 7.4. +- **PHP**: The minimum required version right now is 7.4. ## Guidelines From 59c529c826da058839d3bd76f5ff66671f343a6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:34:44 +0000 Subject: [PATCH 16/21] Bump codecov/codecov-action from 4.6.0 to 5.0.2 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.2. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Commits](https://github.com/codecov/codecov-action/compare/v4.6.0...v5.0.2) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/behat-test.yml | 2 +- .github/workflows/php-test.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/behat-test.yml b/.github/workflows/behat-test.yml index 85e664fb6..4f045338f 100644 --- a/.github/workflows/behat-test.yml +++ b/.github/workflows/behat-test.yml @@ -155,7 +155,7 @@ jobs: - name: Upload code coverage report if: ${{ matrix.coverage }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: files: ${{ steps.coverage_files.outputs.files }} flags: feature diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 03bc69be9..42aaefff9 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -100,7 +100,7 @@ jobs: - name: Upload code coverage report if: ${{ matrix.coverage }} - uses: codecov/codecov-action@68708a9f7a6b6b5fe33673f782f93725c5eff3c6 + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a with: file: build/logs/*.xml flags: unit @@ -146,7 +146,7 @@ jobs: - name: Upload code coverage report if: ${{ matrix.coverage }} - uses: codecov/codecov-action@68708a9f7a6b6b5fe33673f782f93725c5eff3c6 + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a with: file: build/logs/*.xml flags: phpcs-sniffs From 5121cccf114d66554f5394fd4ad3964037e2f24b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:57:41 +0000 Subject: [PATCH 17/21] Bump @wordpress/scripts from 30.4.0 to 30.5.1 Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 30.4.0 to 30.5.1. - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@30.5.1/packages/scripts) --- updated-dependencies: - dependency-name: "@wordpress/scripts" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 79 +++++------------------------------------------ package.json | 2 +- 2 files changed, 8 insertions(+), 73 deletions(-) diff --git a/package-lock.json b/package-lock.json index cef620567..46c89297f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "license": "GPL-2.0-or-later", "devDependencies": { "@wordpress/env": "^10.11.0", - "@wordpress/scripts": "^30.4.0", + "@wordpress/scripts": "^30.5.1", "gherkin-lint": "^4.2.4", "patch-package": "^8.0.0" }, @@ -4639,9 +4639,9 @@ } }, "node_modules/@wordpress/scripts": { - "version": "30.4.0", - "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-30.4.0.tgz", - "integrity": "sha512-hAX8XB8hWlxAyktT4KkBpGttRwSynmtkpLvbVKeKnj+BjABFs4TGb/HCF9hFpUK3huCAg8Ft/sjjczW+5tqspQ==", + "version": "30.5.1", + "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-30.5.1.tgz", + "integrity": "sha512-VM5NViNfdQR69MWxLnptB8svvnrEV+oUVgWL8icsLdCt2CENgPwUIk/Gs0wzeAVK05cGjrCESapJnEgIXp5lzA==", "dev": true, "dependencies": { "@babel/core": "7.25.7", @@ -4686,7 +4686,6 @@ "npm-package-json-lint": "^6.4.0", "npm-packlist": "^3.0.0", "postcss": "^8.4.5", - "postcss-import": "^16.1.0", "postcss-loader": "^6.2.1", "prettier": "npm:wp-prettier@3.0.3", "puppeteer-core": "^23.1.0", @@ -14777,23 +14776,6 @@ "postcss": "^8.4.31" } }, - "node_modules/postcss-import": { - "version": "16.1.0", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-16.1.0.tgz", - "integrity": "sha512-7hsAZ4xGXl4MW+OKEWCnF6T5jqBw80/EE9aXg1r2yyn1RsVEU8EtKXbijEODa+rg7iih4bKf7vlvTGYR4CnPNg==", - "dev": true, - "dependencies": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "postcss": "^8.0.0" - } - }, "node_modules/postcss-loader": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-6.2.1.tgz", @@ -15771,24 +15753,6 @@ "node": ">=0.10.0" } }, - "node_modules/read-cache": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", - "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dev": true, - "dependencies": { - "pify": "^2.3.0" - } - }, - "node_modules/read-cache/node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -23060,9 +23024,9 @@ "requires": {} }, "@wordpress/scripts": { - "version": "30.4.0", - "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-30.4.0.tgz", - "integrity": "sha512-hAX8XB8hWlxAyktT4KkBpGttRwSynmtkpLvbVKeKnj+BjABFs4TGb/HCF9hFpUK3huCAg8Ft/sjjczW+5tqspQ==", + "version": "30.5.1", + "resolved": "https://registry.npmjs.org/@wordpress/scripts/-/scripts-30.5.1.tgz", + "integrity": "sha512-VM5NViNfdQR69MWxLnptB8svvnrEV+oUVgWL8icsLdCt2CENgPwUIk/Gs0wzeAVK05cGjrCESapJnEgIXp5lzA==", "dev": true, "requires": { "@babel/core": "7.25.7", @@ -23107,7 +23071,6 @@ "npm-package-json-lint": "^6.4.0", "npm-packlist": "^3.0.0", "postcss": "^8.4.5", - "postcss-import": "^16.1.0", "postcss-loader": "^6.2.1", "prettier": "npm:wp-prettier@3.0.3", "puppeteer-core": "^23.1.0", @@ -30491,17 +30454,6 @@ "dev": true, "requires": {} }, - "postcss-import": { - "version": "16.1.0", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-16.1.0.tgz", - "integrity": "sha512-7hsAZ4xGXl4MW+OKEWCnF6T5jqBw80/EE9aXg1r2yyn1RsVEU8EtKXbijEODa+rg7iih4bKf7vlvTGYR4CnPNg==", - "dev": true, - "requires": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - } - }, "postcss-loader": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-6.2.1.tgz", @@ -31158,23 +31110,6 @@ "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", "dev": true }, - "read-cache": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", - "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dev": true, - "requires": { - "pify": "^2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true - } - } - }, "read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", diff --git a/package.json b/package.json index e0477b1e8..6d99f1ee2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@wordpress/env": "^10.11.0", - "@wordpress/scripts": "^30.4.0", + "@wordpress/scripts": "^30.5.1", "gherkin-lint": "^4.2.4", "patch-package": "^8.0.0" }, From 3e28a047d9d21e652b83bc15b5a017cb0cc99c91 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 11 Nov 2024 11:36:11 +0545 Subject: [PATCH 18/21] Add docs for late escaping check --- .../Checks/Security/Late_Escaping_Check.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/includes/Checker/Checks/Security/Late_Escaping_Check.php b/includes/Checker/Checks/Security/Late_Escaping_Check.php index c7a7df995..61eab021e 100644 --- a/includes/Checker/Checks/Security/Late_Escaping_Check.php +++ b/includes/Checker/Checks/Security/Late_Escaping_Check.php @@ -78,4 +78,41 @@ public function get_description(): string { public function get_documentation_url(): string { return __( 'https://developer.wordpress.org/apis/security/escaping/', 'plugin-check' ); } + + /** + * Amends the given result with a message for the specified file, including error information. + * + * @since 1.3.0 + * + * @param Check_Result $result The check result to amend, including the plugin context to check. + * @param bool $error Whether it is an error or notice. + * @param string $message Error message. + * @param string $code Error code. + * @param string $file Absolute path to the file where the issue was found. + * @param int $line The line on which the message occurred. Default is 0 (unknown line). + * @param int $column The column on which the message occurred. Default is 0 (unknown column). + * @param string $docs URL for further information about the message. + * @param int $severity Severity level. Default is 5. + */ + protected function add_result_message_for_file( Check_Result $result, $error, $message, $code, $file, $line = 0, $column = 0, string $docs = '', $severity = 5 ) { + switch ( $code ) { + case 'WordPress.Security.EscapeOutput.OutputNotEscaped': + $docs = __( 'https://developer.wordpress.org/apis/security/escaping/#escaping-functions', 'plugin-check' ); + break; + + case 'WordPress.Security.EscapeOutput.UnsafePrintingFunction': + $docs = __( 'https://developer.wordpress.org/apis/security/escaping/#escaping-with-localization', 'plugin-check' ); + break; + + case 'WordPress.Security.EscapeOutput.UnsafeSearchQuery': + $docs = __( 'https://developer.wordpress.org/reference/functions/get_search_query/', 'plugin-check' ); + break; + + default: + $docs = __( 'https://developer.wordpress.org/apis/security/escaping/', 'plugin-check' ); + break; + } + + parent::add_result_message_for_file( $result, $error, $message, $code, $file, $line, $column, $docs, $severity ); + } } From b1a4e982537bec75c560aec5d498536d6d59379d Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 19 Nov 2024 12:05:27 +0545 Subject: [PATCH 19/21] Disallow HEREDOC and NOWDOC --- phpcs-rulesets/plugin-review.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpcs-rulesets/plugin-review.xml b/phpcs-rulesets/plugin-review.xml index b4d5eedec..8d1e16c4d 100644 --- a/phpcs-rulesets/plugin-review.xml +++ b/phpcs-rulesets/plugin-review.xml @@ -56,6 +56,11 @@ 7 + + + 7 + + error From a9d82c3666025cdf1ff7098832c6557fceb501d5 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 19 Nov 2024 12:11:50 +0545 Subject: [PATCH 20/21] Add test for restricting HEREDOC and NOWDOC --- .../plugins/test-plugin-review-phpcs-errors/load.php | 6 ++++++ .../Checker/Checks/Plugin_Review_PHPCS_Check_Tests.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/tests/phpunit/testdata/plugins/test-plugin-review-phpcs-errors/load.php b/tests/phpunit/testdata/plugins/test-plugin-review-phpcs-errors/load.php index 96e8669a5..ac4caf474 100644 --- a/tests/phpunit/testdata/plugins/test-plugin-review-phpcs-errors/load.php +++ b/tests/phpunit/testdata/plugins/test-plugin-review-phpcs-errors/load.php @@ -24,3 +24,9 @@ query_posts( 'cat=3' ); wp_reset_query(); + +$str = <<assertArrayHasKey( 'code', $errors['load.php'][6][1][0] ); $this->assertEquals( 'Generic.PHP.DisallowShortOpenTag.Found', $errors['load.php'][6][1][0]['code'] ); + // Check for Squiz.PHP.Heredoc.NotAllowed error on Line no 28 and column no at 8. + $this->assertEquals( 'Squiz.PHP.Heredoc.NotAllowed', $errors['load.php'][28][8][0]['code'] ); + // Check for WordPress.WP.DeprecatedFunctions.the_author_emailFound error on Line no 12 and column no at 5. $this->assertArrayHasKey( 12, $errors['load.php'] ); $this->assertArrayHasKey( 5, $errors['load.php'][12] ); From d030548fa670a059a08ed4649e5f52e2e324738b Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 19 Nov 2024 12:28:13 +0545 Subject: [PATCH 21/21] Update @wordpress/env --- package-lock.json | 15 ++++++++------- package.json | 2 +- ...10.10.0.patch => @wordpress+env+10.12.0.patch} | 0 3 files changed, 9 insertions(+), 8 deletions(-) rename patches/{@wordpress+env+10.10.0.patch => @wordpress+env+10.12.0.patch} (100%) diff --git a/package-lock.json b/package-lock.json index 46c89297f..d32c52aa6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "hasInstallScript": true, "license": "GPL-2.0-or-later", "devDependencies": { - "@wordpress/env": "^10.11.0", + "@wordpress/env": "^10.12.0", "@wordpress/scripts": "^30.5.1", "gherkin-lint": "^4.2.4", "patch-package": "^8.0.0" @@ -4448,10 +4448,11 @@ } }, "node_modules/@wordpress/env": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.11.0.tgz", - "integrity": "sha512-Sd31oiYxy9/pNMfYw7XgtCBoD4PpvcK1UQ/FVFP+DsTTuo55Ma4UAHMKfg2NhnZWqhJTgPC6XXzicGpr/lK4RQ==", + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.12.0.tgz", + "integrity": "sha512-+tsdVfngQYcysxdVonXRSwuJjqoqTSv7wwrcThCYXR1OBCMQ/xT2Ywfvf9a/yItJs5uicO9Vx8B5aIuvXiGVqg==", "dev": true, + "license": "GPL-2.0-or-later", "dependencies": { "chalk": "^4.0.0", "copy-dir": "^1.3.0", @@ -22905,9 +22906,9 @@ } }, "@wordpress/env": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.11.0.tgz", - "integrity": "sha512-Sd31oiYxy9/pNMfYw7XgtCBoD4PpvcK1UQ/FVFP+DsTTuo55Ma4UAHMKfg2NhnZWqhJTgPC6XXzicGpr/lK4RQ==", + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.12.0.tgz", + "integrity": "sha512-+tsdVfngQYcysxdVonXRSwuJjqoqTSv7wwrcThCYXR1OBCMQ/xT2Ywfvf9a/yItJs5uicO9Vx8B5aIuvXiGVqg==", "dev": true, "requires": { "chalk": "^4.0.0", diff --git a/package.json b/package.json index 6d99f1ee2..4e7460cfb 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "npm": ">=10.2.3" }, "devDependencies": { - "@wordpress/env": "^10.11.0", + "@wordpress/env": "^10.12.0", "@wordpress/scripts": "^30.5.1", "gherkin-lint": "^4.2.4", "patch-package": "^8.0.0" diff --git a/patches/@wordpress+env+10.10.0.patch b/patches/@wordpress+env+10.12.0.patch similarity index 100% rename from patches/@wordpress+env+10.10.0.patch rename to patches/@wordpress+env+10.12.0.patch