From 732219cecd7d569a7a3410df146922be6ac7aca2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 6 Nov 2023 22:19:28 +0100 Subject: [PATCH 1/3] Switch to PHPCSStandards/PHP_CodeSniffer The Squizlabs repo has been abandoned. The project continues in a fork in the PHPCSStandards organisation. Ref: * squizlabs/PHP_CodeSniffer 3932 --- .github/workflows/update-phpcs-versionnr.yml | 2 +- PHPCSUtils/BackCompat/BCFile.php | 2 +- PHPCSUtils/ruleset.xml | 2 +- README.md | 4 ++-- Tests/BackCompat/BCFile/FindEndOfStatementTest.php | 2 +- Tests/BackCompat/BCFile/FindExtendedClassNameTest.php | 2 +- Tests/BackCompat/BCFile/FindImplementedInterfaceNamesTest.php | 2 +- Tests/BackCompat/BCFile/GetMemberPropertiesTest.php | 2 +- Tests/BackCompat/BCFile/GetMethodParametersTest.php | 2 +- Tests/BackCompat/BCFile/GetMethodPropertiesTest.php | 2 +- Tests/BackCompat/BCFile/IsReferenceTest.php | 2 +- phpcs.xml.dist | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update-phpcs-versionnr.yml b/.github/workflows/update-phpcs-versionnr.yml index e05b5d62..edb9b201 100644 --- a/.github/workflows/update-phpcs-versionnr.yml +++ b/.github/workflows/update-phpcs-versionnr.yml @@ -29,7 +29,7 @@ jobs: uses: octokit/request-action@v2.x id: get_latest_release with: - route: GET /repos/squizlabs/PHP_CodeSniffer/releases/latest + route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/PHPCSUtils/BackCompat/BCFile.php b/PHPCSUtils/BackCompat/BCFile.php index 6b8cab44..994eb516 100644 --- a/PHPCSUtils/BackCompat/BCFile.php +++ b/PHPCSUtils/BackCompat/BCFile.php @@ -29,7 +29,7 @@ * @author Klaus Purer * * @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\BackCompat; diff --git a/PHPCSUtils/ruleset.xml b/PHPCSUtils/ruleset.xml index f4365516..eefc6dbb 100644 --- a/PHPCSUtils/ruleset.xml +++ b/PHPCSUtils/ruleset.xml @@ -1,4 +1,4 @@ - + Utility methods for external PHPCS standards. diff --git a/README.md b/README.md index bf33f060..23e83036 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ To use a non-Composer based installation for your sniff development environment, Your installation instructions for a non-Composer based installation will probably look similar to this: -> * Install [PHP_CodeSniffer] via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation). +> * Install [PHP_CodeSniffer] via [your preferred method](https://github.com/PHPCSStandards/PHP_CodeSniffer#installation). > * Register the path to PHPCS in your system `$PATH` environment variable to make the `phpcs` command available from anywhere in your file system. > * Download the \[latest _YourStandardName_ release\] and unzip/untar it into an arbitrary directory. > You can also choose to clone the repository using git. @@ -288,7 +288,7 @@ If you are unsure whether the changes you are proposing would be welcome, please This code is released under the [GNU Lesser General Public License (LGPLv3)](LICENSE). -[PHP_CodeSniffer]: https://github.com/squizlabs/PHP_CodeSniffer +[PHP_CodeSniffer]: https://github.com/PHPCSStandards/PHP_CodeSniffer [Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer [phpcsutils-repo]: https://github.com/PHPCSStandards/PHPCSUtils [phpcsutils-web]: https://phpcsutils.com/ diff --git a/Tests/BackCompat/BCFile/FindEndOfStatementTest.php b/Tests/BackCompat/BCFile/FindEndOfStatementTest.php index 1f42fd45..1f18c18f 100644 --- a/Tests/BackCompat/BCFile/FindEndOfStatementTest.php +++ b/Tests/BackCompat/BCFile/FindEndOfStatementTest.php @@ -17,7 +17,7 @@ * @author Phil Davis * * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php index 5fc5c98f..d826541d 100644 --- a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php +++ b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php @@ -19,7 +19,7 @@ * @author Phil Davis * * @copyright 2016-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/FindImplementedInterfaceNamesTest.php b/Tests/BackCompat/BCFile/FindImplementedInterfaceNamesTest.php index ef70910e..d31f4105 100644 --- a/Tests/BackCompat/BCFile/FindImplementedInterfaceNamesTest.php +++ b/Tests/BackCompat/BCFile/FindImplementedInterfaceNamesTest.php @@ -18,7 +18,7 @@ * @author Phil Davis * * @copyright 2016-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/GetMemberPropertiesTest.php b/Tests/BackCompat/BCFile/GetMemberPropertiesTest.php index bcdc6dbd..67b2ff90 100644 --- a/Tests/BackCompat/BCFile/GetMemberPropertiesTest.php +++ b/Tests/BackCompat/BCFile/GetMemberPropertiesTest.php @@ -17,7 +17,7 @@ * @author Phil Davis * * @copyright 2017-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/GetMethodParametersTest.php b/Tests/BackCompat/BCFile/GetMethodParametersTest.php index 4aca57bf..d23ed800 100644 --- a/Tests/BackCompat/BCFile/GetMethodParametersTest.php +++ b/Tests/BackCompat/BCFile/GetMethodParametersTest.php @@ -18,7 +18,7 @@ * @author George Mponos * * @copyright 2010-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/GetMethodPropertiesTest.php b/Tests/BackCompat/BCFile/GetMethodPropertiesTest.php index 159d24ef..75ed7da7 100644 --- a/Tests/BackCompat/BCFile/GetMethodPropertiesTest.php +++ b/Tests/BackCompat/BCFile/GetMethodPropertiesTest.php @@ -15,7 +15,7 @@ * @author Juliette Reinders Folmer * * @copyright 2018-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/Tests/BackCompat/BCFile/IsReferenceTest.php b/Tests/BackCompat/BCFile/IsReferenceTest.php index 6af58103..9f5dcedd 100644 --- a/Tests/BackCompat/BCFile/IsReferenceTest.php +++ b/Tests/BackCompat/BCFile/IsReferenceTest.php @@ -17,7 +17,7 @@ * @author Phil Davis * * @copyright 2017-2019 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHPCSUtils\Tests\BackCompat\BCFile; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 8129b2a3..1722ab6f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -5,7 +5,7 @@ From 09bae7108cddd654814d76ca43b27c3ddb13523b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 13 Nov 2023 19:07:55 +0100 Subject: [PATCH 2/3] Composer: raise the minimum supported PHPCS version to 3.8.0 ... to prevent end-users from running into trouble with the name change. The files in the Composer `vendor/bin` will only be replaced when the `replace...` directive is found and that is only available in the 3.8.0 tag. When the files in the Composer `vendor/bin` are not replaced, they will continue to point to the `vendor/squizlabs/php_codesniffer` directory which will no longer exist, leading to fatal "File not found" errors for end-users trying to run PHPCS/PHPCBF. Includes updating references to the PHPCS version whenever relevant throughout the codebase. --- PHPCSUtils/BackCompat/BCFile.php | 20 ++++++++++---------- PHPCSUtils/BackCompat/BCTokens.php | 2 +- README.md | 6 +++--- Tests/BackCompat/Helper/GetVersionTest.php | 4 ++-- Tests/Tokens/TokenHelper/TokenExistsTest.php | 2 +- Tests/Utils/Arrays/GetDoubleArrowPtrTest.php | 3 ++- composer.json | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/PHPCSUtils/BackCompat/BCFile.php b/PHPCSUtils/BackCompat/BCFile.php index 994eb516..0fc4fed3 100644 --- a/PHPCSUtils/BackCompat/BCFile.php +++ b/PHPCSUtils/BackCompat/BCFile.php @@ -498,7 +498,7 @@ public static function getMethodParameters(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source. * @see \PHPCSUtils\Utils\FunctionDeclarations::getProperties() PHPCSUtils native improved version. @@ -543,7 +543,7 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::getMemberProperties() Original source. * @see \PHPCSUtils\Utils\Variables::getMemberProperties() PHPCSUtils native improved version. @@ -653,7 +653,7 @@ public static function getClassProperties(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::isReference() Original source. * @see \PHPCSUtils\Utils\Operators::isReference() PHPCSUtils native improved version. @@ -679,7 +679,7 @@ public static function isReference(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::getTokensAsString() Original source. * @see \PHPCSUtils\Utils\GetTokensAsString Related set of functions. @@ -708,7 +708,7 @@ public static function getTokensAsString(File $phpcsFile, $start, $length, $orig * * Changelog for the PHPCS native function: * - Introduced in PHPCS 2.1.0. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::findStartOfStatement() Original source. * @@ -732,7 +732,7 @@ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = n * * Changelog for the PHPCS native function: * - Introduced in PHPCS 2.1.0. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::findEndOfStatement() Original source. * @@ -756,7 +756,7 @@ public static function findEndOfStatement(File $phpcsFile, $start, $ignore = nul * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::hasCondition() Original source. * @see \PHPCSUtils\Utils\Conditions::hasCondition() PHPCSUtils native alternative. @@ -781,7 +781,7 @@ public static function hasCondition(File $phpcsFile, $stackPtr, $types) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 1.3.0. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::getCondition() Original source. * @see \PHPCSUtils\Utils\Conditions::getCondition() More versatile alternative. @@ -812,7 +812,7 @@ public static function getCondition(File $phpcsFile, $stackPtr, $type, $first = * * Changelog for the PHPCS native function: * - Introduced in PHPCS 1.2.0. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::findExtendedClassName() Original source. * @see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedClassName() PHPCSUtils native improved version. @@ -837,7 +837,7 @@ public static function findExtendedClassName(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 2.7.0. - * - The upstream method has received no significant updates since PHPCS 3.7.1. + * - The upstream method has received no significant updates since PHPCS 3.8.0. * * @see \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames() Original source. * @see \PHPCSUtils\Utils\ObjectDeclarations::findImplementedInterfaceNames() PHPCSUtils native improved version. diff --git a/PHPCSUtils/BackCompat/BCTokens.php b/PHPCSUtils/BackCompat/BCTokens.php index c7ac15fb..9424f70c 100644 --- a/PHPCSUtils/BackCompat/BCTokens.php +++ b/PHPCSUtils/BackCompat/BCTokens.php @@ -74,7 +74,7 @@ final class BCTokens /** * Handle calls to (undeclared) methods for token arrays which haven't received any - * changes since PHPCS 3.7.1. + * changes since PHPCS 3.8.0. * * @since 1.0.0 * diff --git a/README.md b/README.md index 23e83036..430855ea 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Whether you need to split an `array` into the individual items, are trying to de Includes improved versions of the PHPCS native utility functions and plenty of new utility functions. -These functions are compatible with PHPCS 3.7.1 up to PHPCS `master`. +These functions are compatible with PHPCS 3.8.0 up to PHPCS `master`. ### A collection of static properties and methods for often-used token groups @@ -66,7 +66,7 @@ Supports PHPUnit 4.x up to 9.x. Normally to use the latest version of PHP_CodeSniffer native utility functions, you would have to raise the minimum requirements of your external PHPCS standard. -Now you won't have to anymore. This package allows you to use the latest version of those utility functions in all PHP_CodeSniffer versions from PHPCS 3.7.1 and up. +Now you won't have to anymore. This package allows you to use the latest version of those utility functions in all PHP_CodeSniffer versions from PHPCS 3.8.0 and up. ### Fully documented @@ -78,7 +78,7 @@ To see detailed information about all the available abstract sniffs, utility fun ## Minimum Requirements * PHP 5.4 or higher. -* [PHP_CodeSniffer] 3.7.1+. +* [PHP_CodeSniffer] 3.8.0+. * Recommended PHP extensions for optimal functionality: - PCRE with Unicode support (normally enabled by default) diff --git a/Tests/BackCompat/Helper/GetVersionTest.php b/Tests/BackCompat/Helper/GetVersionTest.php index 1667387e..16b0d4a9 100644 --- a/Tests/BackCompat/Helper/GetVersionTest.php +++ b/Tests/BackCompat/Helper/GetVersionTest.php @@ -32,7 +32,7 @@ final class GetVersionTest extends TestCase * * @var string */ - const DEVMASTER = '3.7.2'; + const DEVMASTER = '3.8.0'; /** * Test the method. @@ -49,7 +49,7 @@ public function testGetVersion() } if ($expected === 'lowest') { - $expected = '3.7.1'; + $expected = '3.8.0'; } $result = Helper::getVersion(); diff --git a/Tests/Tokens/TokenHelper/TokenExistsTest.php b/Tests/Tokens/TokenHelper/TokenExistsTest.php index 711f8c4b..0dc01ee3 100644 --- a/Tests/Tokens/TokenHelper/TokenExistsTest.php +++ b/Tests/Tokens/TokenHelper/TokenExistsTest.php @@ -58,7 +58,7 @@ public function testTokenExists($name, $expected) * {@internal This dataprovider does not currently contain any tests for * PHP native tokens which may not exist (depending on the PHPCS version). * These tests are not relevant at this time with the current minimum - * PHPCS version of 3.7.1, but this may change again in the future.} + * PHPCS version, but this may change again in the future.} * * @return array */ diff --git a/Tests/Utils/Arrays/GetDoubleArrowPtrTest.php b/Tests/Utils/Arrays/GetDoubleArrowPtrTest.php index 52ae8546..1ef4f0f2 100644 --- a/Tests/Utils/Arrays/GetDoubleArrowPtrTest.php +++ b/Tests/Utils/Arrays/GetDoubleArrowPtrTest.php @@ -210,7 +210,8 @@ public static function dataGetDoubleArrowPtr() 'expected' => 8, ], // Test specifically for PHPCS 3.5.3 and 3.5.4 in which all "fn" tokens were tokenized as T_FN. - // While PHPCS < 3.7.1 is no longer supported, the test remains to safeguard against tokenizer regressions. + // While these PHPCS versions are no longer supported, the test remains to safeguard against + // tokenizer regressions. 'test-arrow-access-to-property-named-fn-as-key-phpcs-3.5.3-3.5.4' => [ 'testMarker' => '/* testKeyPropertyAccessFnPHPCS353-354 */', 'expected' => 12, diff --git a/composer.json b/composer.json index a820d0af..bd5c4ae0 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "require" : { "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.7.1 || 4.0.x-dev@dev", + "squizlabs/php_codesniffer" : "^3.8.0 || 4.0.x-dev@dev", "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0" }, "require-dev" : { From 2f73b9664a68d99d546adbad8d4f13930354c73a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 13 Nov 2023 22:21:11 +0100 Subject: [PATCH 3/3] Remove work-arounds which were in place for PHPCS < 3.8.0 --- PHPCSUtils/Tokens/Collections.php | 60 +++---------------- .../Collections/ArrayOpenTokensBCTest.php | 4 -- .../Tokens/Collections/ArrayTokensBCTest.php | 5 -- .../Collections/ListOpenTokensBCTest.php | 4 -- Tests/Tokens/Collections/ListTokensBCTest.php | 5 -- .../ParameterPassingTokensTest.php | 4 -- .../ShortArrayListOpenTokensBCTest.php | 4 -- .../Collections/ShortArrayTokensBCTest.php | 5 -- .../Collections/ShortListTokensBCTest.php | 5 -- 9 files changed, 7 insertions(+), 89 deletions(-) diff --git a/PHPCSUtils/Tokens/Collections.php b/PHPCSUtils/Tokens/Collections.php index a84846f0..c8465152 100644 --- a/PHPCSUtils/Tokens/Collections.php +++ b/PHPCSUtils/Tokens/Collections.php @@ -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; } /** @@ -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; } /** @@ -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; } /** @@ -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; } /** @@ -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; } /** @@ -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; } /** @@ -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; } } diff --git a/Tests/Tokens/Collections/ArrayOpenTokensBCTest.php b/Tests/Tokens/Collections/ArrayOpenTokensBCTest.php index 12568b4e..2f581b75 100644 --- a/Tests/Tokens/Collections/ArrayOpenTokensBCTest.php +++ b/Tests/Tokens/Collections/ArrayOpenTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ArrayTokensBCTest.php b/Tests/Tokens/Collections/ArrayTokensBCTest.php index 009b825e..7a5be5ba 100644 --- a/Tests/Tokens/Collections/ArrayTokensBCTest.php +++ b/Tests/Tokens/Collections/ArrayTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ListOpenTokensBCTest.php b/Tests/Tokens/Collections/ListOpenTokensBCTest.php index 487d8942..ddbcc615 100644 --- a/Tests/Tokens/Collections/ListOpenTokensBCTest.php +++ b/Tests/Tokens/Collections/ListOpenTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ListTokensBCTest.php b/Tests/Tokens/Collections/ListTokensBCTest.php index fd94860b..d7a2eff8 100644 --- a/Tests/Tokens/Collections/ListTokensBCTest.php +++ b/Tests/Tokens/Collections/ListTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ParameterPassingTokensTest.php b/Tests/Tokens/Collections/ParameterPassingTokensTest.php index 9638edd6..e457f90d 100644 --- a/Tests/Tokens/Collections/ParameterPassingTokensTest.php +++ b/Tests/Tokens/Collections/ParameterPassingTokensTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ShortArrayListOpenTokensBCTest.php b/Tests/Tokens/Collections/ShortArrayListOpenTokensBCTest.php index 81526b2e..d85bf8c1 100644 --- a/Tests/Tokens/Collections/ShortArrayListOpenTokensBCTest.php +++ b/Tests/Tokens/Collections/ShortArrayListOpenTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ShortArrayTokensBCTest.php b/Tests/Tokens/Collections/ShortArrayTokensBCTest.php index 4c023e26..0d8d75bd 100644 --- a/Tests/Tokens/Collections/ShortArrayTokensBCTest.php +++ b/Tests/Tokens/Collections/ShortArrayTokensBCTest.php @@ -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()); } } diff --git a/Tests/Tokens/Collections/ShortListTokensBCTest.php b/Tests/Tokens/Collections/ShortListTokensBCTest.php index e2775f0a..5b403d4a 100644 --- a/Tests/Tokens/Collections/ShortListTokensBCTest.php +++ b/Tests/Tokens/Collections/ShortListTokensBCTest.php @@ -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()); } }