diff --git a/WordPress-Extra/ruleset.xml b/WordPress-Extra/ruleset.xml index 068162bf9..2f10ba81d 100644 --- a/WordPress-Extra/ruleset.xml +++ b/WordPress-Extra/ruleset.xml @@ -129,7 +129,7 @@ - + diff --git a/WordPress/AbstractValidSlugSniff.php b/WordPress/AbstractValidSlugSniff.php index 4769f77d0..0b56e47ad 100644 --- a/WordPress/AbstractValidSlugSniff.php +++ b/WordPress/AbstractValidSlugSniff.php @@ -19,7 +19,7 @@ * Validates names passed to a function call. * * Checks slugs for the presence of invalid characters, excessive length, - * and reserved keywords. + * and reserved names. */ abstract class AbstractValidSlugSniff extends AbstractFunctionParameterSniff { diff --git a/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml b/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml index 639dda54e..f770b6870 100644 --- a/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml +++ b/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml @@ -11,17 +11,17 @@ 'my_short_slug', - array() +register_post_type( + 'my_short_slug', + array() ); ]]> 'my_own_post_type_too_long', - array() +register_post_type( + 'my_own_post_type_too_long', + array() ); ]]> @@ -34,17 +34,17 @@ register_post_type( 'my_post_type_slug', - array() +register_post_type( + 'my_post_type_slug', + array() ); ]]> 'my/post/type/slug', - array() +register_post_type( + 'my/post/type/slug', + array() ); ]]> @@ -57,40 +57,40 @@ register_post_type( 'my_post_active', - array() +register_post_type( + 'my_post_active', + array() ); ]]> "my_post_{$status}", - array() +register_post_type( + "my_post_{$status}", + array() ); ]]> 'prefixed_author', - array() +register_post_type( + 'prefixed_author', + array() ); ]]> - + 'author', - array() +register_post_type( + 'author', + array() ); ]]> @@ -103,17 +103,17 @@ register_post_type( 'prefixed_author', - array() +register_post_type( + 'prefixed_author', + array() ); ]]> 'wp_author', - array() +register_post_type( + 'wp_author', + array() ); ]]> diff --git a/WordPress/Helpers/WPReservedNamesHelper.php b/WordPress/Helpers/WPReservedNamesHelper.php index 80b66d78c..b518b0f0f 100644 --- a/WordPress/Helpers/WPReservedNamesHelper.php +++ b/WordPress/Helpers/WPReservedNamesHelper.php @@ -10,7 +10,7 @@ namespace WordPressCS\WordPress\Helpers; /** - * Helper utilities for recognizing WP reserved keywords. + * Helper utilities for recognizing WP reserved names. */ final class WPReservedNamesHelper { /** @@ -143,26 +143,24 @@ final class WPReservedNamesHelper { ); /** - * Verify if a given keyword is a reserved post type name. + * Verify if a given name is a reserved post type name. * - * @param string $name The keyword to be checked. + * @param string $name The name to be checked. * * @return bool */ public static function is_reserved_post_type( $name ) { - return isset( self::$post_types[ $name ] ); } /** - * Verify if a given keyword is a reserved taxonomy name. + * Verify if a given name is a reserved taxonomy name. * - * @param string $name The keyword to be checked. + * @param string $name The name to be checked. * * @return bool */ public static function is_reserved_term( $name ) { - return isset( self::$terms[ $name ] ) || isset( self::$post_types[ $name ] ); } diff --git a/WordPress/Tests/NamingConventions/ValidPostTypeSlugUnitTest.1.inc b/WordPress/Tests/NamingConventions/ValidPostTypeSlugUnitTest.1.inc index 5c0ed5729..c994383ea 100644 --- a/WordPress/Tests/NamingConventions/ValidPostTypeSlugUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/ValidPostTypeSlugUnitTest.1.inc @@ -49,7 +49,7 @@ EOD register_post_type( "my-own-post-type-too-long-{$i}" ); // 1x Error, Too long. 1x Warning, post type may or may not get too long with dynamic contents in the id. register_post_type( 'my/own/post/type/too/long', array() ); // Bad. Invalid chars: "/" and too long. -register_post_type( 'wp_block', array() ); // Bad. Must only error on reserved keyword, not invalid prefix. +register_post_type( 'wp_block', array() ); // Bad. Must only error on reserved name, not invalid prefix. // Test handling of more complex embedded variables and expressions. register_post_type("testing123-${(foo)}-test"); diff --git a/WordPress/Tests/NamingConventions/ValidTaxonomySlugUnitTest.1.inc b/WordPress/Tests/NamingConventions/ValidTaxonomySlugUnitTest.1.inc index 42a5c2b5d..f647cfb63 100644 --- a/WordPress/Tests/NamingConventions/ValidTaxonomySlugUnitTest.1.inc +++ b/WordPress/Tests/NamingConventions/ValidTaxonomySlugUnitTest.1.inc @@ -49,7 +49,7 @@ EOD register_taxonomy( "my-own-taxonomy-toooooooooo-long-{$i}" ); // 1x Error, Too long. 1x Warning, post type may or may not get too long with dynamic contents in the id. register_taxonomy( 'my/own/taxonomy/tooooooooooo/long', array() ); // Bad. Invalid chars: "/" and too long. -register_taxonomy( 'wp_block', array() ); // Bad. Must only error on reserved keyword, not invalid prefix. +register_taxonomy( 'wp_block', array() ); // Bad. Must only error on reserved name, not invalid prefix. // Test handling of more complex embedded variables and expressions. register_taxonomy("testing123-${(foo)}-test");