Skip to content

Commit 7a0c437

Browse files
committed
Downgrade PHPUnit on 7.4 and 8.0
1 parent c7cac96 commit 7a0c437

11 files changed

+57
-18
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ jobs:
3939
coverage: "none"
4040
php-version: "${{ matrix.php-version }}"
4141

42+
- name: "Downgrade PHPUnit"
43+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
44+
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 --update-with-dependencies --ignore-platform-reqs"
45+
4246
- name: "Install dependencies"
4347
run: "composer install --no-interaction --no-progress"
4448

4549
- name: "Transform source code"
46-
if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' && matrix.php-version != '8.4'
50+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
4751
run: |
4852
composer install --no-interaction --no-progress --working-dir=compiler
4953
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}

.github/workflows/phar.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
- name: "Install dependencies"
4242
run: "composer install --no-interaction --no-progress"
4343

44+
# only sebastian/diff ^4 supports PHP 7.4 so we need that in the PHAR
45+
- name: "Downgrade PHPUnit"
46+
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 --update-with-dependencies --ignore-platform-reqs"
47+
4448
- name: "Install compiler dependencies"
4549
run: "composer install --no-interaction --no-progress --working-dir=compiler"
4650

.github/workflows/reflection-golden-test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
run: "composer install --no-interaction --no-progress"
101101

102102
- name: "Transform source code"
103-
if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' && matrix.php-version != '8.4'
103+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
104104
run: |
105105
composer install --no-interaction --no-progress --working-dir=compiler
106106
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
@@ -118,11 +118,15 @@ jobs:
118118
- name: "Checkout"
119119
uses: actions/checkout@v4
120120

121+
- name: "Downgrade PHPUnit"
122+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
123+
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 --update-with-dependencies --ignore-platform-reqs"
124+
121125
- name: "Install dependencies"
122126
run: "composer install --no-interaction --no-progress"
123127

124128
- name: "Transform source code"
125-
if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' && matrix.php-version != '8.4'
129+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
126130
run: |
127131
composer install --no-interaction --no-progress --working-dir=compiler
128132
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}

.github/workflows/static-analysis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,22 @@ jobs:
4848
ini-file: development
4949
extensions: mbstring
5050

51+
- name: "Downgrade PHPUnit"
52+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
53+
shell: bash
54+
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 --update-with-dependencies --ignore-platform-reqs"
55+
5156
- name: "Install dependencies"
5257
run: "composer install --no-interaction --no-progress"
5358

5459
- name: "Transform source code"
55-
if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' && matrix.php-version != '8.4'
60+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
5661
shell: bash
5762
run: |
5863
composer install --no-interaction --no-progress --working-dir=compiler
5964
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
6065
composer dump
6166
62-
6367
- name: "PHPStan"
6468
run: "make phpstan"
6569

.github/workflows/tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ jobs:
107107
ini-file: development
108108
ini-values: memory_limit=1G
109109

110-
- name: "Install PHPUnit 10.x"
111-
run: "composer remove --dev brianium/paratest && composer require --dev --with-all-dependencies phpunit/phpunit:^10 sebastian/diff:^5.0"
110+
- name: "Install dependencies"
111+
run: "composer install --no-interaction --no-progress"
112112

113113
- id: set-matrix
114114
run: echo "matrix=$(php .github/workflows/tests-levels-matrix.php)" >> $GITHUB_OUTPUT
@@ -175,12 +175,13 @@ jobs:
175175
ini-file: development
176176
ini-values: memory_limit=2G
177177

178+
- name: "Downgrade PHPUnit"
179+
shell: bash
180+
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 --update-with-dependencies --ignore-platform-reqs"
181+
178182
- name: "Install dependencies"
179183
run: "composer install --no-interaction --no-progress"
180184

181-
- name: "Downgrade PHPUnit"
182-
run: "composer require --dev phpunit/phpunit:^9.6 --update-with-dependencies"
183-
184185
- name: "Transform source code"
185186
shell: bash
186187
run: |

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
$includes[] = __DIR__ . '/deprecated-8.4.neon';
3434
}
3535

36+
if (PHP_VERSION_ID < 80100) {
37+
$includes[] = __DIR__ . '/old-phpunit.neon';
38+
} else {
39+
$includes[] = __DIR__ . '/new-phpunit.neon';
40+
}
3641
$config = [];
3742
$config['includes'] = $includes;
3843

build/new-phpunit.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Call to an undefined static method PHPUnit\\Framework\\TestCase\:\:assertFileNotExists\(\)\.$#'
5+
identifier: staticMethod.notFound
6+
count: 1
7+
path: ../src/Testing/LevelsTestCase.php

build/old-phpunit.neon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Instanceof references internal interface PHPUnit\\Exception\.$#'
5+
identifier: instanceof.internalInterface
6+
count: 1
7+
path: ../tests/PHPStan/Reflection/ReflectionProviderGoldenTest.php
8+
9+
-
10+
message: '''
11+
#^Call to deprecated method assertFileNotExists\(\) of class PHPUnit\\Framework\\Assert\:
12+
https\://github\.com/sebastianbergmann/phpunit/issues/4077$#
13+
'''
14+
identifier: staticMethod.deprecated
15+
count: 1
16+
path: ../src/Testing/LevelsTestCase.php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"react/promise": "^3.2",
3939
"react/socket": "^1.3",
4040
"react/stream": "^1.1",
41-
"sebastian/diff": "^4.0 || ^5.0",
41+
"sebastian/diff": "^5.0",
4242
"symfony/console": "^5.4.3",
4343
"symfony/finder": "^5.4.3",
4444
"symfony/polyfill-intl-grapheme": "^1.23",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,6 @@ parameters:
747747
count: 1
748748
path: src/Rules/RuleLevelHelper.php
749749

750-
-
751-
message: '#^Call to an undefined static method PHPUnit\\Framework\\TestCase\:\:assertFileNotExists\(\)\.$#'
752-
identifier: staticMethod.notFound
753-
count: 1
754-
path: src/Testing/LevelsTestCase.php
755-
756750
-
757751
message: '#^Call to function method_exists\(\) with ''PHPUnit\\\\Framework\\\\TestCase'' and ''assertFileDoesNotEx…'' will always evaluate to true\.$#'
758752
identifier: function.alreadyNarrowedType

0 commit comments

Comments
 (0)