Skip to content

Commit 2148118

Browse files
committed
PHPCS 4.x | BCTokens::parenthesisOpeners(): T_USE is now a parenthesis opener
`T_USE` tokens used for closure use statements are parentheses openers as of PHPCS 4.x. This includes the token having been added to the `Tokens::$parenthesisOpeners` array. This syncs that change into PHPCSUtils. The method itself does not need to change as it will automatically pick up on this. The unit test, however, does need updating. Refs: * squizlabs/PHP_CodeSniffer 2593 * squizlabs/PHP_CodeSniffer@08824f3
1 parent 9d7b3c2 commit 2148118

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Tests/BackCompat/BCTokens/ParenthesisOpenersTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
use PHP_CodeSniffer\Util\Tokens;
1414
use PHPCSUtils\BackCompat\BCTokens;
15+
use PHPCSUtils\BackCompat\Helper;
1516
use PHPUnit\Framework\TestCase;
1617

1718
/**
@@ -33,6 +34,7 @@ class ParenthesisOpenersTest extends TestCase
3334
*/
3435
public function testParenthesisOpeners()
3536
{
37+
$version = Helper::getVersion();
3638
$expected = [
3739
\T_ARRAY => \T_ARRAY,
3840
\T_LIST => \T_LIST,
@@ -49,6 +51,10 @@ public function testParenthesisOpeners()
4951
\T_DECLARE => \T_DECLARE,
5052
];
5153

54+
if (\version_compare($version, '4.0.0', '>=') === true) {
55+
$expected[\T_USE] = \T_USE;
56+
}
57+
5258
\asort($expected);
5359

5460
$result = BCTokens::parenthesisOpeners();

0 commit comments

Comments
 (0)