Skip to content

PHP 8.2 | Generic/[Lower|Upper]CaseConstant: bug fix - ignore DNF property types #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 5, 2025

Description

The Generic.PHP.LowerCaseConstant sniff is supposed to flag uppercase use of the true/false/null constants and its sister-sniff UpperCaseConstant flags the lowercase variants. Both sniffs, however, are supposed to ignore the use of these keywords in type declarations - which may have their own rules.

Some previous PRs already fixed most of the issues with that (#119, #330), but it looks like DNF-types in property declarations were not yet handled correctly.

Fixed now.

Includes tests.

Suggested changelog entry

Generic.PHP.LowerCaseConstant and Generic.PHP.UpperCaseConstant will now correctly ignore DNF types for properties.

…perty types

The `Generic.PHP.LowerCaseConstant` sniff is supposed to flag uppercase use of the `true`/`false`/null` constants and its sister-sniff `UpperCaseConstant` flags the lowercase variants. Both sniffs, however, are supposed to **_ignore_** the use of these keywords in type declarations - which may have their own rules.

Some previous PRs already fixed most of the issues with that (119, 330), but it looks like DNF-types in property declarations were not yet handled correctly.

Fixed now.

Includes tests.
@jrfnl jrfnl added this to the 3.12.2 milestone Apr 5, 2025
@jrfnl jrfnl merged commit 3c90cda into master Apr 9, 2025
61 checks passed
@jrfnl jrfnl deleted the feature/generic-lower-uppercaseconstants-support-dnf-types branch April 9, 2025 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant