Skip to content

Commit

Permalink
Merge pull request #523 from PHPCSStandards/feature/switch-to-fork-of…
Browse files Browse the repository at this point in the history
…-phpcs

Switch to PHPCSStandards/PHP_CodeSniffer & raise minimum supported version
  • Loading branch information
jrfnl authored Dec 8, 2023
2 parents dc93c9a + 2f73b96 commit 5cd5676
Show file tree
Hide file tree
Showing 26 changed files with 40 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-phpcs-versionnr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: octokit/[email protected]
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 }}

Expand Down
22 changes: 11 additions & 11 deletions PHPCSUtils/BackCompat/BCFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @author Klaus Purer <[email protected]>
*
* @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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion PHPCSUtils/BackCompat/BCTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
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;
}
}
2 changes: 1 addition & 1 deletion PHPCSUtils/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCSUtils" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCSUtils" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<description>Utility methods for external PHPCS standards.</description>
</ruleset>
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/FindEndOfStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Phil Davis <[email protected]>
*
* @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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/FindExtendedClassNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author Phil Davis <[email protected]>
*
* @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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Phil Davis <[email protected]>
*
* @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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/GetMemberPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Phil Davis <[email protected]>
*
* @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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/GetMethodParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author George Mponos <[email protected]>
*
* @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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/GetMethodPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @author Juliette Reinders Folmer <[email protected]>
*
* @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;
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/IsReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Phil Davis <[email protected]>
*
* @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;
Expand Down
4 changes: 2 additions & 2 deletions Tests/BackCompat/Helper/GetVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class GetVersionTest extends TestCase
*
* @var string
*/
const DEVMASTER = '3.7.2';
const DEVMASTER = '3.8.0';

/**
* Test the method.
Expand All @@ -49,7 +49,7 @@ public function testGetVersion()
}

if ($expected === 'lowest') {
$expected = '3.7.1';
$expected = '3.8.0';
}

$result = Helper::getVersion();
Expand Down
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());
}
}
Loading

0 comments on commit 5cd5676

Please sign in to comment.