[wp-trac] [WordPress Trac] #53635: PHP 8.1: various compatibility fixes

WordPress Trac noreply at wordpress.org
Tue Aug 3 11:01:04 UTC 2021


#53635: PHP 8.1: various compatibility fixes
----------------------------+-------------------------------
 Reporter:  SergeyBiryukov  |       Owner:  (none)
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  5.9
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  php81           |     Focuses:  coding-standards
----------------------------+-------------------------------

Comment (by SergeyBiryukov):

 In [changeset:"51530" 51530]:
 {{{
 #!CommitTicketReference repository="" revision="51530"
 Code Modernization: Silence the deprecation warnings for missing return
 type in `WP_Hook`.

 This fixes the "Deprecated: Return type of `WP_Hook::[METHODNAME]()`
 should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on
 PHP 8.1.

 PHP native interfaces now have declared return types and methods in
 classes implementing these interfaces need to either have the return type
 declared (in a covariant compatible manner with the PHP native interface
 method declaration), or need to silence the deprecation warning using the
 `#[ReturnTypeWillChange]` attribute.

 Follow-up to [51517], [51529].

 Props jrf.
 See #53635.
 }}}

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


More information about the wp-trac mailing list