File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
2626 </stability>
2727 <license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
2828 <notes>
29+ - The PHP 7.4 numeric separator backfill now works correctly for more float formats
2930 - Fixed bug #2688 : Case statements not tokenized correctly when switch is contained within ternary
3031 - Fixed bug #2698 : PHPCS throws errors determining auto report width when shell_exec is disabled
3132 -- Thanks to Matthew Peveler for the patch
Original file line number Diff line number Diff line change @@ -1005,9 +1005,10 @@ protected function tokenize($string)
10051005 // Support floats.
10061006 if ($ tokens [$ i ][0 ] === T_STRING
10071007 && substr (strtolower ($ tokens [$ i ][1 ]), -1 ) === 'e '
1008- && $ tokens [($ i + 1 )] === '- '
1008+ && ($ tokens [($ i + 1 )] === '- '
1009+ || $ tokens [($ i + 1 )] === '+ ' )
10091010 ) {
1010- $ newContent .= ' - ' ;
1011+ $ newContent .= $ tokens [( $ i + 1 )] ;
10111012 $ i ++;
10121013 }
10131014
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ $foo = 1_000_000_000;
99/* testFloat */
1010$ foo = 6.674_083e-11 ;
1111
12+ /* testFloat2 */
13+ $ foo = 6.674_083e+11 ;
14+
1215/* testHex */
1316$ foo = 0xCAFE_F00D ;
1417
Original file line number Diff line number Diff line change @@ -65,6 +65,13 @@ public function dataTestBackfill()
6565 'value ' => '6.674_083e-11 ' ,
6666 ],
6767 ],
68+ [
69+ [
70+ 'marker ' => '/* testFloat2 */ ' ,
71+ 'type ' => T_DNUMBER ,
72+ 'value ' => '6.674_083e+11 ' ,
73+ ],
74+ ],
6875 [
6976 [
7077 'marker ' => '/* testHex */ ' ,
You can’t perform that action at this time.
0 commit comments