feat: add WordPress 6.9 and 7.0 upgrade rule sets#14
Open
abhishek-kaushik wants to merge 1 commit into
Open
Conversation
Add WP_6_9/WP_7_0 sets and UP_TO_WP_6_9/UP_TO_WP_7_0 level sets, covering the deprecations verified against WordPress core at tags 6.9 and 7.0. Simple renames (RenameFunctionRector): - 6.9: seems_utf8 -> wp_is_valid_utf8; wp_print_auto_sizes_contain_css_fix -> wp_enqueue_img_auto_sizes_contain_css_fix - 7.0: addslashes_gpc -> wp_slash; block_core_navigation_submenu_render_submenu_icon -> block_core_shared_navigation_render_submenu_icon Add RenameFunctionWithArgumentsRector (renames a function and appends literal arguments in a single pass) for deprecations that need extra args: - 6.9: utf8_encode/utf8_decode -> mb_convert_encoding(..., charset, charset) - 7.0: block_core_navigation_block_contains_core_navigation -> block_core_navigation_block_tree_has_block_type(..., 'core/navigation') wp_sanitize_script_attributes is left as a documented TODO: it returns an attribute string while its replacements return a full <script> tag with different arguments, so no safe automatic rename exists. Includes per-version set tests, a cumulative up-to-7.0 level test, and a rule test. README updated to list 7.0 as the latest supported version.
fsylum
reviewed
Jul 13, 2026
Comment on lines
+17
to
+18
| new FunctionRenameWithArguments('utf8_encode', 'mb_convert_encoding', ['UTF-8', 'ISO-8859-1']), | ||
| new FunctionRenameWithArguments('utf8_decode', 'mb_convert_encoding', ['ISO-8859-1', 'UTF-8']), |
Owner
There was a problem hiding this comment.
@abhishek-kaushik I'd like to keep it focused on WP-specific function. Can we remove this one? If we remove this then we don't need FunctionRenameWithArguments I think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds upgrade rule sets for WordPress 6.9 and WordPress 7.0, extending the package's coverage from
0.71–6.8to0.71–7.0.Every deprecation below was verified directly against WordPress core at the
6.9and7.0tags ofwordpress-develop(the_deprecated_function()call and its named replacement), not inferred — see Verification below.New constants:
WordPressSetList::WP_6_9,WordPressSetList::WP_7_0WordPressLevelSetList::UP_TO_WP_6_9,WordPressLevelSetList::UP_TO_WP_7_0Deprecations covered
Simple renames (
RenameFunctionRector)seems_utf8()wp_is_valid_utf8()wp_print_auto_sizes_contain_css_fix()wp_enqueue_img_auto_sizes_contain_css_fix()addslashes_gpc()wp_slash()block_core_navigation_submenu_render_submenu_icon()block_core_shared_navigation_render_submenu_icon()Rename + added arguments (new
RenameFunctionWithArgumentsRector)Some replacements are not drop-in renames — they require additional arguments:
utf8_encode($x)mb_convert_encoding($x, 'UTF-8', 'ISO-8859-1')utf8_decode($x)mb_convert_encoding($x, 'ISO-8859-1', 'UTF-8')block_core_navigation_block_contains_core_navigation($blocks)block_core_navigation_block_tree_has_block_type($blocks, 'core/navigation')New rule:
RenameFunctionWithArgumentsRectorThe cases above rename a function and append arguments. This has to happen in a single pass. Chaining the core
RenameFunctionRector(rename) withParameterAdderRector(add args) would be unsafe: onceutf8_encodeis renamed tomb_convert_encoding, the arg-adder can no longer distinguish the migrated call from a pre-existingmb_convert_encoding()call already in the user's code, and would wrongly append arguments to the latter. This is the same rule-ordering hazard documented inconfig/config.php.The new rule matches the old function name, renames it, and appends configured literal arguments atomically — so it never touches pre-existing calls to the target function, and it is idempotent (re-running finds nothing to match). It is registered in the
config/config.phppreload alongside the other custom rules, following the existing convention.Intentionally left as TODO
wp_sanitize_script_attributes()(7.0) — no safe automatic transform. It returns a string of HTML attributes, whereas its suggested replacementswp_get_script_tag()/wp_get_inline_script_tag()return a complete<script>tag and take different arguments. A mechanical rename would emit broken markup, so this needs manual migration. Documented inconfig/sets/wp-7.0.php._wp_can_use_pcre_u()(6.9) — its unused$setargument was dropped, but the function is private/internal (@access private) and unlikely to appear in plugin/theme code. Documented inconfig/sets/wp-6.9.php.Tests
Wp69,Wp70UpToWp70(exercises the full0.71 → 7.0chain, extending the existingUpToWp68fixture)RenameFunctionWithArgumentsRectorAll existing checks pass locally (matching CI): PHPUnit (66 tests), Pint (PSR-12), PHPStan (level max, no errors), Rector dry-run,
composer validate,composer normalize.Verification
Deprecations were confirmed against:
wordpress-developat tags6.9and7.0—wp-includes/deprecated.php,wp-includes/compat.php,wp-includes/formatting.php,wp-includes/blocks/navigation.php,wp-includes/blocks/navigation-submenu.phpdeveloper.wordpress.orgreference pages for the individual functionsNo deprecations were found in
wp-admin/includes/deprecated.php,pluggable-deprecated.php, orms-deprecated.phpfor either version.