Skip to content

Commit

Permalink
WP/DeprecatedFunctions: update the functions list based on WP 6.5-RC3
Browse files Browse the repository at this point in the history
Based on a scan of WP Core at commit WordPress/wordpress-develop@3595704 using a preliminary sniff created for issue 1803.

Includes tests.
  • Loading branch information
jrfnl committed Mar 21, 2024
1 parent 8b1ef9b commit 16d40a0
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 5 deletions.
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
15 changes: 15 additions & 0 deletions WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,18 @@ wp_tinycolor_hsl_to_rgb();
wp_tinycolor_hue_to_rgb();
wp_tinycolor_rgb_to_rgb();
wp_tinycolor_string_to_rgb();
/* ============ WP 6.4 ============ */
_admin_bar_bump_cb();
_inject_theme_attribute_in_block_template_content();
_remove_theme_attribute_in_block_template_content();
_wp_theme_json_webfonts_handler();
print_embed_styles();
print_emoji_styles();
the_block_template_skip_link();
wp_admin_bar_header();
wp_img_tag_add_decoding_attr();
wp_update_https_detection_errors();
/* ============ WP 6.5 ============ */
block_core_file_ensure_interactivity_dependency();
block_core_image_ensure_interactivity_dependency();
block_core_query_ensure_interactivity_dependency();
6 changes: 4 additions & 2 deletions WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getErrorList() {
*/
public function getWarningList() {
$start_line = 368;
$end_line = 413;
$end_line = 428;
$warnings = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 );

// Unset the lines related to version comments.
Expand All @@ -95,7 +95,9 @@ public function getWarningList() {
$warnings[375],
$warnings[377],
$warnings[387],
$warnings[390]
$warnings[390],
$warnings[414],
$warnings[425]
);

return $warnings;
Expand Down

0 comments on commit 16d40a0

Please sign in to comment.