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

Loosely related to WordPress#1101
  • Loading branch information
jrfnl committed Aug 18, 2022
1 parent e656047 commit de9bf84
Show file tree
Hide file tree
Showing 2 changed files with 3 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
3 changes: 3 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
<!-- Covers rule: Assigning the return value of an object instantiation by reference is not allowed. -->
<!-- Not checked. This is a parse error since PHP 7.0. See: https://3v4l.org/W2Qj6 -->

<!-- Covers rule: There should be no blank line between the content of a function and the function's closing brace. -->
<rule ref="PSR2.Methods.FunctionClosingBrace"/>




Expand Down

0 comments on commit de9bf84

Please sign in to comment.