Skip to content

Commit

Permalink
Core: add sniffs to check there is no blank line before a function cl…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
jrfnl committed Oct 28, 2022
1 parent a47e644 commit bf049fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
</properties>
</rule>

<rule ref="PSR2.Methods.FunctionClosingBrace"/>

<!-- Check code for cross-version PHP compatibility. -->
<config name="testVersion" value="5.4-"/>
<rule ref="PHPCompatibility">
Expand Down
4 changes: 4 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@
<!-- Covers rule: Omitting the closing PHP tag at the end of a file is preferred. -->
<rule ref="PSR2.Files.ClosingTag"/>

<!-- Covers rule: There should be no trailing blank lines at the end of a function body. -->
<rule ref="PSR2.Methods.FunctionClosingBrace"/>


<!--
#############################################################################
Handbook: Formatting - Brace Style.
Expand Down

0 comments on commit bf049fd

Please sign in to comment.