[wp-trac] [WordPress Trac] #50343: [PHP 8] Fix deprecation notices for optional function parameters declared before required parameter.

WordPress Trac noreply at wordpress.org
Sat Aug 15 13:29:46 UTC 2020


#50343: [PHP 8] Fix deprecation notices for optional function parameters declared
before required parameter.
-------------------------------------------+-------------------------------
 Reporter:  ayeshrajans                    |       Owner:  SergeyBiryukov
     Type:  enhancement                    |      Status:  reviewing
 Priority:  normal                         |   Milestone:  5.6
Component:  General                        |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch php8 has-unit-tests  |     Focuses:  coding-standards
-------------------------------------------+-------------------------------

Comment (by SergeyBiryukov):

 [attachment:"50343-required-parameters-before-optional.patch"] looks
 great, I only have some notes on the docs:

 * `_wp_delete_tax_menu_item()` is a private function hooked to
 `delete_term`, which always passes a non-zero term ID, so it doesn't look
 like documenting "Pass the integer 0 if the object id is unknown" is
 necessary.
 * It might be a good idea to also make the `$object_id` parameter of
 `_wp_delete_post_menu_item()` required, for consistency. It's hooked to
 `delete_post`, which also always passes a non-zero post ID. Both functions
 were introduced in [14295]. Calling them without a valid object ID doesn't
 make much sense anyway.
 * `get_comment_delimited_block_content()` could use some clarification of
 the `null` value, something like: "Block name. Null if the block name is
 unknown, e.g. Classic blocks have their name set to null".

 Going to handle these adjustments on commit.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50343#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list