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

fix: numeric_literal_separator - Handle zero-leading floats properly #7737

Merged

Conversation

muuvmuuv
Copy link
Contributor

  • added tests to cover some cases where integers should not be modified
  • fixed zero leading floats that were handled as octal due to str_starts_with zero

fixes: #7736

@muuvmuuv
Copy link
Contributor Author

@Wirone can you review how I "hacked" the test suite? I have tested the null check with and without my fix and both cases worked as expected from my view.

@coveralls
Copy link

coveralls commented Jan 15, 2024

Coverage Status

coverage: 94.761%. remained the same
when pulling a92d0d8 on muuvmuuv:bugfix/7736-leading-zero-float-rec-octal
into 27933b0 on PHP-CS-Fixer:master.

@Wirone Wirone changed the title fix: zero leading float handled as octal fix: Handle zero-leading floats properly in numeric_literal_separator Jan 15, 2024
@keradus keradus changed the title fix: Handle zero-leading floats properly in numeric_literal_separator fix: numeric_literal_separator - Handle zero-leading floats properly Jan 15, 2024
Copy link
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

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

For now yieldCases() is good enough, if we need also support for non-changing cases when no_separator strategy is used, then we might need to refactor it a little.

@Wirone Wirone force-pushed the bugfix/7736-leading-zero-float-rec-octal branch from 88fcef7 to a92d0d8 Compare January 15, 2024 14:38
@Wirone Wirone enabled auto-merge (squash) January 15, 2024 14:38
@Wirone Wirone merged commit 761a4d6 into PHP-CS-Fixer:master Jan 15, 2024
25 checks passed
@muuvmuuv muuvmuuv deleted the bugfix/7736-leading-zero-float-rec-octal branch January 15, 2024 14:48
@Wirone
Copy link
Member

Wirone commented Jan 15, 2024

Thank you @muuvmuuv 🍻.

danog pushed a commit to zoonru/PHP-CS-Fixer that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

numeric_literal_separator breaks numbers < 1
3 participants