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

PHPCSStandards / PHP_CodeSniffer / 7828520497
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 08 Feb 2024 10:59AM UTC
Jobs 3
Files 259
Run time 31s
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

08 Feb 2024 10:55AM UTC coverage: 72.052% (+0.04%) from 72.015%
7828520497

push

github

jrfnl
PHP 8.3 | PSR12/ClassInstantiation: allow for readonly anonymous classes

The sniff is supposed to ignore anonymous class instantiations completely as otherwise it could create a conflict between this sniff and the PSR12 sniff checking anonymous class declarations.

As things were, however, the sniff would add parentheses after the `new` keyword or after an attribute if an anonymous class was declared as `readonly`, as allowed since PHP 8.3.

Fixed now.

Includes minor simplification - the sniff would previously _jump over_ attributes attached to anonymous classes to get to the `class` keyword only to bow out later for anonymous classes anyway.
Now, the sniff will bow out straight away when either an attribute, the `readonly` keyword or the `class` keyword for an anonymous class declaration is encountered.

As `readonly` cannot be used as class name and attributes cannot be attached to (non-anonymous) class instantiations, this should maintain the previous behaviour, while also allowing for PHP 8.3 readonly anonymous classes and it should yield a very small performance benefit as well.

Includes unit tests.

17178 of 23841 relevant lines covered (72.05%)

48.71 hits per line

Jobs
ID Job ID Ran Files Coverage
1 php-7.2-custom-ini-false - 7828520497.1 08 Feb 2024 11:00AM UTC 259
68.23
GitHub Action Run
2 php-8.1-custom-ini-true - 7828520497.2 08 Feb 2024 10:59AM UTC 259
70.52
GitHub Action Run
3 php-8.3-custom-ini-false - 7828520497.3 08 Feb 2024 10:59AM UTC 259
70.5
GitHub Action Run
Source Files on build 7828520497
  • Tree
  • List 259
  • Changed 6
  • Source Changed 1
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #7828520497
  • d70640ee on github
  • Prev Build on 4.0 (#7784492055)
  • Next Build on 4.0 (#7828885682)
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