22/**
33 * Tests the support of PHP 8.4 asymmetric visibility.
44 *
5- * @author Daniel Scherzer <[email protected] > 6- * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
5+ * @author Daniel Scherzer <[email protected] > 6+ * @copyright 2025 PHPCSStandards and contributors
7+ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
78 */
89
910namespace PHP_CodeSniffer \Tests \Core \Tokenizers \PHP ;
1011
1112use PHP_CodeSniffer \Tests \Core \Tokenizers \AbstractTokenizerTestCase ;
1213
14+ /**
15+ * Tests the support of PHP 8.4 asymmetric visibility.
16+ *
17+ * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
18+ */
1319final class BackfillAsymmetricVisibilityTest extends AbstractTokenizerTestCase
1420{
1521
@@ -22,7 +28,6 @@ final class BackfillAsymmetricVisibilityTest extends AbstractTokenizerTestCase
2228 * @param string $testContent The token content to look for
2329 *
2430 * @dataProvider dataAsymmetricVisibility
25- * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional
2631 *
2732 * @return void
2833 */
@@ -58,43 +63,6 @@ public function testAsymmetricVisibility($testMarker, $testType, $testContent)
5863 }//end testAsymmetricVisibility()
5964
6065
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-
9866 /**
9967 * Data provider.
10068 *
@@ -233,6 +201,42 @@ public static function dataAsymmetricVisibility()
233201 }//end dataAsymmetricVisibility()
234202
235203
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+
236240 /**
237241 * Data provider.
238242 *
0 commit comments