Skip to content

Commit 194952d

Browse files
Add PHP 8.2 support
1 parent 8ec31c1 commit 194952d

22 files changed

+193
-191
lines changed

.github/workflows/static.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ on:
77
jobs:
88
phpstan:
99
name: PHPStan
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.0'
20-
tools: composer:2.1
19+
php-version: '8.1'
20+
tools: composer:v2
2121
coverage: none
2222

2323
- name: Install Dependencies
24-
uses: nick-invision/retry@v1
24+
uses: nick-invision/retry@v2
2525
with:
2626
timeout_minutes: 5
2727
max_attempts: 5
2828
command: composer update --no-interaction --no-progress
2929

3030
- name: Install PHPStan
31-
uses: nick-invision/retry@v1
31+
uses: nick-invision/retry@v2
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
@@ -39,28 +39,28 @@ jobs:
3939

4040
psalm:
4141
name: Psalm
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-22.04
4343

4444
steps:
4545
- name: Checkout code
46-
uses: actions/checkout@v2
46+
uses: actions/checkout@v3
4747

4848
- name: Setup PHP
4949
uses: shivammathur/setup-php@v2
5050
with:
51-
php-version: '8.0'
52-
tools: composer:2.1
51+
php-version: '8.1'
52+
tools: composer:v2
5353
coverage: none
5454

5555
- name: Install Dependencies
56-
uses: nick-invision/retry@v1
56+
uses: nick-invision/retry@v2
5757
with:
5858
timeout_minutes: 5
5959
max_attempts: 5
6060
command: composer update --no-interaction --no-progress
6161

6262
- name: Install Psalm
63-
uses: nick-invision/retry@v1
63+
uses: nick-invision/retry@v2
6464
with:
6565
timeout_minutes: 5
6666
max_attempts: 5

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ on:
77
jobs:
88
tests:
99
name: PHP ${{ matrix.php }}
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
strategy:
1313
matrix:
14-
php: ['7.4', '8.0', '8.1']
14+
php: ['7.4', '8.0', '8.1', '8.2']
1515

1616
steps:
1717
- name: Checkout Code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
2323
php-version: ${{ matrix.php }}
24-
tools: composer:2.1
24+
tools: composer:v2
2525
coverage: none
2626

2727
- name: Setup Problem Matchers
2828
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
2929

3030
- name: Install Dependencies
31-
uses: nick-invision/retry@v1
31+
uses: nick-invision/retry@v2
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
3535
command: composer update --no-interaction --no-progress
3636

3737
- name: Install PHPUnit
38-
uses: nick-invision/retry@v1
38+
uses: nick-invision/retry@v2
3939
with:
4040
timeout_minutes: 5
4141
max_attempts: 5

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2014-2016 Antoine Kirk <[email protected]>
4-
Copyright (c) 2014-2022 Graham Campbell <[email protected]>
4+
Copyright (c) 2014-2023 Graham Campbell <[email protected]>
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
install:
2-
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.0-base update
3-
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.0-base bin all update
2+
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.1-base update
3+
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.1-base bin all update
44

55
phpunit:
6-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.0-cli
6+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.1-cli
77

88
phpstan-analyze:
9-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.0-cli analyze
9+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.1-cli analyze
1010

1111
phpstan-baseline:
12-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.0-cli analyze --generate-baseline
12+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.1-cli analyze --generate-baseline
1313

1414
psalm-analyze:
15-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli
15+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli
1616

1717
psalm-baseline:
18-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli --set-baseline=psalm-baseline.xml
18+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli --set-baseline=psalm-baseline.xml
1919

2020
psalm-show-info:
21-
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli --show-info=true
21+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli --show-info=true
2222

2323
test: phpunit phpstan-analyze psalm-analyze
2424

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,27 @@ Check out the [change log](CHANGELOG.md), [releases](https://github.com/DigitalO
1717

1818
## Installation
1919

20-
This version supports [PHP](https://php.net) 7.4-8.1. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation).
20+
This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation).
2121

2222
### Standard Installation
2323

2424
```bash
25-
$ composer require "toin0u/digitalocean-v2:^4.5" "guzzlehttp/guzzle:^7.4" "http-interop/http-factory-guzzle:^1.2"
25+
$ composer require "toin0u/digitalocean-v2:^4.6" \
26+
"guzzlehttp/guzzle:^7.5" "http-interop/http-factory-guzzle:^1.2"
2627
```
2728

2829
### Framework Integration
2930

3031
#### Laravel:
3132

3233
```bash
33-
$ composer require "graham-campbell/digitalocean:^9.0"
34+
$ composer require "graham-campbell/digitalocean:^10.0"
3435
```
3536

3637
#### Symfony:
3738

3839
```bash
39-
$ composer require "dunglas/digital-ocean-bundle:^1.0" "symfony/http-client:^5.4" "nyholm/psr7:^1.4" "guzzlehttp/promises:^1.5"
40+
$ composer require "dunglas/digital-ocean-bundle:^1.0" "symfony/http-client:^5.4" "nyholm/psr7:^1.5" "guzzlehttp/promises:^1.5"
4041
```
4142

4243
We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [dunglas/digital-ocean-bundle](https://github.com/dunglas/DunglasDigitalOceanBundle) is by [Kévin Dunglas](https://github.com/dunglas).

composer.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
"require": {
2424
"php": "^7.4.15 || ^8.0.2",
2525
"ext-json": "*",
26-
"php-http/client-common": "^2.5",
27-
"php-http/discovery": "^1.14",
28-
"php-http/httplug": "^2.2",
26+
"php-http/client-common": "^2.6",
27+
"php-http/discovery": "^1.15",
28+
"php-http/httplug": "^2.3",
2929
"psr/http-client-implementation": "^1.0",
3030
"psr/http-factory-implementation": "^1.0",
3131
"psr/http-message": "^1.0",
32-
"symfony/polyfill-php80": "^1.17"
32+
"symfony/polyfill-php80": "^1.26"
3333
},
3434
"require-dev": {
35-
"bamarni/composer-bin-plugin": "^1.4.1",
36-
"guzzlehttp/guzzle": "^7.4",
37-
"http-interop/http-factory-guzzle": "^1.0"
35+
"bamarni/composer-bin-plugin": "^1.8.2",
36+
"guzzlehttp/guzzle": "^7.5",
37+
"http-interop/http-factory-guzzle": "^1.2"
3838
},
3939
"autoload": {
4040
"psr-4": {
@@ -49,7 +49,14 @@
4949
"config": {
5050
"preferred-install": "dist",
5151
"allow-plugins": {
52-
"bamarni/composer-bin-plugin": true
52+
"bamarni/composer-bin-plugin": true,
53+
"php-http/discovery": true
54+
}
55+
},
56+
"extra": {
57+
"bamarni-bin": {
58+
"bin-links": true,
59+
"forward-command": false
5360
}
5461
}
5562
}

phpstan-baseline.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ parameters:
1010
count: 1
1111
path: src/Api/AbstractApi.php
1212

13+
-
14+
message: "#^Offset 'file' does not exist on array\\{function\\: string, line\\?\\: int, file\\?\\: string, class\\?\\: class\\-string, type\\?\\: '\\-\\>'\\|'\\:\\:', args\\?\\: array, object\\?\\: object\\}\\.$#"
15+
count: 1
16+
path: src/Entity/AbstractEntity.php
17+
18+
-
19+
message: "#^Offset 'line' does not exist on array\\{function\\: string, line\\?\\: int, file\\?\\: string, class\\?\\: class\\-string, type\\?\\: '\\-\\>'\\|'\\:\\:', args\\?\\: array, object\\?\\: object\\}\\.$#"
20+
count: 1
21+
path: src/Entity/AbstractEntity.php
22+
1323
-
1424
message: "#^Variable property access on \\$this\\(DigitalOceanV2\\\\Entity\\\\AbstractEntity\\)\\.$#"
1525
count: 4

phpunit.xml.dist

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
beStrictAboutTestsThatDoNotTestAnything="true"
5-
beStrictAboutOutputDuringTests="true"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
convertDeprecationsToExceptions="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
failOnRisky="true"
13-
failOnWarning="true"
14-
processIsolation="false"
15-
stopOnError="false"
16-
stopOnFailure="false"
17-
verbose="true"
18-
>
19-
<testsuites>
20-
<testsuite name="Test Suite">
21-
<directory suffix="Test.php">./tests</directory>
22-
</testsuite>
23-
</testsuites>
24-
<coverage processUncoveredFiles="true">
25-
<include>
26-
<directory suffix=".php">./src</directory>
27-
</include>
28-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="vendor/autoload.php" colors="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
3+
<testsuites>
4+
<testsuite name="Test Suite">
5+
<directory suffix="Test.php">./tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<include>
10+
<directory suffix=".php">./src</directory>
11+
</include>
12+
</coverage>
2913
</phpunit>

src/ResultPager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ private function postFetch(): void
171171
*/
172172
private static function bindPage(AbstractApi $api, int $page): AbstractApi
173173
{
174+
/** @var Closure(AbstractApi): AbstractApi */
174175
$closure = Closure::bind(static function (AbstractApi $api) use ($page): AbstractApi {
175176
$clone = clone $api;
176177

@@ -179,7 +180,6 @@ private static function bindPage(AbstractApi $api, int $page): AbstractApi
179180
return $clone;
180181
}, null, AbstractApi::class);
181182

182-
/** @var AbstractApi */
183183
return $closure($api);
184184
}
185185

@@ -191,6 +191,7 @@ private static function bindPage(AbstractApi $api, int $page): AbstractApi
191191
*/
192192
private static function bindPerPage(AbstractApi $api, int $perPage): AbstractApi
193193
{
194+
/** @var Closure(AbstractApi): AbstractApi */
194195
$closure = Closure::bind(static function (AbstractApi $api) use ($perPage): AbstractApi {
195196
$clone = clone $api;
196197

@@ -199,7 +200,6 @@ private static function bindPerPage(AbstractApi $api, int $perPage): AbstractApi
199200
return $clone;
200201
}, null, AbstractApi::class);
201202

202-
/** @var AbstractApi */
203203
return $closure($api);
204204
}
205205
}

tests/CdnEndpointEntityTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public function testConstructor(): void
3535
'custom_domain' => 'fake-cdn.example.com',
3636
]);
3737

38-
$this->assertInstanceOf(AbstractEntity::class, $endpoint);
39-
$this->assertInstanceOf(CdnEndpoint::class, $endpoint);
40-
$this->assertSame('8d077fd4-e67e-409c-b927-aa92dfaf0e69', $endpoint->id);
41-
$this->assertSame('fake-cdn.nyc3.digitaloceanspaces.com', $endpoint->origin);
42-
$this->assertSame('fake-cdn.nyc3.cdn.digitaloceanspaces.com', $endpoint->endpoint);
43-
$this->assertSame('2018-07-19T15:04:16Z', $endpoint->createdAt);
44-
$this->assertSame(1800, $endpoint->ttl);
45-
$this->assertSame('892071a0-bb95-49bc-8021-3afd67a210bf', $endpoint->certificateId);
46-
$this->assertSame('fake-cdn.example.com', $endpoint->customDomain);
38+
self::assertInstanceOf(AbstractEntity::class, $endpoint);
39+
self::assertInstanceOf(CdnEndpoint::class, $endpoint);
40+
self::assertSame('8d077fd4-e67e-409c-b927-aa92dfaf0e69', $endpoint->id);
41+
self::assertSame('fake-cdn.nyc3.digitaloceanspaces.com', $endpoint->origin);
42+
self::assertSame('fake-cdn.nyc3.cdn.digitaloceanspaces.com', $endpoint->endpoint);
43+
self::assertSame('2018-07-19T15:04:16Z', $endpoint->createdAt);
44+
self::assertSame(1800, $endpoint->ttl);
45+
self::assertSame('892071a0-bb95-49bc-8021-3afd67a210bf', $endpoint->certificateId);
46+
self::assertSame('fake-cdn.example.com', $endpoint->customDomain);
4747
}
4848
}

0 commit comments

Comments
 (0)