Skip to content

Commit b70cb3f

Browse files
committed
revert: commit 442a6a9 - "build: completely drop phpcs version 3.x."
This reverts commit 442a6a9.
1 parent ec4a348 commit b70cb3f

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

.github/workflows/unit-tests.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,26 @@ jobs:
6464
#
6565
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
6666
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
67-
phpcs_version: ["4.x-dev"]
67+
phpcs_version: ["lowest", "stable", "4.x-dev"]
68+
69+
exclude:
70+
- php: "8.3"
71+
phpcs_version: "lowest"
72+
73+
include:
74+
# Add some builds with variations of the dependency versions.
75+
- php: "8.4"
76+
phpcs_version: "stable"
77+
78+
# Test against dev versions of all dependencies with select PHP versions for early detection of issues.
79+
- php: "7.2"
80+
phpcs_version: "dev-master"
81+
- php: "7.2"
82+
phpcs_version: "4.x-dev"
83+
- php: "7.4"
84+
phpcs_version: "4.x-dev"
85+
- php: "8.2"
86+
phpcs_version: "4.x-dev"
6887

6988
name: "Test: PHP ${{ matrix.php }}"
7089

@@ -90,6 +109,14 @@ jobs:
90109
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
91110
coverage: none
92111

112+
- name: "Composer: set PHPCS version for tests (dev)"
113+
if: ${{ contains( matrix.phpcs_version, 'dev') }}
114+
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
115+
116+
- name: "Composer: use lock file when necessary"
117+
if: ${{ matrix.phpcs_version == 'lowest' }}
118+
run: composer config --unset lock
119+
93120
# Install dependencies and handle caching in one go.
94121
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
95122
- name: Install Composer dependencies
@@ -98,6 +125,10 @@ jobs:
98125
# Bust the cache at least once a month - output format: YYYY-MM.
99126
custom-cache-suffix: $(date -u "+%Y-%m")
100127

128+
- name: "Composer: set PHPCS version for tests (lowest)"
129+
if: ${{ matrix.phpcs_version == 'lowest' }}
130+
run: composer update squizlabs/php_codesniffer --prefer-lowest --no-scripts --no-interaction
131+
101132
- name: Composer info
102133
run: composer info
103134

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"php": ">=7.2",
21-
"squizlabs/php_codesniffer": "^4.0@dev",
21+
"squizlabs/php_codesniffer": "^3.13||^4.0@dev",
2222
"dealerdirect/phpcodesniffer-composer-installer": "^1.1"
2323
},
2424
"require-dev": {

phpunit-bootstrap.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@
3737

3838
exit(1);
3939
}
40+
41+
// Alias the PHPCS 3.x test case to the PHPCS 4.x name.
42+
if (class_exists('PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest') === true
43+
&& class_exists('PHP_CodeSniffer\Tests\Standards\AbstractSniffTestCase') === false
44+
) {
45+
class_alias(
46+
'PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest',
47+
'PHP_CodeSniffer\Tests\Standards\AbstractSniffTestCase'
48+
);
49+
}

0 commit comments

Comments
 (0)