Skip to content

Commit e7468d1

Browse files
Update composer and tests to support php 8 (#417)
* Update composer and tests to support php8 * fix: deactivate multi curl server push for php 8 feat: add the php 8 build to the ci config * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: ci changes * Remove conflict section from composer.json Testing if ci work without it * Use php7.4 image for testing of http2 push Co-authored-by: Chris Doehring
1 parent 40d2cec commit e7468d1

20 files changed

Lines changed: 53 additions & 29 deletions

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
max-parallel: 10
1212
matrix:
13-
php: ['7.2', '7.3', '7.4']
13+
php: ['7.2', '7.3', '7.4', '8.0']
1414
sf_version: ['3.4.*', '4.4.*', '5.0.*']
1515

1616
steps:
@@ -103,7 +103,7 @@ jobs:
103103
- name: Set up PHP
104104
uses: shivammathur/setup-php@2.1.0
105105
with:
106-
php-version: 7.3
106+
php-version: 7.4
107107
tools: flex
108108

109109
- name: Checkout code
@@ -122,7 +122,7 @@ jobs:
122122
123123
- name: Run tests
124124
run: |
125-
docker run --rm --net buzz-bridge -v "$PWD":/usr/src/myapp -w /usr/src/myapp -e BUZZ_TEST_SERVER=http://test-server/index.php tommymuehle/docker-alpine-php-nightly php vendor/bin/phpunit
125+
docker run --rm --net buzz-bridge -v "$PWD":/usr/src/myapp -w /usr/src/myapp -e BUZZ_TEST_SERVER=http://test-server/index.php php:7.4-cli php vendor/bin/phpunit
126126
127127
lowest:
128128
name: Lowest deps

‎.github/workflows/static.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
uses: actions/checkout@v2
4343

4444
- name: Psalm
45-
uses: docker://muglug/psalm-github-actions
45+
uses: docker://vimeo/psalm-github-actions
4646
with:
4747
args: --no-progress --show-info=false --stats

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3-fpm-stretch
1+
FROM php:7.4-fpm-buster
22

33
# Install Nginx
44
RUN apt-get update -qq && apt-get install -y --no-install-recommends -qq nginx

‎composer.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^7.1",
21+
"php": "^7.1 || ^8.0",
2222
"psr/http-message": "^1.0",
2323
"psr/http-client": "^1.0",
2424
"php-http/httplug": "^1.1 || ^2.0",
2525
"symfony/options-resolver": "^3.4 || ^4.0 || ^5.0",
2626
"psr/http-factory": "^1.0"
2727
},
2828
"require-dev": {
29-
"php-http/client-integration-tests": "^2.0.1",
29+
"php-http/client-integration-tests": "^3.0",
3030
"nyholm/psr7": "^1.0",
3131
"psr/log": "^1.0",
32-
"phpunit/phpunit": "7.5.20"
32+
"phpunit/phpunit": "^7.5 || ^9.4"
3333
},
3434
"provide": {
3535
"php-http/client-implementation": "1.0",

‎lib/Client/AbstractClient.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
abstract class AbstractClient
1414
{
1515
/**
16-
* @var OptionsResolver
16+
* @var OptionsResolver|null
1717
*/
1818
private $optionsResolver;
1919

‎lib/Client/MultiCurl.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ public function __construct($responseFactory, array $options = [])
5656
{
5757
parent::__construct($responseFactory, $options);
5858

59-
if (\PHP_VERSION_ID < 70215 || \PHP_VERSION_ID === 70300 || \PHP_VERSION_ID === 70301 || !(CURL_VERSION_HTTP2 & curl_version()['features'])) {
59+
if (
60+
\PHP_VERSION_ID < 70215 ||
61+
\PHP_VERSION_ID === 70300 ||
62+
\PHP_VERSION_ID === 70301 ||
63+
\PHP_VERSION_ID >= 80000 ||
64+
!(CURL_VERSION_HTTP2 & curl_version()['features'])
65+
) {
6066
// Dont use HTTP/2 push when it's unsupported or buggy, see https://bugs.php.net/76675
6167
$this->serverPushSupported = false;
6268
}

‎tests/Integration/BaseIntegrationTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
abstract class BaseIntegrationTest extends TestCase
1010
{
11-
protected function setUp()
11+
protected function setUp(): void
1212
{
1313
parent::setUp();
1414
if (getenv('BUZZ_TEST_SERVER')) {

‎tests/Integration/BuzzIntegrationTest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class BuzzIntegrationTest extends BaseIntegrationTest
2323
{
24-
protected function setUp()
24+
protected function setUp(): void
2525
{
2626
parent::setUp();
2727
if (empty($_SERVER['BUZZ_TEST_SERVER'])) {
@@ -125,7 +125,7 @@ public function testFormPostWithRequestBuilder($client, $async)
125125
$this->assertNotEmpty($response->getBody()->__toString(), 'Response from server should not be empty');
126126

127127
$data = json_decode($response->getBody()->__toString(), true);
128-
$this->assertInternalType('array', $data, $response->getBody()->__toString());
128+
$this->assertIsArray($data, $response->getBody()->__toString());
129129
$this->assertArrayHasKey('SERVER', $data);
130130

131131
$this->assertStringStartsWith('multipart/form-data', $data['SERVER']['CONTENT_TYPE']);
@@ -156,7 +156,7 @@ public function testFormPostWithLargeRequestBody($client, $async)
156156
$this->assertNotEmpty($response->getBody()->__toString(), 'Response from server should not be empty');
157157

158158
$data = json_decode($response->getBody()->__toString(), true);
159-
$this->assertInternalType('array', $data, $response->getBody()->__toString());
159+
$this->assertIsArray($data, $response->getBody()->__toString());
160160
$this->assertArrayHasKey('SERVER', $data);
161161

162162
$this->assertStringStartsWith('multipart/form-data', $data['SERVER']['CONTENT_TYPE']);

‎tests/Integration/Httplug/BaseIntegrationTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
abstract class BaseIntegrationTest extends HttpClientTest
1111
{
12-
protected function setUp()
12+
protected function setUp(): void
1313
{
1414
parent::setUp();
1515
if (false === PHPUnitUtility::getUri()) {

‎tests/Integration/Httplug/BrowserIntegrationTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use Buzz\Browser;
88
use Buzz\Client\FileGetContents;
99
use Nyholm\Psr7\Factory\Psr17Factory;
10+
use Psr\Http\Client\ClientInterface;
1011

1112
class BrowserIntegrationTest extends BaseIntegrationTest
1213
{
13-
protected function createHttpAdapter()
14+
protected function createHttpAdapter(): ClientInterface
1415
{
1516
$client = new FileGetContents(new Psr17Factory(), []);
1617
$browser = new Browser($client, new Psr17Factory());

0 commit comments

Comments
 (0)