Numbers::is*(): remove fault tolerance for invalid numeric literals with underscores - #620
Merged
jrfnl merged 2 commits intoAug 19, 2024
Conversation
…ith underscores Numeric literals with underscores have restrictions as to where the underscores are allowed. The `Numbers` class did not take this into account to have some allowance for developer error, but as a bug has now been reported for the `AbstractArrayDeclarationSniff::getActualArrayKey()` method, which is due to this fault tolerance, the fault tolerance will be removed and the `Numbers::is*()` methods will now only allow underscore separators in places where PHP allows them. Note: There is still one restriction which is not yet handled: `1__1`, i.e. two underscores next to each. If at some point in the future a bug for this would be reported, this can be reconsidered. Includes a plenitude of additional tests. Fixes 619 Refs: * https://wiki.php.net/rfc/numeric_literal_separator#restrictions
1 task
jrfnl
deleted the
feature/619-numbers-reduce-fault-tolerance-for-numeric-literals-with-separator
branch
August 19, 2024 08:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Numbers::is*(): remove fault tolerance for invalid numeric literals with underscores
Numeric literals with underscores have restrictions as to where the underscores are allowed.
The
Numbersclass did not take this into account to have some allowance for developer error, but as a bug has now been reported for theAbstractArrayDeclarationSniff::getActualArrayKey()method, which is due to this fault tolerance, the fault tolerance will be removed and theNumbers::is*()methods will now only allow underscore separators in places where PHP allows them.Note: There is still one restriction which is not yet handled:
1__1, i.e. two underscores next to each.If at some point in the future a bug for this would be reported, this can be reconsidered.
Includes a plenitude of additional tests.
Fixes #619
Refs:
AbstractArrayDeclarationSniff::getActualArrayKey(): add extra tests