Skip to content

Commit 6535567

Browse files
authored
Merge pull request #683 from PHPCSStandards/develop
Release 1.1.0
2 parents 87b233b + fbb5ce0 commit 6535567

File tree

256 files changed

+15232
-1180
lines changed

Some content is hidden

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

256 files changed

+15232
-1180
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
.gitattributes export-ignore
1010
.gitignore export-ignore
1111
.markdownlint-cli2.yaml export-ignore
12+
.phpdoc.xml.dist export-ignore
1213
.remarkignore export-ignore
1314
.remarkrc export-ignore
1415
.yamllint.yml export-ignore
1516
phpcs.xml.dist export-ignore
16-
phpdoc.dist.xml export-ignore
17-
phpdoc.xml.dist export-ignore
1817
phpstan.neon.dist export-ignore
1918
phpunit.xml.dist export-ignore
2019
phpunit10.xml.dist export-ignore

.github/workflows/basics.yml

Lines changed: 45 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,45 @@ jobs:
5555
# Bust the cache at least once a month - output format: YYYY-MM.
5656
custom-cache-suffix: $(date -u "+%Y-%m")
5757

58-
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
59-
# This should not be blocking for this job, so ignore any errors from this step.
60-
# Ref: https://github.com/dotnet/core/issues/4167
61-
- name: Update the available packages list
62-
continue-on-error: true
63-
run: sudo apt-get update
64-
65-
- name: Install xmllint
66-
run: sudo apt-get install --no-install-recommends -y libxml2-utils
67-
68-
# Show XML violations inline in the file diff.
69-
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
70-
- name: Enable showing XML issues inline
71-
uses: korelstar/xmllint-problem-matcher@v1
72-
73-
# Validate the XML file.
74-
# @link http://xmlsoft.org/xmllint.html
75-
- name: Validate rulesets against schema
76-
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
58+
# Validate the XML files.
59+
- name: Validate ruleset XML against schema
60+
uses: phpcsstandards/xmllint-validate@v1
61+
with:
62+
pattern: "./*/ruleset.xml"
63+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
64+
65+
- name: Validate Project PHPCS ruleset against schema
66+
uses: phpcsstandards/xmllint-validate@v1
67+
with:
68+
pattern: "phpcs.xml.dist"
69+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
70+
71+
- name: "Validate PHPUnit < 10 config for use with PHPUnit 8"
72+
uses: phpcsstandards/xmllint-validate@v1
73+
with:
74+
pattern: "phpunit.xml.dist"
75+
xsd-file: "vendor/phpunit/phpunit/schema/8.5.xsd"
76+
77+
- name: "Validate PHPUnit < 10 config for use with PHPUnit 9"
78+
uses: phpcsstandards/xmllint-validate@v1
79+
with:
80+
pattern: "phpunit.xml.dist"
81+
xsd-file: "vendor/phpunit/phpunit/schema/9.2.xsd"
82+
83+
- name: "Validate PHPUnit 10+ config for use with PHPUnit 10"
84+
uses: phpcsstandards/xmllint-validate@v1
85+
with:
86+
pattern: "phpunit10.xml.dist"
87+
xsd-file: "vendor/phpunit/phpunit/schema/10.5.xsd"
88+
89+
- name: "Validate PHPUnit 10+ config for use with PHPUnit 11"
90+
uses: phpcsstandards/xmllint-validate@v1
91+
with:
92+
pattern: "phpunit10.xml.dist"
93+
xsd-file: "vendor/phpunit/phpunit/phpunit.xsd"
7794

7895
# Check the code-style consistency of the XML file.
96+
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
7997
- name: Check XML code style
8098
run: diff -B ./PHPCSUtils/ruleset.xml <(xmllint --format "./PHPCSUtils/ruleset.xml")
8199

@@ -90,120 +108,20 @@ jobs:
90108

91109
phpstan:
92110
name: "PHPStan"
93-
runs-on: "ubuntu-latest"
94-
95-
steps:
96-
- name: Checkout code
97-
uses: actions/checkout@v4
98-
99-
- name: Install PHP
100-
uses: shivammathur/setup-php@v2
101-
with:
102-
php-version: 'latest'
103-
coverage: none
104-
tools: phpstan
105-
106-
# Install dependencies and handle caching in one go.
107-
# Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
108-
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
109-
- name: Install Composer dependencies
110-
uses: "ramsey/composer-install@v3"
111-
with:
112-
# Bust the cache at least once a month - output format: YYYY-MM.
113-
custom-cache-suffix: $(date -u "+%Y-%m")
114-
115-
- name: Run PHPStan
116-
run: phpstan analyse
111+
uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
112+
with:
113+
phpstanVersion: '2.x'
117114

118115
markdownlint:
119116
name: 'Lint Markdown'
120-
runs-on: ubuntu-latest
121-
122-
steps:
123-
- name: Checkout code
124-
uses: actions/checkout@v4
125-
126-
# @link https://github.com/marketplace/actions/problem-matcher-for-markdownlint-cli
127-
- name: Enable showing issue in PRs
128-
uses: xt0rted/markdownlint-problem-matcher@v3
129-
130-
# @link https://github.com/marketplace/actions/markdownlint-cli2-action
131-
- name: Check markdown with CLI2
132-
uses: DavidAnson/markdownlint-cli2-action@v16
117+
uses: PHPCSStandards/.github/.github/workflows/reusable-markdownlint.yml@main
133118

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

196123
yamllint:
197124
name: 'Lint Yaml'
198-
runs-on: ubuntu-latest
199-
200-
steps:
201-
- name: Checkout code
202-
uses: actions/checkout@v4
203-
204-
- name: Run Yamllint on all yaml files in repo
205-
run: yamllint . --format colored --strict
206-
207-
- name: Pipe Yamllint results on to GH for inline display
208-
if: ${{ failure() }}
209-
run: yamllint . --format github --strict
125+
uses: PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
126+
with:
127+
strict: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check PRs for merge conflicts
2+
3+
on:
4+
# Check for new conflicts due to merges.
5+
push:
6+
branches:
7+
- stable
8+
- develop
9+
# Check conflicts in new PRs and for resolved conflicts due to an open PR being updated.
10+
pull_request_target:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
16+
jobs:
17+
check-prs:
18+
runs-on: ubuntu-latest
19+
if: github.repository_owner == 'PHPCSStandards'
20+
21+
name: Check PRs for merge conflicts
22+
23+
steps:
24+
- name: Check PRs for merge conflicts
25+
uses: eps1lon/actions-label-merge-conflict@v3
26+
with:
27+
dirtyLabel: "Status: has merge conflict"
28+
repoToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/quicktest.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636
php: ['5.4', 'latest']
3737
phpcs_version: ['lowest', 'dev-master']
3838

39+
include:
40+
- php: '7.2'
41+
phpcs_version: '4.x-dev'
42+
- php: 'latest'
43+
phpcs_version: '4.x-dev'
44+
3945
name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
4046

4147
steps:
@@ -47,10 +53,10 @@ jobs:
4753
- name: Setup ini config
4854
id: set_ini
4955
run: |
50-
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
51-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
56+
if [ "${{ contains( matrix.phpcs_version, 'dev') }}" == "false" ]; then
57+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
5258
else
53-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
59+
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
5460
fi
5561
5662
- name: Install PHP
@@ -60,8 +66,12 @@ jobs:
6066
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
6167
coverage: none
6268

63-
- name: "Composer: set PHPCS version for tests (master)"
64-
if: ${{ matrix.phpcs_version != 'lowest' }}
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: ${{ contains( matrix.phpcs_version, 'dev') }}
6575
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
6676

6777
- name: "Composer: use lock file when necessary"
@@ -87,17 +97,20 @@ jobs:
8797
- name: Grab PHPUnit version
8898
id: phpunit_version
8999
# yamllint disable-line rule:line-length
90-
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
100+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
91101

92102
- name: Determine PHPUnit config file to use
93103
id: phpunit_config
94104
run: |
95-
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
96-
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
97-
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
105+
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
106+
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
107+
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
108+
elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
109+
echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT"
110+
echo 'EXTRA_ARGS=' >> "$GITHUB_OUTPUT"
98111
else
99-
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
100-
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
112+
echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
113+
echo 'EXTRA_ARGS= --repeat 2' >> "$GITHUB_OUTPUT"
101114
fi
102115
103116
- name: Run the unit tests without caching

0 commit comments

Comments
 (0)