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

PHPCSStandards / PHP_CodeSniffer / 14425323831
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: catch-per-3.0
DEFAULT BRANCH: master
Ran 13 Apr 2025 02:47AM UTC
Jobs 8
Files 263
Run time 1min
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: 77.561% (+0.004%) from 77.557%
14425323831

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._

18 of 18 new or added lines in 1 file covered. (100.0%)

19350 of 24948 relevant lines covered (77.56%)

78.89 hits per line

Jobs
ID Job ID Ran Files Coverage
1 os-windows-latest-php-7.2-custom-ini-false - 14425323831.1 13 Apr 2025 02:47AM UTC 263
2.1
GitHub Action Run
2 cbf-os-ubuntu-latest-ubuntu-latest-php-8.4-custom-ini-false - 14425323831.2 13 Apr 2025 02:50AM UTC 263
1.88
GitHub Action Run
3 os-windows-latest-php-8.4-custom-ini-false - 14425323831.3 13 Apr 2025 02:47AM UTC 263
2.64
GitHub Action Run
4 cbf-os-ubuntu-latest-ubuntu-latest-php-8.1-custom-ini-true - 14425323831.4 13 Apr 2025 02:51AM UTC 263
1.89
GitHub Action Run
5 cbf-os-ubuntu-latest-ubuntu-latest-php-7.2-custom-ini-false - 14425323831.5 13 Apr 2025 02:52AM UTC 263
0.81
GitHub Action Run
6 os-ubuntu-latest-php-8.1-custom-ini-true - 14425323831.6 13 Apr 2025 02:51AM UTC 263
76.07
GitHub Action Run
7 os-ubuntu-latest-php-7.2-custom-ini-false - 14425323831.7 13 Apr 2025 02:52AM UTC 263
73.9
GitHub Action Run
8 os-ubuntu-latest-php-8.4-custom-ini-false - 14425323831.8 13 Apr 2025 02:50AM UTC 263
76.04
GitHub Action Run
Source Files on build 14425323831
  • Tree
  • List 263
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14425323831
  • 2272bb60 on github
  • Prev Build on 4.0 (#14425300012)
  • Next Build on 4.0 (#14425645460)
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