2
2
/**
3
3
* Tests the support of PHP 8.4 asymmetric visibility.
4
4
*
5
- * @author Daniel Scherzer <daniel.e.scherzer@gmail.com>
6
- * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
5
+ * @author Daniel Scherzer <daniel.e.scherzer@gmail.com>
6
+ * @copyright 2025 PHPCSStandards and contributors
7
+ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
7
8
*/
8
9
9
10
namespace PHP_CodeSniffer \Tests \Core \Tokenizers \PHP ;
10
11
11
12
use PHP_CodeSniffer \Tests \Core \Tokenizers \AbstractTokenizerTestCase ;
12
13
14
+ /**
15
+ * Tests the support of PHP 8.4 asymmetric visibility.
16
+ *
17
+ * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
18
+ */
13
19
final class BackfillAsymmetricVisibilityTest extends AbstractTokenizerTestCase
14
20
{
15
21
@@ -22,7 +28,6 @@ final class BackfillAsymmetricVisibilityTest extends AbstractTokenizerTestCase
22
28
* @param string $testContent The token content to look for
23
29
*
24
30
* @dataProvider dataAsymmetricVisibility
25
- * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
26
31
*
27
32
* @return void
28
33
*/
@@ -58,43 +63,6 @@ public function testAsymmetricVisibility($testMarker, $testType, $testContent)
58
63
}//end testAsymmetricVisibility()
59
64
60
65
61
- /**
62
- * Test that things that are not asymmetric visibility keywords are not
63
- * tokenized as such.
64
- *
65
- * @param string $testMarker The comment which prefaces the target token in the test file.
66
- * @param string $testType The expected token type
67
- * @param string $testContent The token content to look for
68
- *
69
- * @dataProvider dataNotAsymmetricVisibility
70
- * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
71
- *
72
- * @return void
73
- */
74
- public function testNotAsymmetricVisibility ($ testMarker , $ testType , $ testContent )
75
- {
76
- $ tokens = $ this ->phpcsFile ->getTokens ();
77
- $ target = $ this ->getTargetToken (
78
- $ testMarker ,
79
- [ constant ($ testType ) ],
80
- $ testContent
81
- );
82
- $ tokenArray = $ tokens [$ target ];
83
-
84
- $ this ->assertSame (
85
- $ testType ,
86
- $ tokenArray ['type ' ],
87
- 'Token tokenized as ' .$ tokenArray ['type ' ].' (type) '
88
- );
89
- $ this ->assertSame (
90
- constant ($ testType ),
91
- $ tokenArray ['code ' ],
92
- 'Token tokenized as ' .$ tokenArray ['type ' ].' (code) '
93
- );
94
-
95
- }//end testNotAsymmetricVisibility()
96
-
97
-
98
66
/**
99
67
* Data provider.
100
68
*
@@ -233,6 +201,42 @@ public static function dataAsymmetricVisibility()
233
201
}//end dataAsymmetricVisibility()
234
202
235
203
204
+ /**
205
+ * Test that things that are not asymmetric visibility keywords are not
206
+ * tokenized as such.
207
+ *
208
+ * @param string $testMarker The comment which prefaces the target token in the test file.
209
+ * @param string $testType The expected token type
210
+ * @param string $testContent The token content to look for
211
+ *
212
+ * @dataProvider dataNotAsymmetricVisibility
213
+ *
214
+ * @return void
215
+ */
216
+ public function testNotAsymmetricVisibility ($ testMarker , $ testType , $ testContent )
217
+ {
218
+ $ tokens = $ this ->phpcsFile ->getTokens ();
219
+ $ target = $ this ->getTargetToken (
220
+ $ testMarker ,
221
+ [constant ($ testType )],
222
+ $ testContent
223
+ );
224
+ $ tokenArray = $ tokens [$ target ];
225
+
226
+ $ this ->assertSame (
227
+ $ testType ,
228
+ $ tokenArray ['type ' ],
229
+ 'Token tokenized as ' .$ tokenArray ['type ' ].' (type) '
230
+ );
231
+ $ this ->assertSame (
232
+ constant ($ testType ),
233
+ $ tokenArray ['code ' ],
234
+ 'Token tokenized as ' .$ tokenArray ['type ' ].' (code) '
235
+ );
236
+
237
+ }//end testNotAsymmetricVisibility()
238
+
239
+
236
240
/**
237
241
* Data provider.
238
242
*
0 commit comments