Skip to content

Commit 6277af1

Browse files
committed
Merge branch 'master' into feature/support-generics
2 parents becf13a + 72949bb commit 6277af1

File tree

136 files changed

+4832
-816
lines changed

Some content is hidden

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

136 files changed

+4832
-816
lines changed

.github/release-checklist.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Release checklist
2+
3+
## Before Release
4+
5+
### General
6+
7+
- [ ] Verify, and if necessary, update the version constraints for dependencies in the `composer.json` - PR #xxx
8+
- [ ] Verify that any new functions have type declarations (ClassName/array/callable) whenever possible.
9+
- [ ] Verify that the license tags all refer to the _new_ organisation and no longer to Squizlabs. (easily overlooked in new files)
10+
- [ ] Verify that `@copyright` tags in new files use `@copyright 20xx PHPCSStandards and contributors`.
11+
12+
### Wiki
13+
14+
- [ ] Fetch changes and check against vandalism.
15+
- [ ] Verify that any new `public` properties are listed on the Customizable Properties page in the Wiki.
16+
- [ ] Verify that any new sniffs which have `public` properties are listed on the Customizable Properties page in the Wiki.
17+
- [ ] Verify that any new CLI options are listed in the Wiki.
18+
- [ ] Verify that any new Reports have a section in the Reports page in the Wiki.
19+
20+
### Majors only
21+
22+
- [ ] Move old changelog entries to `CHANGELOG_OLD.md` file.
23+
- [ ] Verify that everything deprecated during the previous major was removed.
24+
- [ ] Update the wiki for any references to anything deprecated/removed.
25+
- [ ] Change `Config::STABILITY` from "dev" to "stable" for the branch for the new major. - PR #xxx
26+
27+
### Prepare changelog
28+
29+
- [ ] Prepare changelog for the release and submit the PR. - PR #xxx
30+
- Based on the tickets in the milestone.
31+
- Double-check that any issues which were closed by PRs included in the release, have the milestone set.
32+
- Compare with auto-generated release notes to ensure nothing is missed.
33+
- :pencil2: Remember to add a release link at the bottom!
34+
- [ ] Prepare extra sections for the GH release notes.
35+
- Use "New contributors" list from the auto-generated notes.
36+
- Use the milestone to gather the stats.
37+
- Add sponsor link.
38+
- Remove square brackets from all ticket links or make them proper full links (as GH markdown parser doesn't parse these correctly).
39+
- Change all contributor links to full inline links (as GH markdown parser on the Releases page doesn't parse these correctly).
40+
```md
41+
---
42+
43+
### New Contributors
44+
45+
The PHP_CodeSniffer project is happy to welcome the following new contributors:
46+
@...., @....
47+
48+
### Statistics
49+
50+
**Closed**: # issues
51+
**Merged**: ## pull requests
52+
53+
If you like to stay informed about releases and more, follow [@phpcs on Mastodon](https://phpc.social/@phpcs) or [@PHP_CodeSniffer on X](https://x.com/PHP_CodeSniffer).
54+
55+
Please consider [funding the PHP_CodeSniffer project](https://opencollective.com/php_codesniffer). If you already do so: thank you!
56+
```
57+
58+
### Milestone
59+
60+
- [ ] Close the milestone
61+
- [ ] Open a new milestone for the next release
62+
- [ ] If any open PRs/issues which were milestoned for this release did not make it into the release, update their milestone.
63+
64+
65+
## Release
66+
67+
- [ ] Merge the changelog PR.
68+
For now, cherrypick the changelog to the 4.0 branch.
69+
- [ ] Make sure all CI builds for `master` are green.
70+
- [ ] Create a tag for the release & push it.
71+
- [ ] Make sure all CI builds are green.
72+
- [ ] Download the PHAR files from the GH Actions test build page.
73+
- [ ] Sign the PHAR files using:
74+
```bash
75+
gpg -u [email protected] --detach-sign --output phpcs.phar.asc phpcs.phar
76+
gpg -u [email protected] --detach-sign --output phpcbf.phar.asc phpcbf.phar
77+
gpg -u [email protected] --detach-sign --output phpcs-x.x.x.phar.asc phpcs-x.x.x.phar
78+
gpg -u [email protected] --detach-sign --output phpcbf-x.x.x.phar.asc phpcbf-x.x.x.phar
79+
```
80+
- If, for whatever reason, the key is no longer available or has expired:
81+
-> generate a new key following the steps here: <https://phar.io/howto/generate-gpg-key.html>.
82+
-> upload the new key following the steps here: <https://phar.io/howto/uploading-public-keys.html>.
83+
-> update the key information in the README x 3.
84+
-> update the key info in the verify-release GHA workflow.
85+
- [ ] Get the SHA of the files for the phive.xml file
86+
```bash
87+
# Linux
88+
sha256sum ./phpcs-x.x.x.phar
89+
sha256sum ./phpcbf-x.x.x.phar
90+
91+
# Windows
92+
certutil -hashfile ./phpcs-x.x.x.phar SHA256
93+
certutil -hashfile ./phpcbf-x.x.x.phar SHA256
94+
```
95+
- Update the `gh-pages` branch:
96+
- [ ] Add the new release to the `phive.xml` file.
97+
- [ ] Add the versioned PHAR files + keys in PHAR dir.
98+
- [ ] Add the unversioned PHAR files + keys in root dir.
99+
- [ ] Verify the attestations of the PHAR files.
100+
```bash
101+
gh attestation verify phpcs.phar -o PHPCSStandards
102+
gh attestation verify phpcbf.phar -o PHPCSStandards
103+
gh attestation verify phars/phpcs-x.x.x.phar -o PHPCSStandards
104+
gh attestation verify phars/phpcbf-x.x.x.phar -o PHPCSStandards
105+
```
106+
- [ ] Commit & push the changes.
107+
- [ ] Verify that the website regenerated correctly and that the phars can be downloaded.
108+
- [ ] Create a release & copy & paste the changelog to it.
109+
- [ ] Upload the unversioned PHAR files + asc files to the release.
110+
- [ ] Announce the release in the discussions forum by checking the checkbox at the bottom of the release page.
111+
- [ ] Make sure all CI builds are green, including the verify-release workflow.
112+
113+
114+
## After Release
115+
116+
- [ ] Update the version number in the `Config::VERSION` class constant in the `src/Config.php` file to the _next_ (patch) version.
117+
This can always be adjusted again later if needs be if it is decided that the next version will be a minor/major, but at least for dev
118+
it should clearly show that this is bleeding edge/unreleased.
119+
- [ ] Close release announcement in the "Discussions" for previous minors (leave the announcements related to the current minor open).
120+
121+
122+
### Publicize
123+
124+
- [ ] Post on Mastodon about the release (official account).
125+
- [ ] Post on X about the release (official account).
126+
- [ ] Post on LinkedIn (personal account).

.github/workflows/build-phar.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- master
99
paths:
1010
- '.github/workflows/build-phar.yml'
11+
- '.github/workflows/reusable-build-phar.yml'
1112
- 'scripts/build-phar.php'
1213
- 'autoload.php'
1314
- 'src/Config.php'
@@ -18,6 +19,7 @@ on:
1819
pull_request:
1920
paths:
2021
- '.github/workflows/build-phar.yml'
22+
- '.github/workflows/reusable-build-phar.yml'
2123
- 'scripts/build-phar.php'
2224
- 'autoload.php'
2325
- 'src/Config.php'
@@ -37,35 +39,13 @@ concurrency:
3739

3840
jobs:
3941
build:
40-
runs-on: ubuntu-latest
41-
4242
strategy:
4343
matrix:
4444
# Deliberately missing PHP 8.0 as that PHAR is build and used in the test workflow.
45-
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.1', '8.2', '8.3', '8.4', '8.5']
45+
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.1', '8.2', '8.3', '8.4', 'nightly']
4646

4747
name: "Build Phar on PHP: ${{ matrix.php }}"
4848

49-
continue-on-error: ${{ matrix.php == '8.5' }}
50-
51-
steps:
52-
- name: Checkout code
53-
uses: actions/checkout@v4
54-
55-
- name: Setup PHP
56-
uses: shivammathur/setup-php@v2
57-
with:
58-
php-version: ${{ matrix.php }}
59-
coverage: none
60-
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On
61-
62-
- name: Build the phars
63-
run: php scripts/build-phar.php
64-
65-
# Both the below only check a file which is rarely changed and therefore unlikely to have issues.
66-
# This test is about testing that the phars are functional, *not* about whether the code style complies.
67-
- name: 'PHPCS: check code style using the Phar file to test the Phar is functional'
68-
run: php phpcs.phar ./scripts
69-
70-
- name: 'PHPCBF: fix code style using the Phar file to test the Phar is functional'
71-
run: php phpcbf.phar ./scripts
49+
uses: ./.github/workflows/reusable-build-phar.yml
50+
with:
51+
phpVersion: ${{ matrix.php }}

.github/workflows/quicktest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727

2828
strategy:
2929
matrix:
30-
os: ['ubuntu-latest', 'windows-latest']
30+
os: ['ubuntu-24.04-arm', 'windows-latest']
3131
php: ['7.2', 'latest']
3232

3333
include:
3434
- php: '5.4'
35-
os: 'ubuntu-latest'
35+
os: 'ubuntu-24.04-arm'
3636
custom_ini: false
3737
# Installing on Windows with PHP 5.4 runs into all sorts of problems with Composer.
3838
# See this issue for more context (yes, I've seen this problem before):
@@ -41,7 +41,7 @@ jobs:
4141
os: 'windows-latest'
4242
custom_ini: false
4343

44-
name: "QuickTest: PHP ${{ matrix.php }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
44+
name: "QuickTest: PHP ${{ matrix.php }} (${{ matrix.os == 'windows-latest' && 'Win' || 'Linux ARM' }})"
4545

4646
steps:
4747
- name: Prepare git to leave line endings alone
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build PHAR files
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
phpVersion:
7+
description: "The PHP version to use. Defaults to PHP 8.0 as used for the releases."
8+
type: string
9+
required: false
10+
default: '8.0'
11+
uploadArtifacts:
12+
description: "Whether or not to upload the artifacts. Defaults to false."
13+
type: boolean
14+
required: false
15+
default: false
16+
retentionDays:
17+
description: "How long uploaded artifacts should remain available (in days). Defaults to 1 day."
18+
type: string
19+
required: false
20+
default: 1
21+
createAttestations:
22+
description: "Whether or not to create attestations for the artifacts. Defaults to false."
23+
type: boolean
24+
required: false
25+
default: false
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
name: "Build Phar on PHP: ${{ inputs.phpVersion }}"
31+
32+
continue-on-error: ${{ inputs.phpVersion == 'nightly' }}
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Setup PHP
39+
uses: shivammathur/setup-php@v2
40+
with:
41+
php-version: ${{ inputs.phpVersion }}
42+
coverage: none
43+
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On
44+
45+
- name: Build the phar files
46+
run: php scripts/build-phar.php
47+
48+
# Provide provenance for generated binaries.
49+
- name: Generate artifact attestations
50+
if: ${{ inputs.createAttestations == true }}
51+
uses: actions/attest-build-provenance@v2
52+
with:
53+
subject-path: |
54+
${{ github.workspace }}/phpcs.phar
55+
${{ github.workspace }}/phpcbf.phar
56+
57+
- name: Upload the PHPCS phar
58+
if: ${{ inputs.uploadArtifacts == true }}
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: phpcs-phar
62+
path: ./phpcs.phar
63+
if-no-files-found: error
64+
retention-days: ${{ inputs.retentionDays }}
65+
66+
- name: Upload the PHPCBF phar
67+
if: ${{ inputs.uploadArtifacts == true }}
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: phpcbf-phar
71+
path: ./phpcbf.phar
72+
if-no-files-found: error
73+
retention-days: ${{ inputs.retentionDays }}
74+
75+
# Both the below only check a file which is rarely changed and therefore unlikely to have issues.
76+
# This test is about testing that the phars are functional, *not* about whether the code style complies.
77+
- name: 'PHPCS: check code style using the Phar file to test the Phar is functional'
78+
run: php phpcs.phar ./scripts
79+
80+
- name: 'PHPCBF: fix code style using the Phar file to test the Phar is functional'
81+
run: php phpcbf.phar ./scripts

.github/workflows/test.yml

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,20 @@ jobs:
2222
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
2323
cancel-in-progress: true
2424

25-
runs-on: ubuntu-latest
2625
name: "Build Phar on PHP: 8.0"
2726

2827
permissions:
2928
id-token: write
3029
contents: read
3130
attestations: write
3231

33-
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v4
36-
37-
- name: Setup PHP
38-
uses: shivammathur/setup-php@v2
39-
with:
40-
php-version: '8.0'
41-
coverage: none
42-
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On
43-
44-
- name: Build the phar
45-
run: php scripts/build-phar.php
46-
47-
# Provide provenance for generated binaries.
32+
uses: ./.github/workflows/reusable-build-phar.yml
33+
with:
34+
uploadArtifacts: true
35+
retentionDays: 28
4836
# Only attests the build artifacts which will be used in the published releases as per the guidelines in "what to attest".
4937
# https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
50-
- name: Generate artifact attestations
51-
if: ${{ github.ref_type == 'tag' }}
52-
uses: actions/attest-build-provenance@v1
53-
with:
54-
subject-path: |
55-
${{ github.workspace }}/phpcs.phar
56-
${{ github.workspace }}/phpcbf.phar
57-
58-
- name: Upload the PHPCS phar
59-
uses: actions/upload-artifact@v4
60-
with:
61-
name: phpcs-phar
62-
path: ./phpcs.phar
63-
if-no-files-found: error
64-
retention-days: 28
65-
66-
- name: Upload the PHPCBF phar
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: phpcbf-phar
70-
path: ./phpcbf.phar
71-
if-no-files-found: error
72-
retention-days: 28
73-
74-
# Both the below only check a file which is rarely changed and therefore unlikely to have issues.
75-
# This test is about testing that the phars are functional, *not* about whether the code style complies.
76-
- name: 'PHPCS: check code style using the Phar file to test the Phar is functional'
77-
run: php phpcs.phar ./scripts
78-
79-
- name: 'PHPCBF: fix code style using the Phar file to test the Phar is functional'
80-
run: php phpcbf.phar ./scripts
38+
createAttestations: ${{ github.ref_type == 'tag' }}
8139

8240
test:
8341
# Cancels all previous runs of this particular job for the same branch that have not yet completed.
@@ -190,6 +148,7 @@ jobs:
190148
run: php "vendor/bin/phpunit" tests/AllTests.php --no-coverage
191149

192150
- name: 'PHPUnit: run select tests in CBF mode'
151+
if: ${{ matrix.skip_tests != true }}
193152
run: php "vendor/bin/phpunit" tests/AllTests.php --group CBF --exclude-group nothing --no-coverage
194153
env:
195154
PHP_CODESNIFFER_CBF: '1'

0 commit comments

Comments
 (0)