[Hotfix] Tokenizer / numeric separators backfill: fix all known issues #2771
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.
Tokenizer / numeric separators backfill: improve the unit tests
Test case file:
Test file
testBackfill()
:assertSame()
. The first parameter is$expected
, the second$result
.Having the parameters in the correct order makes debugging the tests easier as the messages send by PHPUnit will be correct.
Test file new
testNoBackfill()
Add tests to verify that numbers using numeric separators which are considered parse errors and/or which aren't relevant to the backfill, do not incorrectly trigger the backfill anyway.
This test verifies that the final token sequence is in line with the token sequence PHP 7.4 would give.
Tokenizer / numeric separators backfill: fix incorrect token types
Tokenizer / numeric separators backfill: fix incorrect token types
When the final content of a numeric token is more than PHP_INT_MAX or when a numeric token contains a
.
or anE/e
, it should be tokenized asT_DNUMBER
.This fixes the first set of the unit test failures.
Tokenizer / numeric separators backfill: fix parse errors being handled by the backfill
The prevents the backfill from kicking in when confronted with invalid use of the numeric literal separator which would be a parse error in PHP 7.4 anyway.
This fixes the remaining unit test failures.
Fixes all currently known issues which remained after #2546
Note: on Windows the unit tests will currently not pass when run against PHP 7.4.0 due to a bug in PHP itself. See: https://bugs.php.net/bug.php?id=78978