Skip to content

Commit 929e97b

Browse files
authored
Merge pull request #90 from phpDocumentor/php8-support
Php8 support
2 parents 425b26e + c2895bb commit 929e97b

File tree

11 files changed

+130
-1805
lines changed

11 files changed

+130
-1805
lines changed

.github/workflows/push.yml

Lines changed: 104 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,93 @@
1-
on: push
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
26
name: Qa workflow
7+
env:
8+
extensions: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib, fileinfo
9+
key: cache-v1 # can be any string, change to clear the extension cache.
10+
defaultPHPVersion: '7.3'
311
jobs:
4-
setup:
5-
runs-on: ubuntu-latest
6-
steps:
7-
- uses: actions/checkout@master
8-
- name: Restore/cache vendor folder
9-
uses: actions/cache@v1
10-
with:
11-
path: vendor
12-
key: all-build-${{ hashFiles('**/composer.lock') }}
13-
restore-keys: |
14-
all-build-${{ hashFiles('**/composer.lock') }}
15-
all-build-
16-
- name: Restore/cache tools folder
17-
uses: actions/cache@v1
18-
with:
19-
path: tools
20-
key: all-tools-${{ github.sha }}
21-
restore-keys: |
22-
all-tools-${{ github.sha }}-
23-
all-tools-
24-
- name: composer
25-
uses: docker://composer
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
with:
29-
args: install --no-interaction --prefer-dist --optimize-autoloader
30-
- name: Install phive
31-
run: make install-phive
32-
- name: Install PHAR dependencies
33-
run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5 --force-accept-unsigned
34-
3512
phpunit-with-coverage:
3613
runs-on: ubuntu-latest
3714
name: Unit tests
38-
needs: setup
3915
steps:
40-
- uses: actions/checkout@master
41-
- name: Restore/cache vendor folder
42-
uses: actions/cache@v1
43-
with:
44-
path: vendor
45-
key: all-build-${{ hashFiles('**/composer.lock') }}
46-
restore-keys: |
47-
all-build-${{ hashFiles('**/composer.lock') }}
48-
all-build-
49-
- name: Restore/cache tools folder
50-
uses: actions/cache@v1
51-
with:
52-
path: tools
53-
key: all-tools-${{ github.sha }}
54-
restore-keys: |
55-
all-tools-${{ github.sha }}-
56-
all-tools-
16+
- uses: actions/checkout@v2
17+
5718
- name: Install graphviz
5819
run: sudo apt-get update && sudo apt-get install -y graphviz
20+
5921
- name: Setup PHP
60-
uses: shivammathur/setup-php@master
22+
uses: shivammathur/setup-php@v2
6123
with:
62-
php-version: 7.2
63-
extension-csv: mbstring, simplexml
64-
ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1
65-
coverage: xdebug
66-
pecl: false
24+
php-version: ${{ env.defaultPHPVersion }}
25+
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
26+
tools: phive
27+
28+
- name: Get composer cache directory
29+
id: composer-cache
30+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
31+
32+
- name: Cache composer dependencies
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ steps.composer-cache.outputs.dir }}
36+
key: composer-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: composer-
38+
39+
- name: Install Composer dependencies
40+
run: |
41+
composer install --no-progress --prefer-dist --optimize-autoloader
42+
6743
- name: Run PHPUnit
6844
run: php vendor/bin/phpunit
69-
- name: Upload to Scrutinizer
70-
run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml
7145

7246
phpunit:
7347
runs-on: ${{ matrix.operating-system }}
7448
strategy:
7549
matrix:
7650
operating-system:
7751
- ubuntu-latest
78-
php-versions: ['7.2', '7.3', '7.4']
52+
php-versions: ['7.2', '7.3', '7.4', '8.0']
7953
name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
8054
needs:
81-
- setup
8255
- phpunit-with-coverage
8356
steps:
84-
- uses: actions/checkout@master
85-
- name: Restore/cache vendor folder
86-
uses: actions/cache@v1
87-
with:
88-
path: vendor
89-
key: all-build-${{ hashFiles('**/composer.lock') }}
90-
restore-keys: |
91-
all-build-${{ hashFiles('**/composer.lock') }}
92-
all-build-
93-
- name: Restore/cache tools folder
94-
uses: actions/cache@v1
95-
with:
96-
path: tools
97-
key: all-tools-${{ github.sha }}
98-
restore-keys: |
99-
all-tools-${{ github.sha }}-
100-
all-tools-
57+
- uses: actions/checkout@v2
58+
59+
- name: Install graphviz
60+
run: sudo apt-get update && sudo apt-get install -y graphviz
61+
10162
- name: Setup PHP
102-
uses: shivammathur/setup-php@master
63+
uses: shivammathur/setup-php@v2
10364
with:
10465
php-version: ${{ matrix.php-versions }}
10566
extension-csv: mbstring, simplexml
106-
ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1
107-
pecl: false
67+
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
68+
69+
- name: Get composer cache directory
70+
id: composer-cache
71+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
72+
73+
- name: Cache composer dependencies
74+
uses: actions/cache@v2
75+
with:
76+
path: ${{ steps.composer-cache.outputs.dir }}
77+
key: composer-${{ hashFiles('**/composer.lock') }}
78+
restore-keys: composer-
79+
80+
- name: Install Composer dependencies
81+
run: |
82+
composer install --no-progress --prefer-dist --optimize-autoloader
83+
10884
- name: Run PHPUnit
109-
continue-on-error: true
110-
run: php tools/phpunit
85+
run: php vendor/bin/phpunit
11186

11287
codestyle:
11388
runs-on: ubuntu-latest
114-
needs: [setup, phpunit]
11589
steps:
116-
- uses: actions/checkout@master
90+
- uses: actions/checkout@v2
11791
- name: Restore/cache vendor folder
11892
uses: actions/cache@v1
11993
with:
@@ -139,54 +113,63 @@ jobs:
139113

140114
phpstan:
141115
runs-on: ubuntu-latest
142-
needs: [setup, phpunit]
143116
steps:
144-
- uses: actions/checkout@master
145-
- name: Restore/cache vendor folder
146-
uses: actions/cache@v1
117+
- uses: actions/checkout@v2
118+
- name: Setup PHP
119+
uses: shivammathur/setup-php@v2
147120
with:
148-
path: vendor
149-
key: all-build-${{ hashFiles('**/composer.lock') }}
150-
restore-keys: |
151-
all-build-${{ hashFiles('**/composer.lock') }}
152-
all-build-
153-
- name: Restore/cache tools folder
154-
uses: actions/cache@v1
121+
php-version: ${{ env.defaultPHPVersion }}
122+
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
123+
tools: pecl
124+
125+
- name: Get composer cache directory
126+
id: composer-cache
127+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
128+
129+
- name: Cache composer dependencies
130+
uses: actions/cache@v2
155131
with:
156-
path: tools
157-
key: all-tools-${{ github.sha }}
158-
restore-keys: |
159-
all-tools-${{ github.sha }}-
160-
all-tools-
132+
path: ${{ steps.composer-cache.outputs.dir }}
133+
key: composer-${{ hashFiles('**/composer.lock') }}
134+
restore-keys: composer-
135+
136+
- name: Install Composer dependencies
137+
run: |
138+
composer install --no-progress --prefer-dist --optimize-autoloader
139+
161140
- name: PHPStan
162-
uses: docker://phpdoc/phpstan-ga:0.12
141+
uses: phpDocumentor/phpstan-ga@master
163142
env:
164143
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165144
with:
166-
args: analyse src tests --level max --configuration phpstan.neon
145+
args: analyse src tests --configuration phpstan.neon
167146

168147
psalm:
169148
runs-on: ubuntu-latest
170-
needs: [setup, phpunit]
171149
steps:
172-
- uses: actions/checkout@master
173-
- name: Restore/cache vendor folder
174-
uses: actions/cache@v1
150+
- uses: actions/checkout@v2
151+
152+
- name: Setup PHP
153+
uses: shivammathur/setup-php@v2
175154
with:
176-
path: vendor
177-
key: all-build-${{ hashFiles('**/composer.lock') }}
178-
restore-keys: |
179-
all-build-${{ hashFiles('**/composer.lock') }}
180-
all-build-
181-
- name: Restore/cache tools folder
182-
uses: actions/cache@v1
155+
php-version: 7.3
156+
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
157+
tools: pecl, psalm
158+
159+
- name: Get composer cache directory
160+
id: composer-cache
161+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
162+
163+
- name: Cache composer dependencies
164+
uses: actions/cache@v2
183165
with:
184-
path: tools
185-
key: all-tools-${{ github.sha }}
186-
restore-keys: |
187-
all-tools-${{ github.sha }}-
188-
all-tools-
166+
path: ${{ steps.composer-cache.outputs.dir }}
167+
key: composer-${{ hashFiles('**/composer.lock') }}
168+
restore-keys: composer-
169+
170+
- name: Install Composer dependencies
171+
run: |
172+
composer install --no-progress --prefer-dist --optimize-autoloader
173+
189174
- name: Psalm
190-
uses: docker://mickaelandrieu/psalm-ga
191-
env:
192-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
run: psalm --output-format=github

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ tools/
1515

1616
# By default the phpunit.xml.dist is provided; you can override this using a local config file
1717
phpunit.xml
18+
composer.lock

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,26 @@ install-phive:
1010
.PHONY: setup
1111
setup: install-phive
1212
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phar-ga:latest php tools/phive.phar install --force-accept-unsigned
13+
.PHONY: phpcbf
14+
phpcbf:
15+
docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf ${ARGS}
1316

1417
.PHONY: phpcs
1518
phpcs:
16-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M
19+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s
1720

1821
.PHONY: phpstan
1922
phpstan:
20-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpstan-ga:0.12 analyse src tests --no-progress --level max --configuration phpstan.neon
23+
docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src tests --configuration phpstan.neon ${ARGS}
2124

22-
.PHONY: psaml
25+
.PHONY: psalm
2326
psalm:
24-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project mickaelandrieu/psalm-ga
27+
docker run -it --rm -v${CURDIR}:/data -w /data php:7.3 ./tools/psalm
2528

2629
.PHONY: test
2730
test:
2831
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 vendor/bin/phpunit
2932

3033
.PHONY: pre-commit-test
31-
pre-commit-test: test phpcs phpstan psalm
34+
pre-commit-test: phpcs phpstan psalm test
3235

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.1"
13+
"php": "^7.2 || 8.0.*"
1414
},
1515
"autoload": {
1616
"psr-4": {
@@ -26,11 +26,11 @@
2626
},
2727
"config": {
2828
"platform": {
29-
"php": "7.1.3"
29+
"php": "7.2.3"
3030
}
3131
},
3232
"require-dev": {
33-
"phpunit/phpunit": "^7.5",
33+
"phpunit/phpunit": "^8.2 || ^9.2",
3434
"mockery/mockery": "^1.2",
3535
"phpstan/phpstan": "^0.12",
3636
"ext-simplexml": "*"

0 commit comments

Comments
 (0)