Skip to content
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

CS: add the RequireExplicitBooleanOperatorPrecedence sniff to PHPCS native ruleset #326

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 3, 2024

Description

This commit adds the new sniff as introduced in #197 by @TimWolla to the PHPCS native ruleset and fixes the few conditions which were ambiguous in this codebase.

Suggested changelog entry

N/A

Related issues/external references

Also see #197

…ative ruleset

This commit adds the new sniff as introduced in 197 by TimWolla to the PHPCS native ruleset and fixes the few conditions which were ambiguous in this codebase.
@@ -1727,7 +1727,7 @@ protected function tokenize($string)
|| (stripos($newContent, '0b') === 0 && bindec(str_replace('_', '', $newContent)) > PHP_INT_MAX)
|| (stripos($newContent, '0o') === 0 && octdec(str_replace('_', '', $newContent)) > PHP_INT_MAX)
|| (stripos($newContent, '0x') !== 0
&& stripos($newContent, 'e') !== false || strpos($newContent, '.') !== false)
&& (stripos($newContent, 'e') !== false || strpos($newContent, '.') !== false))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it's too early in the morning and I misread this, it even caught a bug in here 🙌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too when I made the change, but there is a test for this code and it passed before and after 🤷🏻‍♀️

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.

2 participants