ValidIntegers: move to Numbers category, split the sniff & support PHP 7.4 numeric literals by jrfnl · Pull Request #1004 · PHPCompatibility/PHPCompatibility
added 7 commits
April 4, 2020 06:23Split the `ValidIntegers` sniff in two: * A new `PHPCompatibility.Numbers.RemovedHexadecimalNumericStrings` which examines hexadecimal numeric strings. * The existing `ValidIntegers` sniff will now only focus on actual numbers (binary, octal). This is a BC-break and should be annotated as such in the changelog. Note: the new sniff implements the PHPCSUtils `Numbers::isHexidecimalInt()` method.
As the token "type" no longer needs to be checked as the sniff no longer looks for anything but `T_LNUMBER` tokens, a number of the private helper methods can be simplified and not passing the whole token stack to each function will reduce memory usage.
* Use the `Numbers::isBinaryInt()` method to determine if something is a binary integer. * Use the `GetTokensAsString::normal()` method to retrieve a code snippet for display in an error message.
wimg approved these changes Apr 10, 2020
wimg
deleted the
feature/validintegers-phpcsutils
branch
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