Skip to content

Commit 075b945

Browse files
Support PHP 8
1 parent 09f3f13 commit 075b945

24 files changed

+270
-218
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.editorconfig export-ignore
1+
.editorconfig export-ignore
22
.gitattributes export-ignore
33
/.github/ export-ignore
44
.gitignore export-ignore

.github/workflows/checks.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,16 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v2
1717

18-
- name: Install
19-
uses: docker://composer
20-
with:
21-
args: install
18+
- name: Composer normalize
19+
uses: docker://ergebnis/composer-normalize-action
2220

23-
- name: Normalize
24-
uses: docker://composer
25-
with:
26-
args: composer normalize --dry-run
27-
28-
# Disabled until https://github.com/Roave/BackwardCompatibilityCheck/issues/37 is resolved
29-
# roave-bc-check:
30-
# name: Roave BC Check
31-
# runs-on: ubuntu-latest
21+
roave-bc-check:
22+
name: Roave BC Check
23+
runs-on: ubuntu-latest
3224

33-
# steps:
34-
# - name: Checkout code
35-
# uses: actions/checkout@v2
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
3628

37-
# - name: Roave BC Check
38-
# uses: docker://nyholm/roave-bc-check-ga
29+
- name: Roave BC Check
30+
uses: docker://nyholm/roave-bc-check-ga

.github/workflows/ci.yml

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,78 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- master
75
pull_request:
86

97
jobs:
10-
build-lowest-version:
11-
name: Build lowest version
8+
latest:
9+
name: PHP ${{ matrix.php }} Latest
1210
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
1314

1415
steps:
15-
- name: Set up PHP
16-
uses: shivammathur/[email protected]
17-
with:
18-
php-version: '7.1'
19-
coverage: xdebug
20-
extensions: mbstring
21-
tools: prestissimo
22-
23-
- name: Setup Problem Matchers for PHPUnit
24-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
25-
2616
- name: Checkout code
2717
uses: actions/checkout@v2
2818

29-
- name: Download dependencies
30-
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --no-suggest --prefer-lowest
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php }}
23+
tools: composer
24+
coverage: none
3125

32-
- name: Run tests
33-
run: composer test-ci
26+
- name: Install dependencies
27+
run: composer update --prefer-dist --no-interaction --no-progress
3428

35-
build:
36-
name: Build
29+
- name: Execute tests
30+
run: composer test
31+
32+
lowest:
33+
name: PHP ${{ matrix.php }} Lowest
3734
runs-on: ubuntu-latest
3835
strategy:
39-
max-parallel: 10
4036
matrix:
4137
php: ['7.1', '7.2', '7.3', '7.4']
4238

4339
steps:
44-
- name: Set up PHP
45-
uses: shivammathur/[email protected]
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
43+
- name: Setup PHP
44+
uses: shivammathur/setup-php@v2
4645
with:
4746
php-version: ${{ matrix.php }}
48-
extensions: mbstring
49-
tools: prestissimo
47+
tools: composer
48+
coverage: none
49+
50+
- name: Install dependencies
51+
run: |
52+
composer require "sebastian/comparator:^3.0.2" --no-interaction --no-update
53+
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
5054
51-
- name: Setup Problem Matchers for PHPUnit
52-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
55+
- name: Execute tests
56+
run: composer test
57+
58+
coverage:
59+
name: Code Coverage
60+
runs-on: ubuntu-latest
5361

62+
steps:
5463
- name: Checkout code
5564
uses: actions/checkout@v2
5665

57-
- name: Download dependencies
58-
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --no-suggest
66+
- name: Setup PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: 7.4
70+
tools: composer
71+
coverage: xdebug
72+
73+
- name: Install dependencies
74+
run: |
75+
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
76+
composer update --prefer-dist --no-interaction --no-progress
5977
60-
- name: Run tests
61-
run: composer test
78+
- name: Execute tests
79+
run: composer test-ci

.github/workflows/static.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717

1818
- name: PHPStan
1919
uses: docker://oskarstark/phpstan-ga
20+
env:
21+
REQUIRE_DEV: true
2022
with:
2123
args: analyze --no-progress
2224

composer.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.1",
19-
"clue/stream-filter": "^1.4.1",
18+
"php": "^7.1 || ^8.0",
19+
"clue/stream-filter": "^1.5",
2020
"php-http/message-factory": "^1.0.2",
2121
"psr/http-message": "^1.0"
2222
},
@@ -25,12 +25,9 @@
2525
},
2626
"require-dev": {
2727
"ext-zlib": "*",
28-
"akeneo/phpspec-skip-example-extension": "^1.0",
29-
"coduo/phpspec-data-provider-extension": "^1.0",
30-
"ergebnis/composer-normalize": "^2.1",
28+
"ergebnis/composer-normalize": "^2.6",
3129
"guzzlehttp/psr7": "^1.0",
32-
"henrikbjorn/phpspec-code-coverage": "^1.0",
33-
"phpspec/phpspec": "^2.4",
30+
"phpspec/phpspec": "^5.1 || ^6.3",
3431
"slim/slim": "^3.0",
3532
"zendframework/zend-diactoros": "^1.0"
3633
},

phpspec.ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ suites:
44
psr4_prefix: Http\Message
55
formatter.name: pretty
66
extensions:
7-
- PhpSpec\Extension\CodeCoverageExtension
8-
- Coduo\PhpSpec\DataProvider\DataProviderExtension
9-
- Akeneo\SkipExampleExtension
7+
FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension: ~
108
code_coverage:
119
format: clover
1210
output: build/coverage.xml
11+
runner.maintainers.errors.level: 16383

phpspec.yml.dist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ suites:
33
namespace: Http\Message
44
psr4_prefix: Http\Message
55
formatter.name: pretty
6-
extensions:
7-
- Coduo\PhpSpec\DataProvider\DataProviderExtension
8-
- Akeneo\SkipExampleExtension
6+
runner.maintainers.errors.level: 16383

phpstan-baseline.neon

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ parameters:
130130
count: 1
131131
path: src/CookieJar.php
132132

133-
-
134-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:count\\(\\) has no return typehint specified\\.$#"
135-
count: 1
136-
path: src/CookieJar.php
137-
138133
-
139134
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:getIterator\\(\\) return type has no value type specified in iterable type Traversable\\<mixed, mixed\\>\\.$#"
140135
count: 1
@@ -145,61 +140,16 @@ parameters:
145140
count: 1
146141
path: src/CookieUtil.php
147142

148-
-
149-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:getSize\\(\\) has no return typehint specified\\.$#"
150-
count: 2
151-
path: src/Encoding/FilteredStream.php
152-
153-
-
154-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:isSeekable\\(\\) has no return typehint specified\\.$#"
155-
count: 2
156-
path: src/Encoding/FilteredStream.php
157-
158-
-
159-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
160-
count: 2
161-
path: src/Encoding/FilteredStream.php
162-
163-
-
164-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
165-
count: 2
166-
path: src/Encoding/FilteredStream.php
167-
168-
-
169-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
170-
count: 1
171-
path: src/Encoding/FilteredStream.php
172-
173143
-
174144
message: "#^Method Http\\\\Message\\\\Encoding\\\\ChunkStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
175145
count: 1
176146
path: src/Encoding/ChunkStream.php
177147

178-
-
179-
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has no return typehint specified\\.$#"
180-
count: 1
181-
path: src/Encoding/Filter/Chunk.php
182-
183-
-
184-
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$closing with no typehint specified\\.$#"
185-
count: 1
186-
path: src/Encoding/Filter/Chunk.php
187-
188148
-
189149
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$consumed with no typehint specified\\.$#"
190150
count: 1
191151
path: src/Encoding/Filter/Chunk.php
192152

193-
-
194-
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$in with no typehint specified\\.$#"
195-
count: 1
196-
path: src/Encoding/Filter/Chunk.php
197-
198-
-
199-
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$out with no typehint specified\\.$#"
200-
count: 1
201-
path: src/Encoding/Filter/Chunk.php
202-
203153
-
204154
message: "#^Access to an undefined property Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:\\$stream\\.$#"
205155
count: 2
@@ -220,6 +170,21 @@ parameters:
220170
count: 1
221171
path: src/Encoding/Filter/Chunk.php
222172

173+
-
174+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
175+
count: 1
176+
path: src/Encoding/FilteredStream.php
177+
178+
-
179+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
180+
count: 1
181+
path: src/Encoding/FilteredStream.php
182+
183+
-
184+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
185+
count: 1
186+
path: src/Encoding/FilteredStream.php
187+
223188
-
224189
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\DiactorosMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
225190
count: 1

spec/CookieJarSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function it_clears_cookies()
161161
$this->count()->shouldReturn(0);
162162
}
163163

164-
public function getMatchers()
164+
public function getMatchers(): array
165165
{
166166
return [
167167
'beAnArrayOfInstance' => function ($subject, $instance) {

0 commit comments

Comments
 (0)