• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPCSStandards / PHP_CodeSniffer / 14425323831 / 2
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 13 Apr 2025 03:16AM UTC
Files 263
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Apr 2025 02:44AM UTC coverage: 1.882%. Remained the same
14425323831.2

push

github

jrfnl
PEAR/FunctionComment: bug fix - handling of blank lines in pre-amble

The `PEAR.Commenting.FunctionComment` sniff intends to flag blank lines between a function docblock and the function declaration.

However, as things are, there are - IMO - two bugs in the logic for this:

Given a code block which looks like this:
```php
class HandleBlankLinesBetweenDocblockAndDeclarationWithAttributes
{
    /**
     * Blank line between docblock and attribute.
     *
     * @return mixed
     */

    #[ReturnTypeWillChange]

    #[

        AnotherAttribute

    ]#[AndAThirdAsWell]

    public function blankLineDetectionA()
    {

    }//end blankLineDetectionA()
}
```

There will be only one error and it will read:
```
[x] There must be no blank lines after the function comment (PEAR.Commenting.FunctionComment.SpacingAfter)
```

This is confusing as the blank line may not be after the function comment, but after an attribute instead.

Additionally, the sniff also flags blank lines _within_ attributes, while that is outside of the purview of the sniff. (Should be handled by an attribute specific sniff)

What I would expect would be for the sniff to:
a) Throw a separate error for each (set of) blank lines found.
b) For the error message to more accurately reflect what is being flagged.

> Note: while in PHPCS this gets confusing, the fixer already fixes this correctly.

This commit changes the `SpacingAfter` error to comply with the above expectations

Includes test, though there are also some pre-existing tests which show this issue and for which the behaviour is changed.

_Note: while it will still be messy, it may be easier to review this PR while ignoring whitespace changes._

466 of 24767 relevant lines covered (1.88%)

0.03 hits per line

Source Files on job cbf-os-ubuntu-latest-ubuntu-latest-php-8.4-custom-ini-false - 14425323831.2
  • Tree
  • List 263
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 14425323831
  • 2272bb60 on github
  • Prev Job for on 4.0 (#14425300012.8)
  • Next Job for on 4.0 (#14425645460.4)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc