Skip to content

Commit 46d08eb

Browse files
authored
Merge pull request #332 from PHPCSStandards/develop
Release PHPCSExtra 1.3.0
2 parents 11d387c + cb73c4b commit 46d08eb

File tree

58 files changed

+805
-259
lines changed

Some content is hidden

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

58 files changed

+805
-259
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ You should be able to get the version numbers using the `composer info` command.
6060
-->
6161

6262
| Environment | Answer |
63-
|-------------------------|--------------------------------------------------------------------------------|
63+
| ----------------------- | ------------------------------------------------------------------------------ |
6464
| PHP version | x.y.z |
6565
| PHP_CodeSniffer version | x.y.z |
6666
| PHPCSExtra version | x.y.z |

.github/release-checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ PR for tracking changes for the x.x.x release. Target release date: **DOW MONTH
2424
- [ ] Fast-forward `develop` to be equal to `stable`
2525

2626
### Publicize
27+
- [ ] Toot about the release.
2728
- [ ] Tweet about the release.

.github/workflows/basics.yml

Lines changed: 61 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
env:
23-
XMLLINT_INDENT: ' '
2423
# - COMPOSER_ROOT_VERSION is needed to get round the recursive dependency when using CI.
2524
COMPOSER_ROOT_VERSION: '1.99.99'
2625

@@ -48,36 +47,41 @@ jobs:
4847
# Install dependencies and handle caching in one go.
4948
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
5049
- name: Install Composer dependencies
51-
uses: "ramsey/composer-install@v2"
50+
uses: "ramsey/composer-install@v3"
5251
with:
5352
# Bust the cache at least once a month - output format: YYYY-MM.
5453
custom-cache-suffix: $(date -u "+%Y-%m")
5554

56-
- name: Install xmllint
57-
run: |
58-
sudo apt-get update
59-
sudo apt-get install --no-install-recommends -y libxml2-utils
55+
# Validate XML files against schema.
56+
- name: Validate XML rulesets against schema
57+
uses: phpcsstandards/xmllint-validate@v1
58+
with:
59+
pattern: "./*/ruleset.xml"
60+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
6061

61-
# Show XML violations inline in the file diff.
62-
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
63-
- name: Enable showing XML issues inline
64-
uses: korelstar/xmllint-problem-matcher@v1
62+
- name: Validate documentation XML against schema
63+
uses: phpcsstandards/xmllint-validate@v1
64+
with:
65+
pattern: "./*/Docs/*/*Standard.xml"
66+
xsd-file: "vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd"
6567

66-
# Validate the Ruleset XML file.
67-
# @link http://xmlsoft.org/xmllint.html
68-
- name: Validate rulesets against schema
69-
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
68+
- name: Validate Project PHPCS ruleset against schema
69+
uses: phpcsstandards/xmllint-validate@v1
70+
with:
71+
pattern: "phpcs.xml.dist"
72+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
7073

71-
# Check the code-style consistency of the XML ruleset files.
72-
- name: Check XML code style
73-
run: |
74-
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
75-
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
76-
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
74+
- name: "Validate PHPUnit config for use with PHPUnit 8"
75+
uses: phpcsstandards/xmllint-validate@v1
76+
with:
77+
pattern: "phpunit.xml.dist"
78+
xsd-file: "vendor/phpunit/phpunit/schema/8.5.xsd"
7779

78-
# Validate the Documentation XML files.
79-
- name: Validate documentation against schema
80-
run: xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./*/Docs/*/*Standard.xml
80+
- name: "Validate PHPUnit config for use with PHPUnit 9"
81+
uses: phpcsstandards/xmllint-validate@v1
82+
with:
83+
pattern: "phpunit.xml.dist"
84+
xsd-file: "vendor/phpunit/phpunit/schema/9.2.xsd"
8185

8286
# Check the code-style consistency of the PHP files.
8387
- name: Check PHP code style
@@ -94,107 +98,50 @@ jobs:
9498
- name: Check sniff feature completeness
9599
run: composer check-complete
96100

97-
phpstan:
98-
name: "PHPStan"
99-
runs-on: "ubuntu-latest"
101+
xml-cs:
102+
name: 'XML Code style'
103+
runs-on: ubuntu-latest
104+
105+
env:
106+
XMLLINT_INDENT: ' '
100107

101108
steps:
102109
- name: Checkout code
103110
uses: actions/checkout@v4
104111

105-
- name: Install PHP
106-
uses: shivammathur/setup-php@v2
107-
with:
108-
php-version: 'latest'
109-
coverage: none
110-
tools: phpstan
112+
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
113+
# This should not be blocking for this job, so ignore any errors from this step.
114+
# Ref: https://github.com/dotnet/core/issues/4167
115+
- name: Update the available packages list
116+
continue-on-error: true
117+
run: sudo apt-get update
111118

112-
# Install dependencies and handle caching in one go.
113-
# Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
114-
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
115-
- name: Install Composer dependencies
116-
uses: "ramsey/composer-install@v2"
117-
with:
118-
# Bust the cache at least once a month - output format: YYYY-MM.
119-
custom-cache-suffix: $(date -u "+%Y-%m")
119+
- name: Install xmllint
120+
run: sudo apt-get install --no-install-recommends -y libxml2-utils
120121

121-
- name: Run PHPStan
122-
run: phpstan analyse
122+
# Show XML violations inline in the file diff.
123+
- name: Enable showing XML issues inline
124+
uses: korelstar/xmllint-problem-matcher@v1
123125

124-
remark:
125-
name: 'QA Markdown'
126-
runs-on: ubuntu-latest
126+
# Check the code-style consistency of the XML ruleset files.
127+
- name: Check XML code style
128+
run: |
129+
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
130+
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
131+
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
127132
128-
steps:
129-
- name: Checkout code
130-
uses: actions/checkout@v4
133+
phpstan:
134+
name: "PHPStan"
135+
uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
136+
with:
137+
phpstanVersion: '2.x'
131138

132-
- name: Set up node and enable caching of dependencies
133-
uses: actions/setup-node@v4
134-
with:
135-
node-version: '16'
136-
137-
# To make the command available on CLI, it needs to be installed globally.
138-
- name: Install Remark CLI globally
139-
run: npm install --global remark-cli --foreground-scripts true --fund false
140-
141-
# To allow for creating a custom config which references rules which are included
142-
# in the presets, without having to install all rules individually, a local install
143-
# works best (and installing the presets in the first place, of course).
144-
#
145-
# Note: the first group of packages are all part of the mono "Remark lint" repo.
146-
# The second group of packages (heading-whitespace and down) are additional
147-
# "external" rules/plugins.
148-
- name: Install Remark rules locally
149-
run: >
150-
npm install --foreground-scripts true --fund false
151-
remark-lint
152-
remark-gfm
153-
remark-preset-lint-consistent
154-
remark-preset-lint-recommended
155-
remark-preset-lint-markdown-style-guide
156-
remark-lint-checkbox-content-indent
157-
remark-lint-linebreak-style
158-
remark-lint-no-duplicate-defined-urls
159-
remark-lint-no-empty-url
160-
remark-lint-no-heading-like-paragraph
161-
remark-lint-no-reference-like-url
162-
remark-lint-no-unneeded-full-reference-image
163-
remark-lint-no-unneeded-full-reference-link
164-
remark-lint-strikethrough-marker
165-
remark-lint-heading-whitespace
166-
remark-lint-list-item-punctuation
167-
remark-lint-match-punctuation
168-
remark-lint-no-dead-urls
169-
remark-lint-no-hr-after-heading
170-
remark-lint-are-links-valid-duplicate
171-
remark-validate-links
172-
173-
- name: Run Remark-lint
174-
run: remark . --frail
175-
176-
# @link https://github.com/reviewdog/action-remark-lint
177-
- name: Show Remark-lint annotations in PR
178-
if: ${{ failure() && github.event_name == 'pull_request' }}
179-
uses: reviewdog/action-remark-lint@v5
180-
with:
181-
fail_on_error: true
182-
install_deps: false
183-
level: info
184-
reporter: github-pr-check
139+
remark:
140+
name: 'QA Markdown'
141+
uses: PHPCSStandards/.github/.github/workflows/reusable-remark.yml@main
185142

186143
yamllint:
187144
name: 'Lint Yaml'
188-
runs-on: ubuntu-latest
189-
190-
steps:
191-
- name: Checkout code
192-
uses: actions/checkout@v4
193-
194-
# Ref: https://yamllint.readthedocs.io/en/stable/
195-
- name: Run Yamllint on all yaml files in repo
196-
run: yamllint . --format colored
197-
198-
- name: Pipe Yamllint results on to GH for inline display
199-
if: ${{ failure() }}
200-
run: yamllint . --format github
145+
uses: PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
146+
with:
147+
strict: true

.github/workflows/label-remove-outdated.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Clean up labels on issue close
1818

1919
steps:
20-
- uses: mondeja/remove-labels-gh-action@v1
20+
- uses: mondeja/remove-labels-gh-action@v2
2121
with:
2222
token: ${{ secrets.GITHUB_TOKEN }}
2323
labels: |
@@ -31,7 +31,7 @@ jobs:
3131
name: Clean up labels on PR merge
3232

3333
steps:
34-
- uses: mondeja/remove-labels-gh-action@v1
34+
- uses: mondeja/remove-labels-gh-action@v2
3535
with:
3636
token: ${{ secrets.GITHUB_TOKEN }}
3737
labels: |
@@ -45,7 +45,7 @@ jobs:
4545
name: Clean up labels on PR close
4646

4747
steps:
48-
- uses: mondeja/remove-labels-gh-action@v1
48+
- uses: mondeja/remove-labels-gh-action@v2
4949
with:
5050
token: ${{ secrets.GITHUB_TOKEN }}
5151
labels: |

.github/workflows/quicktest.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
id: set_ini
4444
run: |
4545
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
46-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
46+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
4747
else
48-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
48+
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
4949
fi
5050
5151
- name: Install PHP
@@ -59,19 +59,24 @@ jobs:
5959
if: ${{ matrix.phpcs_version != 'lowest' }}
6060
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
6161

62+
- name: "Composer: use lock file when necessary"
63+
if: ${{ matrix.phpcs_version == 'lowest' }}
64+
run: composer config --unset lock
65+
6266
# Install dependencies and handle caching in one go.
6367
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
6468
- name: Install Composer dependencies
65-
uses: "ramsey/composer-install@v2"
69+
uses: "ramsey/composer-install@v3"
6670
with:
6771
# Bust the cache at least once a month - output format: YYYY-MM.
6872
custom-cache-suffix: $(date -u "+%Y-%m")
6973

7074
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
7175
if: ${{ matrix.phpcs_version == 'lowest' }}
7276
run: >
73-
composer update squizlabs/php_codesniffer phpcsstandards/phpcsutils
74-
--prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
77+
composer update --prefer-lowest --no-scripts --no-interaction
78+
squizlabs/php_codesniffer
79+
phpcsstandards/phpcsutils
7580
7681
- name: Lint against parse errors
7782
if: matrix.phpcs_version == 'dev-master'

.github/workflows/test.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ jobs:
3232
# @link https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
3333
#
3434
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
35-
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4']
35+
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']
3636
phpcs_version: ['lowest', 'dev-master']
3737

3838
name: "Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
3939

40-
continue-on-error: ${{ matrix.php == '8.4' }}
40+
continue-on-error: ${{ matrix.php == '8.5' }}
4141

4242
steps:
4343
- name: Checkout code
@@ -49,9 +49,9 @@ jobs:
4949
id: set_ini
5050
run: |
5151
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
52-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
52+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
5353
else
54-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
54+
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
5555
fi
5656
5757
- name: Install PHP
@@ -65,19 +65,24 @@ jobs:
6565
if: ${{ matrix.phpcs_version != 'lowest' }}
6666
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
6767

68+
- name: "Composer: use lock file when necessary"
69+
if: ${{ matrix.phpcs_version == 'lowest' }}
70+
run: composer config --unset lock
71+
6872
# Install dependencies and handle caching in one go.
6973
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
7074
- name: Install Composer dependencies
71-
uses: "ramsey/composer-install@v2"
75+
uses: "ramsey/composer-install@v3"
7276
with:
7377
# Bust the cache at least once a month - output format: YYYY-MM.
7478
custom-cache-suffix: $(date -u "+%Y-%m")
7579

7680
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
7781
if: ${{ matrix.phpcs_version == 'lowest' }}
7882
run: >
79-
composer update squizlabs/php_codesniffer phpcsstandards/phpcsutils
80-
--prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
83+
composer update --prefer-lowest --no-scripts --no-interaction
84+
squizlabs/php_codesniffer
85+
phpcsstandards/phpcsutils
8186
8287
- name: Lint against parse errors
8388
if: matrix.phpcs_version == 'dev-master'
@@ -100,7 +105,7 @@ jobs:
100105

101106
strategy:
102107
matrix:
103-
php: ['5.4', '8.3']
108+
php: ['5.4', '8.4']
104109
phpcs_version: ['lowest', 'dev-master']
105110

106111
name: "Coverage${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
@@ -115,9 +120,9 @@ jobs:
115120
id: set_ini
116121
run: |
117122
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
118-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
123+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
119124
else
120-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
125+
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
121126
fi
122127
123128
- name: Install PHP
@@ -132,19 +137,24 @@ jobs:
132137
if: ${{ matrix.phpcs_version != 'lowest' }}
133138
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
134139

140+
- name: "Composer: use lock file when necessary"
141+
if: ${{ matrix.phpcs_version == 'lowest' }}
142+
run: composer config --unset lock
143+
135144
# Install dependencies and handle caching in one go.
136145
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
137146
- name: Install Composer dependencies
138-
uses: "ramsey/composer-install@v2"
147+
uses: "ramsey/composer-install@v3"
139148
with:
140149
# Bust the cache at least once a month - output format: YYYY-MM.
141150
custom-cache-suffix: $(date -u "+%Y-%m")
142151

143152
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
144153
if: ${{ matrix.phpcs_version == 'lowest' }}
145154
run: >
146-
composer update squizlabs/php_codesniffer phpcsstandards/phpcsutils
147-
--prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
155+
composer update --prefer-lowest --no-scripts --no-interaction
156+
squizlabs/php_codesniffer
157+
phpcsstandards/phpcsutils
148158
149159
- name: Lint against parse errors
150160
if: matrix.phpcs_version == 'dev-master'

0 commit comments

Comments
 (0)