[wp-trac] [WordPress Trac] #63216: simplify get_role() method in WP_Roles class

WordPress Trac noreply at wordpress.org
Tue Dec 23 21:19:14 UTC 2025


#63216: simplify get_role() method in WP_Roles class
-----------------------------+-------------------------------
 Reporter:  dilipbheda       |       Owner:  SergeyBiryukov
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch        |     Focuses:  coding-standards
-----------------------------+-------------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61404" 61404]:
 {{{
 #!CommitTicketReference repository="" revision="61404"
 Code Modernization: Replace `isset()` with null coalescing in
 `WP_Roles::get_role()`.

 Since PHP 7.0 introduced the [https://www.php.net/manual/en/migration70
 .new-features.php#migration70.new-features.null-coalesce-op null
 coalescing operator], and WordPress now requires at least PHP 7.2.24,
 `isset( $var ) ? $var : null` ternary checks can be safely replaced with
 the more concise `$var ?? null` syntax.

 As some new code using the null coalescing operator has already been
 introduced into core in recent releases, this commit continues with the
 code modernization by implementing incremental changes for easier review.

 Follow-up to [2703], [61403].

 Props dilipbheda, mukesh27, spacedmonkey, SergeyBiryukov.
 Fixes #63216. See #58874.
 }}}

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


More information about the wp-trac mailing list