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

PHPCSStandards / PHP_CodeSniffer / 7828520497 / 3
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 08 Feb 2024 11:00AM UTC
Files 259
Run time 9s
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: 70.496% (-0.002%) from 70.498%
7828520497.3

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.

16716 of 23712 relevant lines covered (70.5%)

16.2 hits per line

Source Files on job php-8.3-custom-ini-false - 7828520497.3
  • Tree
  • List 259
  • Changed 2
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 7828520497
  • d70640ee on github
  • Prev Job for on 4.0 (#7784492055.2)
  • Next Job for on 4.0 (#7828885682.2)
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