Skip to content

Commit

Permalink
Remove work-arounds which were in place for PHPCS < 3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Dec 7, 2023
1 parent 09bae71 commit 2f73b96
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 89 deletions.
60 changes: 7 additions & 53 deletions PHPCSUtils/Tokens/Collections.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,7 @@ private static function triggerDeprecation($method, $version, $replacement)
*/
public static function arrayOpenTokensBC()
{
$tokens = self::$arrayOpenTokensBC;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

return $tokens;
return self::$arrayOpenTokensBC;
}

/**
Expand All @@ -623,14 +617,7 @@ public static function arrayOpenTokensBC()
*/
public static function arrayTokensBC()
{
$tokens = self::$arrayTokens;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$tokens[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

return $tokens;
return self::$arrayTokens;
}

/**
Expand Down Expand Up @@ -673,13 +660,7 @@ public static function functionCallTokens()
*/
public static function listOpenTokensBC()
{
$tokens = self::$listOpenTokensBC;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

return $tokens;
return self::$listOpenTokensBC;
}

/**
Expand All @@ -698,14 +679,7 @@ public static function listOpenTokensBC()
*/
public static function listTokensBC()
{
$tokens = self::$listTokens;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$tokens[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

return $tokens;
return self::$listTokens;
}

/**
Expand Down Expand Up @@ -815,13 +789,7 @@ public static function returnTypeTokens()
*/
public static function shortArrayListOpenTokensBC()
{
$tokens = self::$shortArrayListOpenTokensBC;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

return $tokens;
return self::$shortArrayListOpenTokensBC;
}

/**
Expand All @@ -840,14 +808,7 @@ public static function shortArrayListOpenTokensBC()
*/
public static function shortArrayTokensBC()
{
$tokens = self::$shortArrayTokens;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$tokens[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

return $tokens;
return self::$shortArrayTokens;
}

/**
Expand All @@ -866,13 +827,6 @@ public static function shortArrayTokensBC()
*/
public static function shortListTokensBC()
{
$tokens = self::$shortListTokens;

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$tokens[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$tokens[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

return $tokens;
return self::$shortListTokens;
}
}
4 changes: 0 additions & 4 deletions Tests/Tokens/Collections/ArrayOpenTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ public function testArrayOpenTokensBC()
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::arrayOpenTokensBC());
}
}
5 changes: 0 additions & 5 deletions Tests/Tokens/Collections/ArrayTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public function testArrayTokensBC()
\T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$expected[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::arrayTokensBC());
}
}
4 changes: 0 additions & 4 deletions Tests/Tokens/Collections/ListOpenTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ public function testListOpenTokensBC()
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::listOpenTokensBC());
}
}
5 changes: 0 additions & 5 deletions Tests/Tokens/Collections/ListTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public function testListTokensBC()
\T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$expected[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::listTokensBC());
}
}
4 changes: 0 additions & 4 deletions Tests/Tokens/Collections/ParameterPassingTokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ public function testParameterPassingTokens()
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::parameterPassingTokens());
}
}
4 changes: 0 additions & 4 deletions Tests/Tokens/Collections/ShortArrayListOpenTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public function testShortArrayListOpenTokensBC()
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::shortArrayListOpenTokensBC());
}
}
5 changes: 0 additions & 5 deletions Tests/Tokens/Collections/ShortArrayTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public function testShortArrayTokensBC()
\T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$expected[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::shortArrayTokensBC());
}
}
5 changes: 0 additions & 5 deletions Tests/Tokens/Collections/ShortListTokensBCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public function testShortListTokensBC()
\T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY,
];

if (\version_compare(Helper::getVersion(), '3.7.1', '<=')) {
$expected[\T_OPEN_SQUARE_BRACKET] = \T_OPEN_SQUARE_BRACKET;
$expected[\T_CLOSE_SQUARE_BRACKET] = \T_CLOSE_SQUARE_BRACKET;
}

$this->assertSame($expected, Collections::shortListTokensBC());
}
}

0 comments on commit 2f73b96

Please sign in to comment.