From 24cf7657181633b109e7b8f6aec5204237e64cb3 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Thu, 29 Aug 2024 22:25:47 +0200 Subject: [PATCH 1/8] update 4 letters for min prefix length --- .../Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 621ddb08a..5ef93c8b0 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -58,13 +58,13 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff { /** * Minimal number of characters the prefix needs in order to be valid. * - * @since 2.2.0 + * @since n.e.x.t. * - * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1733 Issue 1733. + * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/2467 Issue 2467. * * @var int */ - const MIN_PREFIX_LENGTH = 3; + const MIN_PREFIX_LENGTH = 4; /** * Target prefixes. From 63906877e87ff2034d3cac84e637c39ec4466c16 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Fri, 30 Aug 2024 17:40:02 +0200 Subject: [PATCH 2/8] updated based on feedbak --- WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 3 ++- .../Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 5ef93c8b0..0a80ab1d6 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -58,8 +58,9 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff { /** * Minimal number of characters the prefix needs in order to be valid. * - * @since n.e.x.t. + * @since 2.2.0 * + * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1733 Issue 1733. * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/2467 Issue 2467. * * @var int diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc index cdbe22dbc..326c8e9db 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc @@ -6,8 +6,8 @@ // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] wp function wp_do_something() {} -// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] ^%& -function ^%&_do_something() {} +// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] ^%&% +function ^%&%_do_something() {} // Now let's set the real prefixes we want to test for. // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] acronym,tgmpa From 3155500e35b42432026435188aab09b18c960d09 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Tue, 3 Sep 2024 23:50:41 +0200 Subject: [PATCH 3/8] updated since --- WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 0a80ab1d6..525c2534f 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -58,7 +58,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff { /** * Minimal number of characters the prefix needs in order to be valid. * - * @since 2.2.0 + * @since 3.2.0 * * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1733 Issue 1733. * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/2467 Issue 2467. From 455b3efa0406637e5232f2084a7648a5aeb631cf Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Wed, 4 Sep 2024 00:18:01 +0200 Subject: [PATCH 4/8] 3 prefix test --- .../Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc | 3 +++ WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc index 326c8e9db..ee01e3c73 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc @@ -674,3 +674,6 @@ class WP_Atom_Server { } // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] + +// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] ^%& +function ^%&_do_something() {} \ No newline at end of file diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php index b9beb09ff..baada4d06 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php @@ -34,7 +34,7 @@ public function getErrorList( $testFile = 'PrefixAllGlobalsUnitTest.1.inc' ) { switch ( $testFile ) { case 'PrefixAllGlobalsUnitTest.1.inc': return array( - 1 => 8, // 2 x error for blocked prefix passed. 4 x error for short prefixes. 2 x no prefix. + 1 => 9, // 2 x error for blocked prefix passed. 5 x error for short prefixes. 2 x no prefix. 10 => 1, 18 => 1, 21 => 1, @@ -96,6 +96,7 @@ public function getErrorList( $testFile = 'PrefixAllGlobalsUnitTest.1.inc' ) { 616 => 1, 617 => 1, 633 => 1, + 679 => 1, ); case 'PrefixAllGlobalsUnitTest.4.inc': From 01c30e7310cfa21d52802e54b38120578fc78190 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Wed, 4 Sep 2024 21:56:19 +0200 Subject: [PATCH 5/8] updated since --- WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 525c2534f..3d1af21b5 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -59,6 +59,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff { * Minimal number of characters the prefix needs in order to be valid. * * @since 3.2.0 + * @since 2.2.0 * * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1733 Issue 1733. * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/2467 Issue 2467. From a4456ad83fef77cb9efece5fc214ca6613dff8b5 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Wed, 4 Sep 2024 22:05:42 +0200 Subject: [PATCH 6/8] updated tests --- .../Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc | 6 +++--- .../Tests/NamingConventions/PrefixAllGlobalsUnitTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc index ee01e3c73..5972f493c 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc @@ -673,7 +673,7 @@ class WP_Atom_Server { } } -// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] +// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] tod +function tod_something() {} -// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] ^%& -function ^%&_do_something() {} \ No newline at end of file +// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php index baada4d06..beb4c0fc6 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php @@ -96,7 +96,7 @@ public function getErrorList( $testFile = 'PrefixAllGlobalsUnitTest.1.inc' ) { 616 => 1, 617 => 1, 633 => 1, - 679 => 1, + 677 => 1, ); case 'PrefixAllGlobalsUnitTest.4.inc': From 406c8df75d80c414e1184458a7c8d6e835110e5d Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Thu, 5 Sep 2024 10:11:50 +0200 Subject: [PATCH 7/8] update version tag --- WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 3d1af21b5..f6ed8f3dc 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -58,8 +58,8 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff { /** * Minimal number of characters the prefix needs in order to be valid. * - * @since 3.2.0 * @since 2.2.0 + * @since 3.2.0 The minimum number of characters was raised from 3 to 4. * * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1733 Issue 1733. * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/2467 Issue 2467. From 3650b7c47adf1c522b9c19945b34ec048ba7c0c0 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Thu, 5 Sep 2024 19:17:27 +0200 Subject: [PATCH 8/8] updated prefix globals --- .../NamingConventions/PrefixAllGlobalsUnitTest.1.inc | 9 +++------ .../Tests/NamingConventions/PrefixAllGlobalsUnitTest.php | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc index 5972f493c..842aa1a27 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc @@ -511,13 +511,13 @@ function aa_do_something(){} // The following line mimics an empty prefix value. // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] , -function aaa_do_something(){} +function aaaa_do_something(){} // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] 😊 function 😊_do_something(){} -// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] 😊😊 -function 😊😊_do_something(){} +// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] 😊😊😊 +function 😊😊😊_do_something(){} // Reset to the standard test prefixes. // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] acronym,tgmpa @@ -673,7 +673,4 @@ class WP_Atom_Server { } } -// phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] tod -function tod_something() {} - // phpcs:set WordPress.NamingConventions.PrefixAllGlobals prefixes[] diff --git a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php index beb4c0fc6..b9beb09ff 100644 --- a/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php +++ b/WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.php @@ -34,7 +34,7 @@ public function getErrorList( $testFile = 'PrefixAllGlobalsUnitTest.1.inc' ) { switch ( $testFile ) { case 'PrefixAllGlobalsUnitTest.1.inc': return array( - 1 => 9, // 2 x error for blocked prefix passed. 5 x error for short prefixes. 2 x no prefix. + 1 => 8, // 2 x error for blocked prefix passed. 4 x error for short prefixes. 2 x no prefix. 10 => 1, 18 => 1, 21 => 1, @@ -96,7 +96,6 @@ public function getErrorList( $testFile = 'PrefixAllGlobalsUnitTest.1.inc' ) { 616 => 1, 617 => 1, 633 => 1, - 677 => 1, ); case 'PrefixAllGlobalsUnitTest.4.inc':