Skip to content

Commit fa4b8d0

Browse files
authored
Merge pull request #371 from PHPCSStandards/develop
Release PHPCSExtra 1.4.0
2 parents 8cb1a93 + 3b1fa46 commit fa4b8d0

File tree

94 files changed

+889
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+889
-299
lines changed

.github/workflows/basics.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ jobs:
3939
- name: Validate Composer installation
4040
run: composer validate --no-check-all --strict
4141

42+
# Use the WIP/develop branches of the Extra CS dependencies as an early detection system for bugs upstream.
4243
- name: 'Composer: adjust dependencies'
43-
run: |
44-
# Using PHPCS `master` as an early detection system for bugs upstream.
45-
composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction
44+
run: >
45+
composer require --no-update --no-scripts --no-interaction
46+
squizlabs/php_codesniffer:"dev-master"
47+
phpcsstandards/phpcsutils:"dev-develop"
4648
4749
# Install dependencies and handle caching in one go.
4850
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer

.github/workflows/quicktest.yml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ concurrency:
2020
jobs:
2121
#### QUICK TEST STAGE ####
2222
# This is a much quicker test which only runs the unit tests and linting against the low/high
23-
# supported PHP/PHPCS combinations.
23+
# supported PHP/PHPCS/PHPCSUtils combinations.
2424
# These are basically the same builds as in the Test->Coverage workflow, but then without doing
2525
# the code-coverage.
2626
quicktest:
@@ -29,9 +29,18 @@ jobs:
2929
strategy:
3030
matrix:
3131
php: ['5.4', 'latest']
32-
phpcs_version: ['lowest', 'dev-master']
32+
dependencies: ['lowest', 'stable', 'dev']
3333

34-
name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
34+
exclude:
35+
- php: '5.4'
36+
dependencies: 'dev'
37+
38+
include:
39+
# Replace the "low PHP" dev build for PHPCS 4.x.
40+
- php: '7.2'
41+
dependencies: 'dev'
42+
43+
name: "QTest${{ matrix.dependencies == 'stable' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"
3544

3645
steps:
3746
- name: Checkout code
@@ -41,12 +50,14 @@ jobs:
4150
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
4251
- name: Setup ini config
4352
id: set_ini
53+
# yamllint disable rule:line-length
4454
run: |
45-
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
55+
if [ "${{ matrix.dependencies == 'dev' }}" == "false" ]; then
4656
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
4757
else
4858
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
4959
fi
60+
# yamllint enable rule:line-length
5061
5162
- name: Install PHP
5263
uses: shivammathur/setup-php@v2
@@ -55,12 +66,19 @@ jobs:
5566
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
5667
coverage: none
5768

58-
- name: "Composer: set PHPCS version for tests (master)"
59-
if: ${{ matrix.phpcs_version != 'lowest' }}
60-
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
69+
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
70+
- name: 'Composer: remove PHPCSDevCS'
71+
run: composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
72+
73+
- name: "Composer: set PHPCS version for tests (dev)"
74+
if: ${{ matrix.dependencies == 'dev' }}
75+
run: >
76+
composer require --no-scripts --no-interaction
77+
squizlabs/php_codesniffer:"4.x-dev"
78+
phpcsstandards/phpcsutils:"dev-develop"
6179
6280
- name: "Composer: use lock file when necessary"
63-
if: ${{ matrix.phpcs_version == 'lowest' }}
81+
if: ${{ matrix.dependencies == 'lowest' }}
6482
run: composer config --unset lock
6583

6684
# Install dependencies and handle caching in one go.
@@ -72,15 +90,25 @@ jobs:
7290
custom-cache-suffix: $(date -u "+%Y-%m")
7391

7492
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
75-
if: ${{ matrix.phpcs_version == 'lowest' }}
93+
if: ${{ matrix.dependencies == 'lowest' }}
7694
run: >
7795
composer update --prefer-lowest --no-scripts --no-interaction
7896
squizlabs/php_codesniffer
7997
phpcsstandards/phpcsutils
8098
8199
- name: Lint against parse errors
82-
if: matrix.phpcs_version == 'dev-master'
100+
if: matrix.dependencies == 'stable'
83101
run: composer lint
84102

85-
- name: Run the unit tests
86-
run: composer test
103+
- name: Grab PHPCS version
104+
id: phpcs_version
105+
# yamllint disable-line rule:line-length
106+
run: echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
107+
108+
- name: Run the unit tests (PHPCS 3.x)
109+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
110+
run: composer test-phpcs3
111+
112+
- name: Run the unit tests (PHPCS 4.x)
113+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
114+
run: composer test-phpcs4

.github/workflows/test.yml

Lines changed: 119 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525

2626
strategy:
2727
matrix:
28-
php: ['5.4', '7.0', '7.4', '8.0', '8.4', '8.5']
28+
php: ['5.4', '7.0', '7.4', '8.0', '8.4', 'nightly']
2929

3030
name: "Lint: PHP ${{ matrix.php }}"
3131

32-
continue-on-error: ${{ matrix.php == '8.5' }}
32+
continue-on-error: ${{ matrix.php == 'nightly' }}
3333

3434
steps:
3535
- name: Checkout code
@@ -47,7 +47,7 @@ jobs:
4747
uses: "ramsey/composer-install@v3"
4848
with:
4949
# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies may allow it yet.
50-
composer-options: ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }}
50+
composer-options: ${{ matrix.php == 'nightly' && '--ignore-platform-req=php+' || '' }}
5151
# Bust the cache at least once a month - output format: YYYY-MM.
5252
custom-cache-suffix: $(date -u "+%Y-%m")
5353

@@ -68,9 +68,46 @@ jobs:
6868
#
6969
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
7070
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5']
71-
phpcs_version: ['lowest', 'dev-master']
72-
73-
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
71+
phpcs_version: ['lowest', 'stable', '4.x-dev']
72+
phpcsutils_version: ['stable']
73+
74+
exclude:
75+
- php: '5.5'
76+
phpcs_version: '4.x-dev'
77+
- php: '5.6'
78+
phpcs_version: '4.x-dev'
79+
- php: '7.0'
80+
phpcs_version: '4.x-dev'
81+
- php: '7.1'
82+
phpcs_version: '4.x-dev'
83+
84+
include:
85+
# Add some builds with variations of the dependency versions.
86+
# Note: the PHPCS low/stable + Utils stable combi is already run via the above matrix.
87+
# And the PHPCS low + Utils low combi is run in the code coverage builds.
88+
# So these are the only combis missing.
89+
- php: '5.4'
90+
phpcs_version: 'stable'
91+
phpcsutils_version: 'lowest'
92+
- php: '8.4'
93+
phpcs_version: 'stable'
94+
phpcsutils_version: 'lowest'
95+
96+
# Test against dev versions of all dependencies with select PHP versions for early detection of issues.
97+
- php: '5.4'
98+
phpcs_version: 'dev-master'
99+
phpcsutils_version: 'dev-develop'
100+
- php: '7.2'
101+
phpcs_version: 'dev-master'
102+
phpcsutils_version: 'dev-develop'
103+
- php: '7.4'
104+
phpcs_version: '4.x-dev'
105+
phpcsutils_version: 'dev-develop'
106+
- php: '8.2'
107+
phpcs_version: '4.x-dev'
108+
phpcsutils_version: 'dev-develop'
109+
110+
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - Utils ${{ matrix.phpcsutils_version }}"
74111

75112
continue-on-error: ${{ matrix.php == '8.5' }}
76113

@@ -82,12 +119,14 @@ jobs:
82119
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
83120
- name: Setup ini config
84121
id: set_ini
122+
# yamllint disable rule:line-length
85123
run: |
86-
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
124+
if [[ "${{ contains( matrix.phpcs_version, 'dev') }}" == "false" && "${{ contains( matrix.phpcsutils_version, 'dev') }}" == "false" ]]; then
87125
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
88126
else
89127
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
90128
fi
129+
# yamllint enable rule:line-length
91130
92131
- name: Install PHP
93132
uses: shivammathur/setup-php@v2
@@ -96,12 +135,19 @@ jobs:
96135
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
97136
coverage: none
98137

99-
- name: "Composer: set PHPCS version for tests (master)"
100-
if: ${{ matrix.phpcs_version != 'lowest' }}
138+
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
139+
- name: 'Composer: remove PHPCSDevCS'
140+
run: composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
141+
142+
- name: "Composer: set PHPCS version for tests (dev/specific version)"
143+
if: ${{ matrix.phpcs_version != 'lowest' && matrix.phpcs_version != 'stable' }}
101144
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
102145

103-
- name: "Composer: use lock file when necessary"
104-
if: ${{ matrix.phpcs_version == 'lowest' }}
146+
- name: "Composer: set PHPCSUtils version for tests (dev/specific version)"
147+
if: ${{ matrix.phpcsutils_version != 'lowest' && matrix.phpcsutils_version != 'stable' }}
148+
run: composer require phpcsstandards/phpcsutils:"${{ matrix.phpcsutils_version }}" --no-update --no-scripts --no-interaction
149+
150+
- name: "Composer: use lock file"
105151
run: composer config --unset lock
106152

107153
# Install dependencies and handle caching in one go.
@@ -114,19 +160,34 @@ jobs:
114160
# Bust the cache at least once a month - output format: YYYY-MM.
115161
custom-cache-suffix: $(date -u "+%Y-%m")
116162

117-
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
163+
- name: "Composer: set PHPCS version for tests (lowest)"
118164
if: ${{ matrix.phpcs_version == 'lowest' }}
119-
run: >
120-
composer update --prefer-lowest --no-scripts --no-interaction
121-
squizlabs/php_codesniffer
122-
phpcsstandards/phpcsutils
165+
run: composer update squizlabs/php_codesniffer --prefer-lowest --no-scripts --no-interaction
166+
167+
- name: "Composer: set PHPCSUtils version for tests (lowest)"
168+
if: ${{ matrix.phpcsutils_version == 'lowest' }}
169+
run: composer update phpcsstandards/phpcsutils --prefer-lowest --no-scripts --no-interaction
170+
171+
- name: Composer info
172+
run: composer info
173+
174+
- name: Grab PHPCS version
175+
id: phpcs_version
176+
# yamllint disable-line rule:line-length
177+
run: echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
178+
179+
- name: Run the unit tests (PHPCS 3.x)
180+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
181+
run: composer test-phpcs3
182+
183+
- name: Run the unit tests (PHPCS 4.x)
184+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
185+
run: composer test-phpcs4
123186

124-
- name: Run the unit tests
125-
run: composer test
126187

127188
#### CODE COVERAGE STAGE ####
128189
# N.B.: Coverage is only checked on the lowest and highest stable PHP versions
129-
# and a low/high of each major for PHPCS.
190+
# and a low/high for PHPCS and PHPCSUtils.
130191
# These builds are left out off the "test" stage so as not to duplicate test runs.
131192
coverage:
132193
# No use running the coverage builds if there are failing test builds.
@@ -139,9 +200,18 @@ jobs:
139200
strategy:
140201
matrix:
141202
php: ['5.4', '8.4']
142-
phpcs_version: ['lowest', 'dev-master']
203+
dependencies: ['lowest', 'stable', 'dev']
143204

144-
name: "Coverage: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
205+
exclude:
206+
- php: '5.4'
207+
dependencies: 'dev'
208+
209+
include:
210+
# Replace the "low PHP" dev build for PHPCS 4.x.
211+
- php: '7.2'
212+
dependencies: 'dev'
213+
214+
name: "Coverage: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"
145215

146216
steps:
147217
- name: Checkout code
@@ -151,12 +221,14 @@ jobs:
151221
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
152222
- name: Setup ini config
153223
id: set_ini
224+
# yamllint disable rule:line-length
154225
run: |
155-
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
226+
if [ "${{ matrix.dependencies == 'dev' }}" == "false" ]; then
156227
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
157228
else
158229
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
159230
fi
231+
# yamllint enable rule:line-length
160232
161233
- name: Install PHP
162234
uses: shivammathur/setup-php@v2
@@ -165,12 +237,19 @@ jobs:
165237
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
166238
coverage: xdebug
167239

168-
- name: "Composer: set PHPCS version for tests (master)"
169-
if: ${{ matrix.phpcs_version != 'lowest' }}
170-
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
240+
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
241+
- name: 'Composer: remove PHPCSDevCS'
242+
run: composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
243+
244+
- name: "Composer: set PHPCS version for tests (dev)"
245+
if: ${{ matrix.dependencies == 'dev' }}
246+
run: >
247+
composer require --no-scripts --no-interaction
248+
squizlabs/php_codesniffer:"4.x-dev"
249+
phpcsstandards/phpcsutils:"dev-develop"
171250
172251
- name: "Composer: use lock file when necessary"
173-
if: ${{ matrix.phpcs_version == 'lowest' }}
252+
if: ${{ matrix.dependencies == 'lowest' }}
174253
run: composer config --unset lock
175254

176255
# Install dependencies and handle caching in one go.
@@ -182,22 +261,32 @@ jobs:
182261
custom-cache-suffix: $(date -u "+%Y-%m")
183262

184263
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
185-
if: ${{ matrix.phpcs_version == 'lowest' }}
264+
if: ${{ matrix.dependencies == 'lowest' }}
186265
run: >
187266
composer update --prefer-lowest --no-scripts --no-interaction
188267
squizlabs/php_codesniffer
189268
phpcsstandards/phpcsutils
190269
191-
- name: Run the unit tests with code coverage
192-
run: composer coverage
270+
- name: Grab PHPCS version
271+
id: phpcs_version
272+
# yamllint disable-line rule:line-length
273+
run: echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
274+
275+
- name: Run the unit tests with code coverage (PHPCS 3.x)
276+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
277+
run: composer coverage-phpcs3
278+
279+
- name: Run the unit tests with code coverage (PHPCS 4.x)
280+
if: ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
281+
run: composer coverage-phpcs4
193282

194283
- name: Upload coverage results to Coveralls
195284
if: ${{ success() }}
196285
uses: coverallsapp/github-action@v2
197286
with:
198287
format: clover
199288
file: build/logs/clover.xml
200-
flag-name: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
289+
flag-name: php-${{ matrix.php }}-phpcs-${{ matrix.dependencies }}
201290
parallel: true
202291

203292
coveralls-finish:

.markdownlint-cli2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ config:
9393
# MD044/proper-names - Proper names should have the correct capitalization.
9494
MD044:
9595
# List of proper names.
96-
names: ["PHPCSUtils", "PHP", "PHP_CodeSniffer", "CodeSniffer", "PHPUnit"]
96+
names: ["PHPCSExtra", "Modernize", "NormalizedArrays", "Universal", "PHPCSUtils", "PHP", "PHP_CodeSniffer", "CodeSniffer", "PHPUnit"]
9797
# Include code blocks.
9898
code_blocks: false
9999

0 commit comments

Comments
 (0)