Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 4 letters for min prefix length #2479

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
* Minimal number of characters the prefix needs in order to be valid.
*
* @since 2.2.0
davidperezgar marked this conversation as resolved.
Show resolved Hide resolved
* @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.
davidperezgar marked this conversation as resolved.
Show resolved Hide resolved
*
* @var int
*/
const MIN_PREFIX_LENGTH = 3;
const MIN_PREFIX_LENGTH = 4;

/**
* Target prefixes.
Expand Down
10 changes: 5 additions & 5 deletions WordPress/Tests/NamingConventions/PrefixAllGlobalsUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading