Make WordPress Core


Ignore:
Timestamp:
08/15/2020 01:38:52 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r48695 r48794  
    831831 * @since 5.3.0 The `$content` parameter was made optional, and the `$post` parameter was
    832832 *              updated to accept a post ID or a WP_Post object.
     833 * @since 5.6.0 The `$content` parameter is no longer optional, but passing `null` to skip it
     834 *              is still supported.
    833835 *
    834836 * @global wpdb $wpdb WordPress database abstraction object.
    835837 *
    836  * @param string      $content Post content. If `null`, the `post_content` field from `$post` is used.
     838 * @param string|null $content Post content. If `null`, the `post_content` field from `$post` is used.
    837839 * @param int|WP_Post $post    Post ID or post object.
    838840 * @return null|bool Returns false if post is not found.
    839841 */
    840 function do_enclose( $content = null, $post ) {
     842function do_enclose( $content, $post ) {
    841843    global $wpdb;
    842844
Note: See TracChangeset for help on using the changeset viewer.