Code Modernization: Fix PHP 8 deprecation notices for optional function parameters declared before required parameters.

As it already was not possible to pass the required parameters without also passing the optional one anyway, removing the default value for the (not so) optional parameters should not affect backward compatibility.

This change affects three functions in core:

* `get_comment_delimited_block_content()`
* `do_enclose()`
* `_wp_delete_tax_menu_item()`

Props jrf, ayeshrajans, desrosj.
Fixes #50343.

git-svn-id: https://develop.svn.wordpress.org/trunk@48794 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-08-15 13:38:52 +00:00
parent b9e5fa1077
commit 9c220ffaf7
4 changed files with 12 additions and 9 deletions

View File

@@ -830,14 +830,16 @@ function wp_extract_urls( $content ) {
* @since 1.5.0
* @since 5.3.0 The `$content` parameter was made optional, and the `$post` parameter was
* updated to accept a post ID or a WP_Post object.
* @since 5.6.0 The `$content` parameter is no longer optional, but passing `null` to skip it
* is still supported.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $content Post content. If `null`, the `post_content` field from `$post` is used.
* @param string|null $content Post content. If `null`, the `post_content` field from `$post` is used.
* @param int|WP_Post $post Post ID or post object.
* @return null|bool Returns false if post is not found.
*/
function do_enclose( $content = null, $post ) {
function do_enclose( $content, $post ) {
global $wpdb;
// @todo Tidy this code and make the debug code optional.