Skip to content

Commit

Permalink
The PHP 7.4 numeric separator backfill is no longer run on PHP versio…
Browse files Browse the repository at this point in the history
…ns 7.4.0 or greater (ref #2546)
  • Loading branch information
gsherwood committed Dec 16, 2019
1 parent d395525 commit 62c5742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- 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
Expand Down
5 changes: 3 additions & 2 deletions src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 62c5742

Please sign in to comment.