diff --git a/package.xml b/package.xml index 8a84f7e700..57d98a105b 100644 --- a/package.xml +++ b/package.xml @@ -27,6 +27,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> BSD 3-Clause License - The PHP 7.4 numeric separator backfill now works correctly for more float formats + - The PHP 7.4 numeric separator backfill is no longer run on PHP versions 7.4.0 or greater - Fixed bug #2688 : Case statements not tokenized correctly when switch is contained within ternary - Fixed bug #2698 : PHPCS throws errors determining auto report width when shell_exec is disabled -- Thanks to Matthew Peveler for the patch diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index c395b1be73..6a6a30fce2 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -974,13 +974,14 @@ protected function tokenize($string) and change these tokens in earlier versions. */ - if ($tokenIsArray === true + if (PHP_VERSION_ID < 70400 + && ($tokenIsArray === true && ($token[0] === T_LNUMBER || $token[0] === T_DNUMBER) && isset($tokens[($stackPtr + 1)]) === true && is_array($tokens[($stackPtr + 1)]) === true && $tokens[($stackPtr + 1)][0] === T_STRING - && $tokens[($stackPtr + 1)][1][0] === '_' + && $tokens[($stackPtr + 1)][1][0] === '_') ) { $newContent = $token[1]; $newType = $token[0];