Skip to content

Commit

Permalink
Composer: raise the minimum supported PHPCS version to 3.8.0
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
jrfnl committed Dec 7, 2023
1 parent 732219c commit 09bae71
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
20 changes: 10 additions & 10 deletions PHPCSUtils/BackCompat/BCFile.php
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 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
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
2 changes: 1 addition & 1 deletion Tests/Tokens/TokenHelper/TokenExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion Tests/Utils/Arrays/GetDoubleArrowPtrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down

0 comments on commit 09bae71

Please sign in to comment.