[wp-trac] [WordPress Trac] #64488: Coding Standards: replace if isset() return with null coalescing

WordPress Trac noreply at wordpress.org
Fri Jan 9 14:27:54 UTC 2026


#64488: Coding Standards: replace if isset() return with null coalescing
------------------------------+-----------------------------
 Reporter:  Soean             |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 In #63430 isset() ternary were replaced with null coalescing.

 We also should replace if isset() return with null coalescing.

 {{{#!php
 <?php
 -        if (isset($this->items[$key])) {
 -            return $this->items[$key];
 -        }
 -
 -        return 'fallback value';
 +        return $this->items[$key] ?? 'fallback value';
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64488>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list