Skip to content

Commit

Permalink
Drop the PHPCS23Utils standard
Browse files Browse the repository at this point in the history
... which provided the basis of the compatibility layer with PHPCS 2.x. This is no longer needed now PHPCS 3.7.1 is the minimum PHPCS version.
  • Loading branch information
jrfnl committed Dec 24, 2022
1 parent 08826c2 commit 01e688a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 114 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ jobs:

# Check the code-style consistency of the XML file.
- name: Check XML code style
run: |
diff -B ./PHPCSUtils/ruleset.xml <(xmllint --format "./PHPCSUtils/ruleset.xml")
diff -B ./PHPCS23Utils/ruleset.xml <(xmllint --format "./PHPCS23Utils/ruleset.xml")
run: diff -B ./PHPCSUtils/ruleset.xml <(xmllint --format "./PHPCSUtils/ruleset.xml")

# Check the code-style consistency of the PHP files.
- name: Check PHP code style
Expand Down
52 changes: 0 additions & 52 deletions PHPCS23Utils/Sniffs/Load/LoadUtilsSniff.php

This file was deleted.

4 changes: 0 additions & 4 deletions PHPCS23Utils/ruleset.xml

This file was deleted.

4 changes: 1 addition & 3 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@
}

/*
* Alias the PHPCS 2.x classes to their PHPCS 3.x equivalent if necessary.
*
* Also alias the non-namespaced PHPUnit 4.x/5.x test case class to the
* Alias the non-namespaced PHPUnit 4.x/5.x test case class to the
* namespaced PHPUnit 6+ version.
*/
require_once \dirname(__DIR__) . '/phpcsutils-autoload.php';
Expand Down
52 changes: 0 additions & 52 deletions phpcsutils-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
* - If an external standard only supports PHPCS >= 3.1.0 and uses the PHPCS
* native unit test framework, this file does not need to be included.
*
* - When PHPCS 2.x support is desired, include the `"PHPCS23Utils"` standard
* in the ruleset of the external standard and this file will be included
* automatically.
* Including this file will allow PHPCSUtils to work in both PHPCS 2.x
* as well as PHPCS 3.x.
*
* - If an external standard uses its own unit test setup, this file should
* be included from the unit test bootstrap file.
*
Expand Down Expand Up @@ -52,52 +46,6 @@
define('PHPCSUTILS_AUTOLOAD', true);
}

if (defined('PHPCSUTILS_PHPCS_ALIASES_SET') === false) {
/*
* Alias a number of PHPCS 2.x classes to their PHPCS 3.x equivalents.
*
* {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
* a few "old" classes have been split and spread out over several "new"
* classes. In other words, this will only work for a limited number
* of classes.}}
*
* {@internal The `class_exists` wrappers are needed to play nice with other
* external PHPCS standards creating cross-version compatibility in a
* similar manner.}}
*/
if (interface_exists('\PHP_CodeSniffer_Sniff') === true
&& interface_exists('\PHP_CodeSniffer\Sniffs\Sniff') === false
) {
class_alias('\PHP_CodeSniffer_Sniff', '\PHP_CodeSniffer\Sniffs\Sniff');
}

if (class_exists('\PHP_CodeSniffer_File') === true
&& class_exists('\PHP_CodeSniffer\Files\File') === false
) {
class_alias('\PHP_CodeSniffer_File', '\PHP_CodeSniffer\Files\File');
}

if (class_exists('\PHP_CodeSniffer_Tokens') === true
&& class_exists('\PHP_CodeSniffer\Util\Tokens') === false
) {
class_alias('\PHP_CodeSniffer_Tokens', '\PHP_CodeSniffer\Util\Tokens');
}

if (class_exists('\PHP_CodeSniffer_Exception') === true
&& class_exists('\PHP_CodeSniffer\Exceptions\RuntimeException') === false
) {
class_alias('\PHP_CodeSniffer_Exception', '\PHP_CodeSniffer\Exceptions\RuntimeException');
}

if (class_exists('\PHP_CodeSniffer_Exception') === true
&& class_exists('\PHP_CodeSniffer\Exceptions\TokenizerException') === false
) {
class_alias('\PHP_CodeSniffer_Exception', '\PHP_CodeSniffer\Exceptions\TokenizerException');
}

define('PHPCSUTILS_PHPCS_ALIASES_SET', true);
}

if (defined('PHPCSUTILS_PHPUNIT_ALIASES_SET') === false) {
/*
* Alias the PHPUnit 4/5 TestCase class to its PHPUnit 6+ name.
Expand Down

0 comments on commit 01e688a

Please sign in to comment.