Skip to content

Commit

Permalink
TODO: CHECK ISSUE URL | Switch to PHPCSStandards/PHP_CodeSniffer
Browse files Browse the repository at this point in the history
The Squizlabs repo has been abandoned. The project continues in a fork in the PHPCSStandards organisation.

Note: I'm not changing the version constraints. All tags since 2.0.0 have been recreated in the PHPCSStandards fork, though the package name in those tags has not been changed.

Based on tests I've run, the package should install fine when old tags are requested, though if a user has a `composer.json` which _also_ includes `squizlabs/php_codesniffer` in their dependency chain, this means that both will be installed, which could lead to issues.

I recommend tagging a release straight-away. This should then allow _our_ dependencies to update their own requirements and version constraints and to release, to prevent these type of problems.

Ref:
* squizlabs/PHP_CodeSniffer#3814
  • Loading branch information
jrfnl committed Nov 23, 2023
1 parent 509bf37 commit 67a1e85
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cs.yml
Expand Up @@ -43,7 +43,7 @@ jobs:
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
composer remove --no-update --dev phpunit/phpunit --no-scripts --no-interaction
# Using PHPCS `master` as an early detection system for bugs upstream.
composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction
composer require --no-update phpcsstandards/php_codesniffer:"dev-master" --no-interaction
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
run: xmllint --noout --schema XMLSchema.xsd DocsXsd/phpcsdocs.xsd

- name: Validate PHPCSDebug ruleset against schema
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd PHPCSDebug/ruleset.xml
run: xmllint --noout --schema vendor/phpcsstandards/php_codesniffer/phpcs.xsd PHPCSDebug/ruleset.xml

- name: Validate docs against schema
run: xmllint --noout --schema DocsXsd/phpcsdocs.xsd ./PHPCSDebug/Docs/*/*Standard.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quicktest.yml
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: 'Composer: adjust dependencies'
run: |
# Set the PHPCS version to be used in the tests.
composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
composer require --no-update phpcsstandards/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts --no-interaction
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -109,7 +109,7 @@ jobs:
- name: 'Composer: adjust dependencies'
run: |
# Set the PHPCS version to be used in the tests.
composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
composer require --no-update phpcsstandards/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts --no-interaction
Expand Down
2 changes: 1 addition & 1 deletion PHPCSDebug/ruleset.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCSDebug" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCSDebug" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">

<description>Sniffs which can be used as debugging tools for PHPCS developers</description>

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -20,7 +20,7 @@ PHPCSDevTools for developers of PHP_CodeSniffer sniffs

</div>

This is a set of tools to assist developers of sniffs for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
This is a set of tools to assist developers of sniffs for [PHP CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).

* [Installation](#installation)
+ [Composer Project-based Installation](#composer-project-based-installation)
Expand Down Expand Up @@ -58,7 +58,7 @@ Composer will automatically install dependencies and register the PHPCSDebug sta

### Stand-alone Installation

* Install [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation).
* Install [PHP CodeSniffer](https://github.com/PHPCSStandards/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 PHPCSDevTools release](https://github.com/PHPCSStandards/PHPCSDevTools/releases) and unzip/untar it into an arbitrary directory.
You can also choose to clone this repository using git.
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -23,7 +23,7 @@
},
"require" : {
"php" : ">=5.4",
"squizlabs/php_codesniffer" : "^3.1.0",
"phpcsstandards/php_codesniffer" : "^3.1.0",
"dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0"
},
"require-dev" : {
Expand Down Expand Up @@ -58,10 +58,10 @@
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude .github/build"
],
"checkcs": [
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcs"
"@php ./vendor/phpcsstandards/php_codesniffer/bin/phpcs"
],
"fixcs": [
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
"@php ./vendor/phpcsstandards/php_codesniffer/bin/phpcbf"
],
"test": [
"@php ./vendor/phpunit/phpunit/phpunit"
Expand Down
4 changes: 2 additions & 2 deletions phpcs.xml.dist
@@ -1,11 +1,11 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Coding Standard for PHPCSDevTools" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Coding Standard for PHPCSDevTools" xsi:noNamespaceSchemaLocation="./vendor/phpcsstandards/php_codesniffer/phpcs.xsd">
<description>Check the code of the PHPCSDevTools standard itself.</description>

<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
#############################################################################
-->

Expand Down
4 changes: 2 additions & 2 deletions phpunit-bootstrap.php
Expand Up @@ -39,8 +39,8 @@
// This may be a Composer install.
if (\is_dir(__DIR__ . $ds . 'vendor')) {
$vendorDir = __DIR__ . $ds . 'vendor';
if ($phpcsDir === false && \is_dir($vendorDir . $ds . 'squizlabs' . $ds . 'php_codesniffer')) {
$phpcsDir = $vendorDir . $ds . 'squizlabs' . $ds . 'php_codesniffer';
if ($phpcsDir === false && \is_dir($vendorDir . $ds . 'phpcsstandards' . $ds . 'php_codesniffer')) {
$phpcsDir = $vendorDir . $ds . 'phpcsstandards' . $ds . 'php_codesniffer';
}
if ($phpcsUtilsDir === false && \is_dir($vendorDir . $ds . 'phpcsstandards' . $ds . 'phpcsutils')) {
$phpcsUtilsDir = $vendorDir . $ds . 'phpcsstandards' . $ds . 'phpcsutils';
Expand Down

0 comments on commit 67a1e85

Please sign in to comment.