-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Coding Standards: replace if isset() return with null coalescing. #10703
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
westonruter
left a comment
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.
You had to find more! 😅
Might as well remove some of these extraneous line breaks while we're at it.
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.
Pull request overview
This pull request modernizes WordPress code by replacing verbose if isset() return patterns with the more concise null coalescing operator (??), improving code readability and maintainability across the codebase.
Changes:
- Refactored 21 instances across 17 files to use the null coalescing operator
- Simplified conditional return statements while maintaining identical behavior
- Reduced line count and improved code consistency
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/wp-includes/theme.php | Simplified theme feature retrieval with null coalescing |
| src/wp-includes/post.php | Streamlined post type support lookup |
| src/wp-includes/option.php | Simplified option autoload result retrieval |
| src/wp-includes/nav-menu.php | Condensed registered navigation menus getter |
| src/wp-includes/http.php | Simplified HTTP response header retrieval |
| src/wp-includes/global-styles-and-settings.php | Streamlined global styles result access |
| src/wp-includes/class-wp-user-query.php | Simplified query variable getter |
| src/wp-includes/class-wp-user-meta-session-tokens.php | Condensed session token retrieval |
| src/wp-includes/class-wp-query.php | Simplified query variable and queried object ID getters |
| src/wp-includes/class-wp-plugin-dependencies.php | Streamlined dependency data retrieval methods |
| src/wp-includes/class-wp-dependencies.php | Simplified dependency query method |
| src/wp-includes/class-wp-comment.php | Condensed child comment retrieval |
| src/wp-includes/class-wp-block-styles-registry.php | Simplified block styles retrieval |
| src/wp-admin/includes/plugin.php | Streamlined parent page file lookups with null coalescing |
| src/wp-admin/includes/file.php | Simplified action parameter initialization for upload handlers |
| src/wp-admin/includes/class-wp-screen.php | Condensed screen option retrieval |
| src/wp-admin/includes/class-wp-list-table.php | Simplified pagination argument getter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mukeshpanchal27
left a comment
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.
Thanks for the PR! The changes looks good to me.
…ator. Developed in #10703 Follow-up to [61464], [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props soean, westonruter, mukesh27. See #58874. Fixes #64488. git-svn-id: https://develop.svn.wordpress.org/trunk@61470 602fd350-edb4-49c9-b593-d223f7449a82
…ator. Developed in WordPress/wordpress-develop#10703 Follow-up to [61464], [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props soean, westonruter, mukesh27. See #58874. Fixes #64488. Built from https://develop.svn.wordpress.org/trunk@61470 git-svn-id: http://core.svn.wordpress.org/trunk@60782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…ator. Developed in WordPress/wordpress-develop#10703 Follow-up to [61464], [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props soean, westonruter, mukesh27. See #58874. Fixes #64488. Built from https://develop.svn.wordpress.org/trunk@61470 git-svn-id: https://core.svn.wordpress.org/trunk@60782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…ator. Developed in WordPress#10703 Follow-up to [61464], [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props soean, westonruter, mukesh27. See #58874. Fixes #64488. git-svn-id: https://develop.svn.wordpress.org/trunk@61470 602fd350-edb4-49c9-b593-d223f7449a82
Trac ticket: https://core.trac.wordpress.org/ticket/64488
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.