-
Notifications
You must be signed in to change notification settings - Fork 189
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
Function closing brace #110
Conversation
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 wonder if this should have an explicit separate section or if we could add this to one of the pre-existing sections.
Looking at the pre-existing sections, there are a couple of potential places where this could be added:
- Space usage - though feels a bit odd as it would be the only one regarding blank lines.
- Remove Trailing Spaces - in this case, it's a about trailing new lines, but not necessarily a bad match.
- Brace style - doesn't feel right as the section is more about control structures with optional braces, while this rule is about function declarations. Adding it there could give the impression that the rule is not just about function declarations.
So, "Remove trailing spaces" seems the most appropriate one.
An extra paragraph there stating "there should be no trailing blank lines at the end of a function body" should suffice IMO.
I also think we can leave out the code sample as it's pretty clear what that means.
b650342
to
da9ba4f
Compare
Co-authored-by: Juliette <[email protected]>
f4387fa
to
46560be
Compare
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
Merging this now as @GaryJones is AFK for the next few weeks. If needs be, additional textual tweaks can still be made in a follow up commit.
…ose brace > 1. There should be no blank line between the content of a function and the function’s closing brace. Includes removing this rule from the WPCS native ruleset in which we already enforced it (as it will now be inherited from the `WordPress` ruleset). Refs: * https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php/ - Function closing brace section * https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#remove-trailing-spaces * WordPress/wpcs-docs#110 Loosely related to #1101
This PR depends on #109. Once that is merged, this PR should be rebased to the master branch.
The PR adds rules about the function closing brace and is the continuation of the additions of 'modern' PHP code in the WordPress PHP Coding Standards handbook based on the make post by Juliette Reinders Folmer.