Skip to content

Commit 62c5742

Browse files
committed
The PHP 7.4 numeric separator backfill is no longer run on PHP versions 7.4.0 or greater (ref #2546)
1 parent d395525 commit 62c5742

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
2727
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
2828
<notes>
2929
- The PHP 7.4 numeric separator backfill now works correctly for more float formats
30+
- The PHP 7.4 numeric separator backfill is no longer run on PHP versions 7.4.0 or greater
3031
- Fixed bug #2688 : Case statements not tokenized correctly when switch is contained within ternary
3132
- Fixed bug #2698 : PHPCS throws errors determining auto report width when shell_exec is disabled
3233
-- Thanks to Matthew Peveler for the patch

src/Tokenizers/PHP.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,14 @@ protected function tokenize($string)
974974
and change these tokens in earlier versions.
975975
*/
976976

977-
if ($tokenIsArray === true
977+
if (PHP_VERSION_ID < 70400
978+
&& ($tokenIsArray === true
978979
&& ($token[0] === T_LNUMBER
979980
|| $token[0] === T_DNUMBER)
980981
&& isset($tokens[($stackPtr + 1)]) === true
981982
&& is_array($tokens[($stackPtr + 1)]) === true
982983
&& $tokens[($stackPtr + 1)][0] === T_STRING
983-
&& $tokens[($stackPtr + 1)][1][0] === '_'
984+
&& $tokens[($stackPtr + 1)][1][0] === '_')
984985
) {
985986
$newContent = $token[1];
986987
$newType = $token[0];

0 commit comments

Comments
 (0)