-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update docs to avoid recommending early return PHP "anti-pattern" #58454
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/README.md |
Flaky tests detected in 1127a5d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7713081919
|
Noting that some of the Fonts Library classes use this pattern. |
Possible overlap/duplication with #58500 |
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.
This PR looks good to me, except for the small issue mentioned below. I don't think it duplicates anything.
Considering the ongoing work on implementing a slightly different approach as outlined in #58467, the documentation might need to be updated again soon.
However, updating the documentation is always a good idea, in my opinion.
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 SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
I'm sorry for being too picky, but I have another request.
Could the documentation specify more clearly that the issue stems from the usage of the return
operator, rather than the return early
pattern as a whole?
I'm afraid this might be misunderstood as discouraging the entire return early
pattern, which isn't the case, as early returns can improve code clarity as outlined here.
Co-authored-by: Anton Vlasenko <43744263+anton-vlasenko@users.noreply.github.com>
Co-authored-by: Anton Vlasenko <43744263+anton-vlasenko@users.noreply.github.com>
27b1a74
to
3d27476
Compare
Pickiness is never a bad thing when it comes to accurate documentation 😄 Thank you! I've marked to auto-merge. |
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.
LGTM!
PHPUnit failures are not related to this PR and have been fixed on |
What?
Updates PHP in Gutenberg docs to avoid recommending a pattern that could cause problems for older versions of PHP.
See #58429 (comment).
Why?
#58429 (comment)
How?
Updates docs.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast