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

PHPCSStandards / PHP_CodeSniffer / 8791384934
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 22 Apr 2024 09:54PM UTC
Jobs 3
Files 259
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

22 Apr 2024 09:50PM UTC coverage: 72.434% (+0.002%) from 72.432%
8791384934

push

github

jrfnl
Tokenizer/PHP: arrow function tokenization broken when true/false used in return type

Since PHP 8.0, `false` and `null` can be included in a union return type.
As of PHP 8.2, both `true`, `false` and `null` can be used as a stand-alone return type.

The tokenizer layer handling arrow functions did not take this into account correctly. While `null` was handled correctly, `true` and `false` was not and would result in the arrow function `fn` keyword being tokenized as `T_STRING` across all PHP versions.
As a result of that, the other typical tokenizer changes related to arrow functions (`=>` as `T_FN_ARROW`, scope/parenthesis owners etc) would also not be executed correctly.

In practice, I suspect few people will have run into this bug as, after all, what's the point of declaring an arrow function which will only ever return `true` or `false` ? so in practice, it is likely to only have come into play for people using `true` or `false` as part of an arrow function union type.
All the same, PHPCS should handle this correctly.

Includes unit tests proving the bug and safeguarding the fix.

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

17374 of 23986 relevant lines covered (72.43%)

59.28 hits per line

Jobs
ID Job ID Ran Files Coverage
1 php-7.2-custom-ini-false - 8791384934.1 22 Apr 2024 09:55PM UTC 259
68.61
GitHub Action Run
2 php-8.3-custom-ini-false - 8791384934.2 22 Apr 2024 09:54PM UTC 259
70.87
GitHub Action Run
3 php-8.1-custom-ini-true - 8791384934.3 22 Apr 2024 09:54PM UTC 259
70.9
GitHub Action Run
Source Files on build 8791384934
  • Tree
  • List 259
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #8791384934
  • 130fdcb1 on github
  • Prev Build on 4.0 (#8791067527)
  • Next Build on 4.0 (#8791836512)
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