Skip to content

Commit 18c3fbe

Browse files
authored
Merge branch '2.1.x' into gitlab-error-format-identifier
2 parents 23ab663 + 20f2f27 commit 18c3fbe

File tree

190 files changed

+4214
-641
lines changed

Some content is hidden

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

190 files changed

+4214
-641
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Downgrade code'
2+
description: 'Downgrade code'
3+
inputs:
4+
php-version:
5+
description: 'Original PHP version'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
11+
- name: "Change to simple-downgrade PHP version"
12+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
13+
uses: "shivammathur/setup-php@v2"
14+
with:
15+
coverage: "none"
16+
php-version: "8.4"
17+
18+
- name: "Transform source code"
19+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
20+
shell: bash
21+
run: |
22+
composer install --no-interaction --no-progress --working-dir=compiler
23+
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ inputs.php-version }}
24+
composer dump
25+
26+
- name: "Re-store PHP version"
27+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
28+
uses: "shivammathur/setup-php@v2"
29+
with:
30+
coverage: "none"
31+
php-version: "${{ inputs.php-version }}"
32+
ini-file: development
33+
extensions: ds,mbstring

.github/workflows/build-issue-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: "shivammathur/setup-php@v2"
4141
with:
4242
coverage: "none"
43-
php-version: "8.3"
43+
php-version: "8.5"
4444

4545
- uses: "ramsey/composer-install@v3"
4646

.github/workflows/issue-bot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: "shivammathur/setup-php@v2"
3939
with:
4040
coverage: "none"
41-
php-version: "8.3"
41+
php-version: "8.5"
4242

4343
- name: "Install issue-bot dependencies"
4444
uses: "ramsey/composer-install@v3"
@@ -89,7 +89,7 @@ jobs:
8989
uses: "shivammathur/setup-php@v2"
9090
with:
9191
coverage: "none"
92-
php-version: "8.3"
92+
php-version: "8.5"
9393

9494
- uses: "ramsey/composer-install@v3"
9595
with:
@@ -133,7 +133,7 @@ jobs:
133133
uses: "shivammathur/setup-php@v2"
134134
with:
135135
coverage: "none"
136-
php-version: "8.3"
136+
php-version: "8.5"
137137

138138
- name: "Install issue-bot dependencies"
139139
uses: "ramsey/composer-install@v3"

.github/workflows/lint.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,8 @@ jobs:
4646

4747
- uses: "ramsey/composer-install@v3"
4848

49-
- name: "Change to simple-downgrade PHP version"
50-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
51-
uses: "shivammathur/setup-php@v2"
52-
with:
53-
coverage: "none"
54-
php-version: "8.4"
55-
56-
- name: "Transform source code"
57-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
58-
run: |
59-
composer install --no-interaction --no-progress --working-dir=compiler
60-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
61-
composer dump
62-
63-
- name: "Re-store PHP version"
64-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
65-
uses: "shivammathur/setup-php@v2"
49+
- uses: ./.github/actions/downgrade-code
6650
with:
67-
coverage: "none"
6851
php-version: "${{ matrix.php-version }}"
6952

7053
- name: "Validate Composer"

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,9 @@ jobs:
5656

5757
- uses: "ramsey/composer-install@v3"
5858

59-
- name: "Change to simple-downgrade PHP version"
60-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
61-
uses: "shivammathur/setup-php@v2"
62-
with:
63-
coverage: "none"
64-
php-version: "8.4"
65-
ini-file: development
66-
extensions: mbstring
67-
68-
- name: "Transform source code"
69-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
70-
shell: bash
71-
run: |
72-
composer install --no-interaction --no-progress --working-dir=compiler
73-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
74-
composer dump
75-
76-
- name: "Re-store PHP version"
77-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
78-
uses: "shivammathur/setup-php@v2"
59+
- uses: ./.github/actions/downgrade-code
7960
with:
80-
coverage: "none"
8161
php-version: "${{ matrix.php-version }}"
82-
ini-file: development
83-
extensions: mbstring
8462

8563
- name: "PHPStan"
8664
run: "make phpstan"

.github/workflows/tests.yml

Lines changed: 89 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ jobs:
5050
tools: pecl
5151
extensions: ds,mbstring
5252
ini-file: development
53-
ini-values: memory_limit=2G
53+
ini-values: memory_limit=-1
5454

5555
- uses: "ramsey/composer-install@v3"
5656

57+
- name: "Check PHP configuration"
58+
run: "vendor/bin/phpunit --check-php-configuration"
59+
5760
- name: "Tests"
5861
run: "make tests"
5962

@@ -79,10 +82,13 @@ jobs:
7982
tools: pecl
8083
extensions: ds,mbstring
8184
ini-file: development
82-
ini-values: memory_limit=1G
85+
ini-values: memory_limit=-1
8386

8487
- uses: "ramsey/composer-install@v3"
8588

89+
- name: "Check PHP configuration"
90+
run: "vendor/bin/phpunit --check-php-configuration"
91+
8692
- name: "Tests"
8793
run: "make tests-integration"
8894

@@ -137,10 +143,13 @@ jobs:
137143
tools: pecl
138144
extensions: ds,mbstring
139145
ini-file: development
140-
ini-values: memory_limit=1G
146+
ini-values: memory_limit=-1
141147

142148
- uses: "ramsey/composer-install@v3"
143149

150+
- name: "Check PHP configuration"
151+
run: "vendor/bin/phpunit --check-php-configuration"
152+
144153
- name: "Tests"
145154
run: "${{ matrix.script }}"
146155

@@ -182,34 +191,87 @@ jobs:
182191
shell: bash
183192
run: "composer require --dev phpunit/phpunit:^9.6 brianium/paratest:^6.5 symfony/console:^5.4 symfony/process:^5.4 --update-with-dependencies --ignore-platform-reqs --working-dir=tests"
184193

185-
- name: "Change to simple-downgrade PHP version"
186-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
187-
uses: "shivammathur/setup-php@v2"
194+
- uses: ./.github/actions/downgrade-code
188195
with:
189-
coverage: "none"
190-
php-version: "8.4"
191-
tools: pecl
192-
extensions: ds,mbstring
193-
ini-file: development
194-
ini-values: memory_limit=2G
196+
php-version: "${{ matrix.php-version }}"
195197

196-
- name: "Transform source code"
197-
shell: bash
198-
run: |
199-
composer install --no-interaction --no-progress --working-dir=compiler
200-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
201-
composer dump
198+
- name: "Tests"
199+
run: "make tests"
202200

203-
- name: "Re-store PHP version"
204-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
205-
uses: "shivammathur/setup-php@v2"
201+
mutation-testing:
202+
name: "Mutation Testing"
203+
runs-on: "ubuntu-latest"
204+
needs: ["tests"]
205+
if: github.event_name == 'pull_request'
206+
207+
strategy:
208+
fail-fast: false
209+
matrix:
210+
php-version:
211+
- "8.2"
212+
- "8.3"
213+
- "8.4"
214+
operating-system: [ubuntu-latest]
215+
216+
steps:
217+
- name: "Checkout"
218+
uses: actions/checkout@v5
219+
220+
- name: "Checkout build-infection"
221+
uses: actions/checkout@v5
222+
with:
223+
repository: "phpstan/build-infection"
224+
path: "build-infection"
225+
ref: "1.x"
226+
227+
- uses: ./build-infection/.github/actions/setup-php
206228
with:
207-
coverage: "none"
208229
php-version: "${{ matrix.php-version }}"
209-
tools: pecl
210230
extensions: ds,mbstring
211-
ini-file: development
212-
ini-values: memory_limit=2G
213231

214-
- name: "Tests"
215-
run: "make tests"
232+
- name: "Install dependencies"
233+
run: "composer install --no-interaction --no-progress"
234+
235+
- name: "Install build-infection dependencies"
236+
working-directory: "build-infection"
237+
run: "composer install --no-interaction --no-progress"
238+
239+
- name: "Configure infection"
240+
run: |
241+
php build-infection/bin/infection-config.php \
242+
--source-directory='build/PHPStan/Build' \
243+
> infection.json5
244+
cat infection.json5 | jq
245+
246+
- name: "Determine default branch"
247+
id: default-branch
248+
run: |
249+
echo "name=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> $GITHUB_OUTPUT
250+
251+
- name: "Restore result cache"
252+
uses: actions/cache/restore@v4
253+
with:
254+
path: ./tmp
255+
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
256+
restore-keys: |
257+
result-cache-v1-${{ matrix.php-version }}-
258+
259+
- name: "Run infection"
260+
run: |
261+
git fetch --depth=1 origin ${{ steps.default-branch.outputs.name }}
262+
infection \
263+
--git-diff-base=origin/${{ steps.default-branch.outputs.name }} \
264+
--git-diff-lines \
265+
--ignore-msi-with-no-mutations \
266+
--min-msi=100 \
267+
--min-covered-msi=100 \
268+
--log-verbosity=all \
269+
--debug \
270+
--logger-text=php://stdout
271+
272+
- name: "Save result cache"
273+
uses: actions/cache/save@v4
274+
if: ${{ !cancelled() }}
275+
with:
276+
path: ./tmp
277+
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ lint:
116116
--exclude tests/PHPStan/Rules/Functions/data/closure-typehints-nodiscard.php \
117117
--exclude tests/PHPStan/Rules/Functions/data/typehints-nodiscard.php \
118118
--exclude tests/PHPStan/Rules/Methods/data/typehints-nodiscard.php \
119+
--exclude tests/PHPStan/Rules/Cast/data/deprecated-cast.php \
119120
src tests
120121

121122
install-paratest:

apigen/composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/PHPStan/Build/NamedArgumentsRule.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ private function processArgs(ExtendedParametersAcceptor $acceptor, Scope $scope,
116116

117117
$errorBuilders = [];
118118
$parameters = $acceptor->getParameters();
119+
if (count($parameters) !== count($normalizedArgs)) {
120+
return [];
121+
}
122+
119123
$defaultValueWasPassed = [];
120124
foreach ($normalizedArgs as $i => $normalizedArg) {
121125
if ($normalizedArg->unpack) {

build/ignore-by-php-version.neon.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
$includes[] = __DIR__ . '/new-phpunit.neon';
4242
}
4343

44+
if (PHP_VERSION_ID < 80500) {
45+
$includes[] = __DIR__ . '/pre-php-85.neon';
46+
}
47+
4448
$config = [];
4549
$config['includes'] = $includes;
4650

0 commit comments

Comments
 (0)