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

PHPCSStandards / PHP_CodeSniffer / 7828885682
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 08 Feb 2024 11:29AM UTC
Jobs 3
Files 259
Run time 19s
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 11:26AM UTC coverage: 72.102% (+0.05%) from 72.052%
7828885682

push

github

jrfnl
PHP 8.3 | Tokenizer/PHP: add support for typed OO constants

PHP 8.3 introduced typed OO constants, where the type is between the `const` keyword and the constant name.

All type variations are supported, including nullable types, union types, intersection types, with the exception of `callable`, `void` and `never`.
`self` and `static` types are only allowed in Enum constants.

This PR adds support for typed OO constants in the Tokenizer layer of PHPCS.

The following issues had to be fixed to support typed constants:
1. Consistently tokenizing the constant _name_ as `T_STRING`, even if the name mirrors a reserved keyword, like `foreach` or a special keyword, like `self` or `true`.
2. Tokenizing a `?` at the start of a constant type declaration as `T_NULLABLE`.
3. Tokenizing a `|` and `&` operators within a constant type declaration as `T_TYPE_UNION` and `T_TYPE_INTERSECTION` respectively.

Each and every part of the above has been covered by extensive tests.
Includes additional tests safeguarding that the `array` keyword when used in a type declaration for a constant is tokenized as `T_STRING`.

Ref: https://wiki.php.net/rfc/typed_class_constants

17223 of 23887 relevant lines covered (72.1%)

55.38 hits per line

Jobs
ID Job ID Ran Files Coverage
1 php-7.2-custom-ini-false - 7828885682.1 08 Feb 2024 11:31AM UTC 259
68.28
GitHub Action Run
2 php-8.1-custom-ini-true - 7828885682.2 08 Feb 2024 11:29AM UTC 259
70.57
GitHub Action Run
3 php-8.3-custom-ini-false - 7828885682.3 08 Feb 2024 11:29AM UTC 259
70.55
GitHub Action Run
Source Files on build 7828885682
  • Tree
  • List 259
  • Changed 2
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #7828885682
  • d9c80bb0 on github
  • Prev Build on 4.0 (#7828520497)
  • Next Build on 4.0 (#7829152065)
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