[wp-trac] [WordPress Trac] #64497: Code Modernization: Replace manual comparison logic with the spaceship operator <=>

WordPress Trac noreply at wordpress.org
Mon Jan 12 21:15:21 UTC 2026


#64497: Code Modernization: Replace manual comparison logic with the spaceship
operator <=>
-------------------------+--------------------------
 Reporter:  Soean        |       Owner:  westonruter
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  7.0
Component:  General      |     Version:
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |     Focuses:
-------------------------+--------------------------
Changes (by westonruter):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61474" 61474]:
 {{{
 #!CommitTicketReference repository="" revision="61474"
 Code Modernization: Utilize spaceship operator `<=>` in sort comparison
 logic.

 Some replaced instances also fix a bug where the comparison function
 should have returned `0` as opposed to `1` or `-1` as used in ternaries.
 This results in a performance improvement.

 Developed in https://github.com/WordPress/wordpress-develop/pull/10717

 Props soean, mukesh27, westonruter.
 Fixes #64497.
 }}}

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


More information about the wp-trac mailing list