Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvement: Reduce use of
_wp_array_get
#5244Performance improvement: Reduce use of
_wp_array_get
#5244Changes from 2 commits
98eb9b1
9ed797f
d522626
2ff5cfc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not yet consensus to use
??
in Core. See https://core.trac.wordpress.org/ticket/58874. IMHO I think this should not yet to be introduced until its Trac ticket has consensus to move forward. Then the work here can be updated as part of that ticket.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback @hellofromtonya!
That ticket is about converting all existing
isset( $var ) ? $var : 'default'
checks in Core to use??
where appropriate. It has nothing to do with this PR - which removes unnecessary calls to_wp_array_get
. It should not be a part of that ticket... the fact that both PRs use??
is conincidental. We could convert this PR to useisset()
checks and it would be just as valuable and valid as it is now.The fact that we don't yet use
??
anywhere in Core does not mean that it's not allowed, or that it should not be used. When WordPress had to support PHP 5.6 we could not use it because we had to be compatible with that PHP version. However, "could not use" is not the same as "WordPress does not allow".The
??
operator is a part of the PHP language - just like==
or&&
. The only difference is the supported PHP versions, something which is no longer blocking us.