[wp-trac] [WordPress Trac] #63430: Coding Standards: replace isset() ternary with null coalescing
WordPress Trac
noreply at wordpress.org
Mon Dec 22 23:13:17 UTC 2025
#63430: Coding Standards: replace isset() ternary with null coalescing
-------------------------+-------------------------------
Reporter: seanwei | Owner: SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 7.0
Component: General | Version:
Severity: minor | Resolution: fixed
Keywords: has-patch | Focuses: coding-standards
-------------------------+-------------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"61403" 61403]:
{{{
#!CommitTicketReference repository="" revision="61403"
Code Modernization: Replace some `isset()` ternary checks with null
coalescing.
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.
Props seanwei, getsyash, krupalpanchal, wildworks, jorbin, SergeyBiryukov.
Fixes #63430. See #58874.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63430#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list