@@ -18,21 +18,23 @@ final class BackfillNumericSeparatorTest extends AbstractMethodUnitTest
1818 /**
1919 * Test that numbers using numeric separators are tokenized correctly.
2020 *
21- * @param array $testData The data required for the specific test case.
21+ * @param string $marker The comment which prefaces the target token in the test file.
22+ * @param string $type The expected token type.
23+ * @param string $value The expected token content.
2224 *
2325 * @dataProvider dataTestBackfill
2426 * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
2527 *
2628 * @return void
2729 */
28- public function testBackfill ($ testData )
30+ public function testBackfill ($ marker , $ type , $ value )
2931 {
3032 $ tokens = self ::$ phpcsFile ->getTokens ();
31- $ number = $ this ->getTargetToken ($ testData [ ' marker ' ] , [T_LNUMBER , T_DNUMBER ]);
33+ $ number = $ this ->getTargetToken ($ marker , [T_LNUMBER , T_DNUMBER ]);
3234
33- $ this ->assertSame (constant ($ testData [ ' type ' ] ), $ tokens [$ number ]['code ' ]);
34- $ this ->assertSame ($ testData [ ' type ' ] , $ tokens [$ number ]['type ' ]);
35- $ this ->assertSame ($ testData [ ' value ' ] , $ tokens [$ number ]['content ' ]);
35+ $ this ->assertSame (constant ($ type ), $ tokens [$ number ]['code ' ]);
36+ $ this ->assertSame ($ type , $ tokens [$ number ]['type ' ]);
37+ $ this ->assertSame ($ value , $ tokens [$ number ]['content ' ]);
3638
3739 }//end testBackfill()
3840
@@ -63,95 +65,69 @@ public static function dataTestBackfill()
6365
6466 return [
6567 [
66- [
67- 'marker ' => '/* testSimpleLNumber */ ' ,
68- 'type ' => 'T_LNUMBER ' ,
69- 'value ' => '1_000_000_000 ' ,
70- ],
68+ 'marker ' => '/* testSimpleLNumber */ ' ,
69+ 'type ' => 'T_LNUMBER ' ,
70+ 'value ' => '1_000_000_000 ' ,
7171 ],
7272 [
73- [
74- 'marker ' => '/* testSimpleDNumber */ ' ,
75- 'type ' => 'T_DNUMBER ' ,
76- 'value ' => '107_925_284.88 ' ,
77- ],
73+ 'marker ' => '/* testSimpleDNumber */ ' ,
74+ 'type ' => 'T_DNUMBER ' ,
75+ 'value ' => '107_925_284.88 ' ,
7876 ],
7977 [
80- [
81- 'marker ' => '/* testFloat */ ' ,
82- 'type ' => 'T_DNUMBER ' ,
83- 'value ' => '6.674_083e-11 ' ,
84- ],
78+ 'marker ' => '/* testFloat */ ' ,
79+ 'type ' => 'T_DNUMBER ' ,
80+ 'value ' => '6.674_083e-11 ' ,
8581 ],
8682 [
87- [
88- 'marker ' => '/* testFloat2 */ ' ,
89- 'type ' => 'T_DNUMBER ' ,
90- 'value ' => '6.674_083e+11 ' ,
91- ],
83+ 'marker ' => '/* testFloat2 */ ' ,
84+ 'type ' => 'T_DNUMBER ' ,
85+ 'value ' => '6.674_083e+11 ' ,
9286 ],
9387 [
94- [
95- 'marker ' => '/* testFloat3 */ ' ,
96- 'type ' => 'T_DNUMBER ' ,
97- 'value ' => '1_2.3_4e1_23 ' ,
98- ],
88+ 'marker ' => '/* testFloat3 */ ' ,
89+ 'type ' => 'T_DNUMBER ' ,
90+ 'value ' => '1_2.3_4e1_23 ' ,
9991 ],
10092 [
101- [
102- 'marker ' => '/* testHex */ ' ,
103- 'type ' => $ testHexType ,
104- 'value ' => '0xCAFE_F00D ' ,
105- ],
93+ 'marker ' => '/* testHex */ ' ,
94+ 'type ' => $ testHexType ,
95+ 'value ' => '0xCAFE_F00D ' ,
10696 ],
10797 [
108- [
109- 'marker ' => '/* testHexMultiple */ ' ,
110- 'type ' => $ testHexMultipleType ,
111- 'value ' => '0x42_72_6F_77_6E ' ,
112- ],
98+ 'marker ' => '/* testHexMultiple */ ' ,
99+ 'type ' => $ testHexMultipleType ,
100+ 'value ' => '0x42_72_6F_77_6E ' ,
113101 ],
114102 [
115- [
116- 'marker ' => '/* testHexInt */ ' ,
117- 'type ' => 'T_LNUMBER ' ,
118- 'value ' => '0x42_72_6F ' ,
119- ],
103+ 'marker ' => '/* testHexInt */ ' ,
104+ 'type ' => 'T_LNUMBER ' ,
105+ 'value ' => '0x42_72_6F ' ,
120106 ],
121107 [
122- [
123- 'marker ' => '/* testBinary */ ' ,
124- 'type ' => 'T_LNUMBER ' ,
125- 'value ' => '0b0101_1111 ' ,
126- ],
108+ 'marker ' => '/* testBinary */ ' ,
109+ 'type ' => 'T_LNUMBER ' ,
110+ 'value ' => '0b0101_1111 ' ,
127111 ],
128112 [
129- [
130- 'marker ' => '/* testOctal */ ' ,
131- 'type ' => 'T_LNUMBER ' ,
132- 'value ' => '0137_041 ' ,
133- ],
113+ 'marker ' => '/* testOctal */ ' ,
114+ 'type ' => 'T_LNUMBER ' ,
115+ 'value ' => '0137_041 ' ,
134116 ],
135117 [
136- [
137- 'marker ' => '/* testExplicitOctal */ ' ,
138- 'type ' => 'T_LNUMBER ' ,
139- 'value ' => '0o137_041 ' ,
140- ],
118+ 'marker ' => '/* testExplicitOctal */ ' ,
119+ 'type ' => 'T_LNUMBER ' ,
120+ 'value ' => '0o137_041 ' ,
141121 ],
142122 [
143- [
144- 'marker ' => '/* testExplicitOctalCapitalised */ ' ,
145- 'type ' => 'T_LNUMBER ' ,
146- 'value ' => '0O137_041 ' ,
147- ],
123+ 'marker ' => '/* testExplicitOctalCapitalised */ ' ,
124+ 'type ' => 'T_LNUMBER ' ,
125+ 'value ' => '0O137_041 ' ,
148126 ],
149127 [
150- [
151- 'marker ' => '/* testIntMoreThanMax */ ' ,
152- 'type ' => $ testIntMoreThanMaxType ,
153- 'value ' => '10_223_372_036_854_775_807 ' ,
154- ],
128+ 'marker ' => '/* testIntMoreThanMax */ ' ,
129+ 'type ' => $ testIntMoreThanMaxType ,
130+ 'value ' => '10_223_372_036_854_775_807 ' ,
155131 ],
156132 ];
157133
0 commit comments