| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
… sniffs Remove `NullTypeHintOnLastPosition` sniff and `nullPosition` property from `DNFTypeHintFormat` to avoid conflict with CakePHP's `TypeHintSniff` which expects `void` to be last in union types (e.g., `int|null|void`). The Slevomat sniffs enforced `null` as last position, causing an unresolvable conflict where PHPCBF would fail to fix files containing both `null` and `void` in union types. Fixes #426
|
Would usage like null|int still be flagged after this change? |
Sorry, something went wrong.
|
Yes, null|int would still be flagged and fixed to int|null. CakePHP's own TypeHintSniff already handles this - its $shouldSort array defines the expected type order with null near the end (only void comes after). The existing test files confirm this behavior:
The removed Slevomat sniffs were redundant (and conflicting when void was also present). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This fixes the conflict where CakePHP's TypeHintSniff expects void to be last in union types (e.g., int|null|void), but Slevomat sniffs enforced null as last position (expecting int|void|null).
The conflict caused PHPCBF to fail when trying to fix files containing both null and void in union types, as both sniffs would fight each other.
This follows the same approach as php-collective/code-sniffer which also doesn't use these Slevomat sniffs.
Fixes #426