Describe the bug
Since version 3.12.0 PHP CodeSniffer complains about missing blank lines before a function.
You can see the minimalized code example below. There are clearly blank lines before the function.
Additionally it is the first function and due to the rule it also shouldn't complain.
Also see discussion
Code sample
<?php
/**
* Description of file
*
* @package foo
*/
/**
* Description of function
*/
function foo($x)
{
}
Custom ruleset
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PHPCS rule set">
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacingBeforeFirst" value="0" />
<property name="spacingAfterLast" value="0" />
</properties>
</rule>
</ruleset>
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php with the code sample above...
- Run
phpcs test.php ...
- See error message displayed
foo.php:12:1: error - Expected 2 blank lines before function; 0 found
Expected behavior
With the code example CodeSniffer should not complain about missing blank lines.
Versions (please complete the following information)
|
|
| Operating System |
[Linux Manjaro] |
| PHP version |
[8.3] |
| PHP_CodeSniffer version |
[3.12.0] |
| Standard |
[Squiz] |
| Install type |
[PHAR] |
Additional context
This behaviour ist since version 3.12.0!
With version 3.11.3 this was not an issue.
Please confirm
Describe the bug
Since version 3.12.0 PHP CodeSniffer complains about missing blank lines before a function.
You can see the minimalized code example below. There are clearly blank lines before the function.
Additionally it is the first function and due to the rule it also shouldn't complain.
Also see discussion
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.phpwith the code sample above...phpcs test.php ...Expected behavior
With the code example CodeSniffer should not complain about missing blank lines.
Versions (please complete the following information)
Additional context
This behaviour ist since version 3.12.0!
With version 3.11.3 this was not an issue.
Please confirm
masterbranch of PHP_CodeSniffer.