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

PHPCSStandards / PHP_CodeSniffer / 8791384934 / 1
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: catch-per-3.0
DEFAULT BRANCH: master
Ran 22 Apr 2024 09:55PM 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

22 Apr 2024 09:50PM UTC coverage: 68.613% (+0.003%) from 68.61%
8791384934.1

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.

16570 of 24150 relevant lines covered (68.61%)

19.85 hits per line

Source Files on job php-7.2-custom-ini-false - 8791384934.1
  • Tree
  • List 259
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 8791384934
  • 130fdcb1 on github
  • Prev Job for on 4.0 (#8791067527.1)
  • Next Job for on 4.0 (#8791836512.1)
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