Skip to content

Commit 1127012

Browse files
authored
Merge pull request #41 from jakzal/php-8.1
Add PHP 8.1 support and drop 7.4
2 parents d89bd6d + 62eb7f8 commit 1127012

File tree

6 files changed

+31
-32
lines changed

6 files changed

+31
-32
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
name: Build and test
1616
strategy:
1717
matrix:
18-
php: [7.4, 8.0]
18+
php: ['8.0', '8.1']
1919
deps: [high]
2020
include:
21-
- php: 8.0
21+
- php: '8.1'
2222
deps: low
2323

2424
steps:
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Upload the phar
4444
uses: actions/upload-artifact@v1
45-
if: matrix.php == '7.4' && matrix.deps == 'high'
45+
if: matrix.php == '8.0' && matrix.deps == 'high'
4646
with:
4747
name: zalas-phpunit-injector-extension.phar
4848
path: build/zalas-phpunit-injector-extension.phar

Makefile

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IS_PHP8:=$(shell php -r 'echo (int)version_compare(PHP_VERSION, "8.0", ">=");')
1+
IS_PHP81:=$(shell php -r 'echo (int)version_compare(PHP_VERSION, "8.1", ">=");')
22

33
default: build
44

@@ -27,7 +27,7 @@ test: vendor cs deptrac phpunit infection
2727
test-min: update-min cs deptrac phpunit infection
2828
.PHONY: test-min
2929

30-
ifeq ($(IS_PHP8),1)
30+
ifeq ($(IS_PHP81),1)
3131
test-package:
3232
else
3333
test-package: package test-package-tools
@@ -36,32 +36,20 @@ endif
3636
.PHONY: test-package
3737

3838

39-
ifeq ($(IS_PHP8),1)
40-
cs:
41-
else
4239
cs: tools/php-cs-fixer
4340
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer --dry-run --allow-risky=yes --no-interaction --ansi --diff fix
44-
endif
4541
.PHONY: cs
4642

47-
ifeq ($(IS_PHP8),1)
48-
cs-fix:
49-
else
5043
cs-fix: tools/php-cs-fixer
5144
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer --allow-risky=yes --no-interaction --ansi fix
52-
endif
5345
.PHONY: cs-fix
5446

5547
deptrac: tools/deptrac
56-
tools/deptrac --no-interaction --ansi --formatter-graphviz-display=0
48+
tools/deptrac --no-interaction --ansi
5749
.PHONY: deptrac
5850

59-
ifeq ($(IS_PHP8),1)
60-
infection:
61-
else
6251
infection: tools/infection tools/infection.pubkey
63-
phpdbg -qrr ./tools/infection --no-interaction --formatter=progress --min-msi=95 --min-covered-msi=95 --only-covered --ansi
64-
endif
52+
phpdbg -qrr ./tools/infection --no-interaction --formatter=progress --min-msi=100 --min-covered-msi=100 --only-covered --ansi
6553
.PHONY: infection
6654

6755
phpunit: tools/phpunit
@@ -81,7 +69,7 @@ clean:
8169
find tests/phar/tools -not -path '*/\.*' -type f -delete
8270
.PHONY: clean
8371

84-
ifeq ($(IS_PHP8),1)
72+
ifeq ($(IS_PHP81),1)
8573
package:
8674
else
8775
package: tools/box
@@ -93,7 +81,7 @@ package: tools/box
9381

9482
cd build/phar && \
9583
composer remove phpunit/phpunit --no-update && \
96-
composer config platform.php 7.4 && \
84+
composer config platform.php 8.0 && \
9785
composer update --no-dev -o -a
9886

9987
tools/box compile
@@ -113,16 +101,16 @@ tools/php-cs-fixer:
113101
curl -Ls http://cs.symfony.com/download/php-cs-fixer-v2.phar -o tools/php-cs-fixer && chmod +x tools/php-cs-fixer
114102

115103
tools/deptrac:
116-
curl -Ls https://github.com/sensiolabs-de/deptrac/releases/download/0.10.0/deptrac.phar -o tools/deptrac && chmod +x tools/deptrac
104+
curl -Ls https://github.com/sensiolabs-de/deptrac/releases/download/0.19.1/deptrac.phar -o tools/deptrac && chmod +x tools/deptrac
117105

118106
tools/infection: tools/infection.pubkey
119-
curl -Ls https://github.com/infection/infection/releases/download/0.20.2/infection.phar -o tools/infection && chmod +x tools/infection
107+
curl -Ls https://github.com/infection/infection/releases/download/0.26.2/infection.phar -o tools/infection && chmod +x tools/infection
120108

121109
tools/infection.pubkey:
122-
curl -Ls https://github.com/infection/infection/releases/download/0.20.2/infection.phar.pubkey -o tools/infection.pubkey
110+
curl -Ls https://github.com/infection/infection/releases/download/0.26.2/infection.phar.pubkey -o tools/infection.pubkey
123111

124112
tools/box:
125-
curl -Ls https://github.com/humbug/box/releases/download/3.10.0/box.phar -o tools/box && chmod +x tools/box
113+
curl -Ls https://github.com/humbug/box/releases/download/3.14.0/box.phar -o tools/box && chmod +x tools/box
126114

127115
tests/phar/tools/phpunit:
128116
curl -Ls https://phar.phpunit.de/phpunit-9.phar -o tests/phar/tools/phpunit && chmod +x tests/phar/tools/phpunit

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Injects services from a PSR-11 dependency injection container to PHPUnit test cases",
44
"type": "library",
55
"require": {
6-
"php": "^7.4 || ~8.0.0",
6+
"php": "~8.0.0 || ~8.1.0",
77
"phpunit/phpunit": "^9.0",
88
"psr/container": "^1.0",
99
"zalas/injector": "^2.0"

infection.json.dist

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
"@default": true,
1313
"IdenticalEqual": false,
1414
"NotIdenticalNotEqual": false,
15-
"OneZeroInteger": {
15+
"Assignment": {
16+
"ignore": [
17+
"Zalas\\Injector\\PHPUnit\\Symfony\\Compiler\\Discovery\\ClassFinder::findClassInFile"
18+
]
19+
},
20+
"Increment": {
1621
"ignore": [
1722
"Zalas\\Injector\\PHPUnit\\Symfony\\Compiler\\Discovery\\ClassFinder::findClassInFile"
1823
]
@@ -29,6 +34,16 @@
2934
"Zalas\\Injector\\PHPUnit\\Symfony\\Compiler\\Discovery\\PropertyDiscovery::__construct",
3035
"Zalas\\Injector\\PHPUnit\\TestListener\\ServiceInjectorListener::startTest"
3136
]
37+
},
38+
"InstanceOf_": {
39+
"ignore": [
40+
"Zalas\\Injector\\PHPUnit\\Symfony\\TestCase\\SymfonyKernel::ensureKernelShutdown"
41+
]
42+
},
43+
"LogicalOr": {
44+
"ignore": [
45+
"Zalas\\Injector\\PHPUnit\\Symfony\\TestCase\\SymfonyKernel::ensureKernelShutdown"
46+
]
3247
}
3348
}
3449
}

manifest.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
</copyright>
1111

1212
<requires>
13-
<php version="^7.4 || ^8.0"/>
13+
<php version="^8.0"/>
1414
</requires>
1515
</phar>

src/Symfony/Compiler/Discovery/ClassFinder.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ private function findClassInFile(\SplFileInfo $phpFile): ?string
6969

7070
private function isNamespaceToken($tokens, int $index): bool
7171
{
72-
if (PHP_VERSION_ID < 80000) {
73-
return $this->extractTokens($tokens, $index - 2, 3) === [T_NAMESPACE, T_WHITESPACE, T_STRING];
74-
}
75-
7672
return $this->extractTokens($tokens, $index - 2, 3) === [T_NAMESPACE, T_WHITESPACE, T_NAME_QUALIFIED];
7773
}
7874

0 commit comments

Comments
 (0)