Skip to content

Update list based sniffs for WP 6.5 #2436

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

Merged
merged 6 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion WordPress/Helpers/MinimumWPVersionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ trait MinimumWPVersionTrait {
*
* @var string WordPress version.
*/
private $default_minimum_wp_version = '6.0';
private $default_minimum_wp_version = '6.2';

/**
* Overrule the minimum supported WordPress version with a command-line/config value.
Expand Down
12 changes: 11 additions & 1 deletion WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
* Only overrulable constants are listed, i.e. those defined within core within
* a `if ( ! defined() ) {}` wrapper.
*
* Last update: July 2023 for WP 6.3 at https://github.com/WordPress/wordpress-develop/commit/6281ce432c50345a57768bf53854d9b65b6cdd52
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 1.0.0
* @since 3.0.0 Renamed from `$whitelisted_core_constants` to `$allowed_core_constants`.
Expand Down Expand Up @@ -201,6 +201,8 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
*
* Note: deprecated functions should still be included in this list as plugins may support older WP versions.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0.
*
* @var array<string, true> Key is function name, value irrelevant.
Expand Down Expand Up @@ -236,6 +238,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
'twentyeleven_comment' => true,
'twentyeleven_content_nav' => true,
'twentyeleven_continue_reading_link' => true,
'twentyeleven_header_image' => true,
'twentyeleven_header_style' => true,
'twentyeleven_posted_on' => true,
'twentyeleven_setup' => true,
Expand All @@ -255,6 +258,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
'twentyfourteen_admin_header_style' => true,
'twentyfourteen_excerpt_more' => true,
'twentyfourteen_font_url' => true,
'twentyfourteen_header_image' => true,
'twentyfourteen_header_style' => true,
'twentyfourteen_list_authors' => true,
'twentyfourteen_paging_nav' => true,
Expand Down Expand Up @@ -296,6 +300,7 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
'twentyten_admin_header_style' => true,
'twentyten_comment' => true,
'twentyten_continue_reading_link' => true,
'twentyten_header_image' => true,
'twentyten_posted_in' => true,
'twentyten_posted_on' => true,
'twentyten_setup' => true,
Expand All @@ -317,6 +322,9 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
'twentytwenty_get_customizer_css' => true,
'twentytwenty_get_theme_svg' => true,
'twentytwenty_the_theme_svg' => true,
'twentytwentyfour_block_styles' => true,
'twentytwentyfour_block_stylesheets' => true,
'twentytwentyfour_pattern_categories' => true,
'twentytwentytwo_styles' => true,
'twentytwentytwo_support' => true,
'wp_authenticate' => true,
Expand Down Expand Up @@ -374,6 +382,8 @@ final class PrefixAllGlobalsSniff extends AbstractFunctionParameterSniff {
*
* Note: deprecated classes should still be included in this list as plugins may support older WP versions.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0.
*
* @var array<string, true> Key is class name, value irrelevant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final class ValidPostTypeSlugSniff extends AbstractFunctionParameterSniff {
*
* Source: {@link https://developer.wordpress.org/reference/functions/register_post_type/#reserved-post-types}
*
* Last update: July 2023 for WP 6.3 at https://github.com/WordPress/wordpress-develop/commit/6281ce432c50345a57768bf53854d9b65b6cdd52
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 2.2.0
*
Expand All @@ -84,6 +84,8 @@ final class ValidPostTypeSlugSniff extends AbstractFunctionParameterSniff {
'theme' => true, // Not a WP post type, but prevents other problems.
'user_request' => true,
'wp_block' => true,
'wp_font_face' => true,
'wp_font_family' => true,
'wp_global_styles' => true,
'wp_navigation' => true,
'wp_template' => true,
Expand Down
76 changes: 69 additions & 7 deletions WordPress/Sniffs/WP/ClassNameCaseSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand Down Expand Up @@ -121,6 +121,8 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Application_Passwords_List_Table',
'WP_Automatic_Updater',
'WP_Block',
'WP_Block_Bindings_Registry',
'WP_Block_Bindings_Source',
'WP_Block_Editor_Context',
'WP_Block_List',
'WP_Block_Parser',
Expand Down Expand Up @@ -192,10 +194,21 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Filesystem_FTPext',
'WP_Filesystem_SSH2',
'WP_Filesystem_ftpsockets',
'WP_Font_Collection',
'WP_Font_Face',
'WP_Font_Face_Resolver',
'WP_Font_Library',
'WP_Font_Utils',
'WP_HTML_Active_Formatting_Elements',
'WP_HTML_Attribute_Token',
'WP_HTML_Open_Elements',
'WP_HTML_Processor',
'WP_HTML_Processor_State',
'WP_HTML_Span',
'WP_HTML_Tag_Processor',
'WP_HTML_Text_Replacement',
'WP_HTML_Token',
'WP_HTML_Unsupported_Exception',
'WP_HTTP_Fsockopen',
'WP_HTTP_IXR_Client',
'WP_HTTP_Proxy',
Expand All @@ -212,6 +225,8 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Image_Editor_GD',
'WP_Image_Editor_Imagick',
'WP_Importer',
'WP_Interactivity_API',
'WP_Interactivity_API_Directives_Processor',
'WP_Internal_Pointers',
'WP_Links_List_Table',
'WP_List_Table',
Expand All @@ -226,11 +241,13 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Meta_Query',
'WP_Metadata_Lazyloader',
'WP_Nav_Menu_Widget',
'WP_Navigation_Block_Renderer',
'WP_Navigation_Fallback',
'WP_Network',
'WP_Network_Query',
'WP_Object_Cache',
'WP_Paused_Extensions_Storage',
'WP_Plugin_Dependencies',
'WP_Plugin_Install_List_Table',
'WP_Plugins_List_Table',
'WP_Post',
Expand All @@ -257,6 +274,9 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_REST_Comments_Controller',
'WP_REST_Controller',
'WP_REST_Edit_Site_Export_Controller',
'WP_REST_Font_Collections_Controller',
'WP_REST_Font_Faces_Controller',
'WP_REST_Font_Families_Controller',
'WP_REST_Global_Styles_Controller',
'WP_REST_Global_Styles_Revisions_Controller',
'WP_REST_Menu_Items_Controller',
Expand All @@ -282,6 +302,8 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_REST_Sidebars_Controller',
'WP_REST_Site_Health_Controller',
'WP_REST_Taxonomies_Controller',
'WP_REST_Template_Autosaves_Controller',
'WP_REST_Template_Revisions_Controller',
'WP_REST_Templates_Controller',
'WP_REST_Term_Meta_Fields',
'WP_REST_Term_Search_Handler',
Expand All @@ -301,6 +323,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Role',
'WP_Roles',
'WP_Screen',
'WP_Script_Modules',
'WP_Scripts',
'WP_Session_Tokens',
'WP_Sidebar_Block_Editor_Control',
Expand Down Expand Up @@ -341,6 +364,11 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
'WP_Theme_JSON_Resolver',
'WP_Theme_JSON_Schema',
'WP_Themes_List_Table',
'WP_Translation_Controller',
'WP_Translation_File',
'WP_Translation_File_MO',
'WP_Translation_File_PHP',
'WP_Translations',
'WP_Upgrader',
'WP_Upgrader_Skin',
'WP_User',
Expand Down Expand Up @@ -384,7 +412,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand Down Expand Up @@ -412,11 +440,33 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
);

/**
* List of all GetID3 classes include in WP Core.
* List of all AVIF classes included in WP Core.
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.1.0
*
* @var string[] The class names in their "proper" case.
* The constructor will add the lowercased class name as a key to each entry.
*/
private $avif_classes = array(
'Avifinfo\\Box',
'Avifinfo\\Chan_Prop',
'Avifinfo\\Dim_Prop',
'Avifinfo\\Features',
'Avifinfo\\Parser',
'Avifinfo\\Prop',
'Avifinfo\\Tile',
);

/**
* List of all GetID3 classes included in WP Core.
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand Down Expand Up @@ -452,7 +502,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand All @@ -470,7 +520,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand Down Expand Up @@ -614,7 +664,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*
* Note: this list will be enhanced in the class constructor.
*
* {@internal To be updated after every major release. Last updated for WordPress 6.3-RC1.}
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @since 3.0.0
*
Expand Down Expand Up @@ -684,6 +734,17 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
*/
private $wp_themes_classes_lc = array();

/**
* List of all AVIF classes in lowercase.
*
* This array is automatically generated in the class constructor based on the $avif_classes property.
*
* @since 3.1.0
*
* @var string[] The class names in lowercase.
*/
private $avif_classes_lc = array();

/**
* List of all GetID3 classes in lowercase.
*
Expand Down Expand Up @@ -740,6 +801,7 @@ final class ClassNameCaseSniff extends AbstractClassRestrictionsSniff {
private $class_groups = array(
'wp_classes',
'wp_themes_classes',
'avif_classes',
'getid3_classes',
'phpmailer_classes',
'requests_classes',
Expand Down
12 changes: 11 additions & 1 deletion WordPress/Sniffs/WP/DeprecatedClassesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class DeprecatedClassesSniff extends AbstractClassRestrictionsSniff {
*
* Version numbers should be fully qualified.
*
* Last update: July 2023 for WP 6.3 at https://github.com/WordPress/wordpress-develop/commit/6281ce432c50345a57768bf53854d9b65b6cdd52
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @var array
*/
Expand Down Expand Up @@ -84,6 +84,16 @@ final class DeprecatedClassesSniff extends AbstractClassRestrictionsSniff {
'alt' => 'The PHP native JSON extension',
'version' => '5.3.0',
),

// WP 6.4.0.
'WP_Http_Curl' => array(
'alt' => 'WP_Http',
'version' => '6.4.0',
),
'WP_Http_Streams' => array(
'alt' => 'WP_Http',
'version' => '6.4.0',
),
);

/**
Expand Down
61 changes: 58 additions & 3 deletions WordPress/Sniffs/WP/DeprecatedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ final class DeprecatedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
/**
* List of deprecated functions with alternative when available.
*
* To be updated after every major release.
* Last updated for WordPress 6.3.
*
* Version numbers should be fully qualified.
* Replacement functions should have parentheses.
*
* To retrieve a function list for comparison, the following tool is available:
* https://github.com/JDGrimes/wp-deprecated-code-scanner
*
* {@internal To be updated after every major release. Last updated for WordPress 6.5-RC3.}
*
* @var array
*/
private $deprecated_functions = array(
Expand Down Expand Up @@ -1597,6 +1596,62 @@ final class DeprecatedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
'alt' => '',
'version' => '6.3.0',
),

// WP 6.4.0.
'_admin_bar_bump_cb' => array(
'alt' => 'wp_enqueue_admin_bar_bump_styles()',
'version' => '6.4.0',
),
'_inject_theme_attribute_in_block_template_content' => array(
'alt' => 'traverse_and_serialize_blocks( parse_blocks( $template_content ), \'_inject_theme_attribute_in_template_part_block\' )',
'version' => '6.4.0',
),
'_remove_theme_attribute_in_block_template_content' => array(
'alt' => 'traverse_and_serialize_blocks( parse_blocks( $template_content ), \'_remove_theme_attribute_from_template_part_block\' )',
'version' => '6.4.0',
),
'_wp_theme_json_webfonts_handler' => array(
'alt' => 'wp_print_font_faces()',
'version' => '6.4.0',
),
'print_embed_styles' => array(
'alt' => 'wp_enqueue_embed_styles()',
'version' => '6.4.0',
),
'print_emoji_styles' => array(
'alt' => 'wp_enqueue_emoji_styles()',
'version' => '6.4.0',
),
'the_block_template_skip_link' => array(
'alt' => 'wp_enqueue_block_template_skip_link()',
'version' => '6.4.0',
),
'wp_admin_bar_header' => array(
'alt' => 'wp_enqueue_admin_bar_header_styles()',
'version' => '6.4.0',
),
'wp_img_tag_add_decoding_attr' => array(
'alt' => 'wp_img_tag_add_loading_optimization_attrs()',
'version' => '6.4.0',
),
'wp_update_https_detection_errors' => array(
'alt' => 'wp_get_https_detection_errors()',
'version' => '6.4.0',
),

// WP 6.5.0.
'block_core_file_ensure_interactivity_dependency' => array(
'alt' => 'wp_register_script_module()',
'version' => '6.5.0',
),
'block_core_image_ensure_interactivity_dependency' => array(
'alt' => 'wp_register_script_module()',
'version' => '6.5.0',
),
'block_core_query_ensure_interactivity_dependency' => array(
'alt' => 'wp_register_script_module()',
'version' => '6.5.0',
),
);

/**
Expand Down
Loading
Loading