Skip to content

Commit ab6441e

Browse files
authored
Merge pull request #280 from phil-davis/php82
chore: drop PHP 7.4 8.0 8.1 support PHP 8.2 up
2 parents 5eb2238 + 4d71e5b commit ab6441e

24 files changed

Lines changed: 79 additions & 118 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php-versions: ['8.0', '8.1', '8.2', '8.3','8.4']
15+
php-versions: ['8.3','8.4']
1616
coverage: ['xdebug']
1717
code-style: ['no']
1818
code-analysis: ['no']
1919
rector-check: ['no']
2020
include:
21-
- php-versions: '7.4'
21+
- php-versions: '8.2'
2222
coverage: 'xdebug'
2323
code-style: 'yes'
2424
code-analysis: 'yes'
@@ -73,5 +73,5 @@ jobs:
7373
run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
7474

7575
- name: Code Coverage
76-
uses: codecov/codecov-action@v5
76+
uses: codecov/codecov-action@v6
7777
if: matrix.coverage != 'none'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ composer.lock
44

55
# Tests
66
tests/cov/
7-
.phpunit.result.cache
7+
tests/.phpunit.cache
8+
tests/.phpunit.result.cache
89
.php_cs.cache
910
.php-cs-fixer.cache

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage" : "https://github.com/fruux/sabre-http",
66
"license" : "BSD-3-Clause",
77
"require" : {
8-
"php" : "^7.4 || ^8.0",
8+
"php" : "^8.2",
99
"ext-mbstring" : "*",
1010
"ext-ctype" : "*",
1111
"ext-curl" : "*",
@@ -18,7 +18,7 @@
1818
"phpstan/phpstan-phpunit": "^2.0",
1919
"phpstan/phpstan-strict-rules": "^2.0",
2020
"phpstan/extension-installer": "^1.4",
21-
"phpunit/phpunit" : "^9.6",
21+
"phpunit/phpunit" : "^10.5",
2222
"rector/rector": "^2.4"
2323
},
2424
"suggest" : {
@@ -74,6 +74,9 @@
7474
"config": {
7575
"allow-plugins": {
7676
"phpstan/extension-installer": true
77+
},
78+
"platform": {
79+
"php": "8.2"
7780
}
7881
}
7982
}

lib/Auth/AWS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected function getAmzHeaders(): string
179179
$amzHeaders = [];
180180
$headers = $this->request->getHeaders();
181181
foreach ($headers as $headerName => $headerValue) {
182-
if (0 === strpos(strtolower($headerName), 'x-amz-')) {
182+
if (str_starts_with(strtolower($headerName), 'x-amz-')) {
183183
$amzHeaders[strtolower($headerName)] = str_replace(["\r\n"], [' '], $headerValue[0])."\n";
184184
}
185185
}

lib/Auth/AbstractAuth.php

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,23 @@
1818
*/
1919
abstract class AbstractAuth
2020
{
21-
/**
22-
* Authentication realm.
23-
*/
24-
protected string $realm;
25-
26-
/**
27-
* Request object.
28-
*/
29-
protected RequestInterface $request;
30-
31-
/**
32-
* Response object.
33-
*/
34-
protected ResponseInterface $response;
35-
3621
/**
3722
* Creates the object.
3823
*/
39-
public function __construct(string $realm, RequestInterface $request, ResponseInterface $response)
40-
{
41-
$this->realm = $realm;
42-
$this->request = $request;
43-
$this->response = $response;
24+
public function __construct(
25+
/**
26+
* Authentication realm.
27+
*/
28+
protected string $realm,
29+
/**
30+
* Request object.
31+
*/
32+
protected RequestInterface $request,
33+
/**
34+
* Response object.
35+
*/
36+
protected ResponseInterface $response,
37+
) {
4438
}
4539

4640
/**

lib/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ public function __construct()
7474
{
7575
// See https://github.com/sabre-io/http/pull/115#discussion_r241292068
7676
// Preserve compatibility for sub-classes that implement their own method `parseCurlResult`
77-
$separatedHeaders = self::class === get_class($this);
77+
$separatedHeaders = self::class === static::class;
7878

7979
$this->curlSettings = [
8080
CURLOPT_RETURNTRANSFER => true,
8181
CURLOPT_NOBODY => false,
8282
CURLOPT_USERAGENT => 'sabre-http/'.Version::VERSION.' (http://sabre.io/)',
8383
];
8484
if ($separatedHeaders) {
85-
$this->curlSettings[CURLOPT_HEADERFUNCTION] = [$this, 'receiveCurlHeader'];
85+
$this->curlSettings[CURLOPT_HEADERFUNCTION] = $this->receiveCurlHeader(...);
8686
} else {
8787
$this->curlSettings[CURLOPT_HEADER] = true;
8888
}

lib/ClientHttpException.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@
1616
*/
1717
class ClientHttpException extends \Exception implements HttpException
1818
{
19-
/**
20-
* Response object.
21-
*/
22-
protected ResponseInterface $response;
23-
2419
/**
2520
* Constructor.
2621
*/
27-
public function __construct(ResponseInterface $response)
22+
public function __construct(/**
23+
* Response object.
24+
*/
25+
protected ResponseInterface $response)
2826
{
29-
$this->response = $response;
30-
parent::__construct($response->getStatusText(), $response->getStatus());
27+
parent::__construct($this->response->getStatusText(), $this->response->getStatus());
3128
}
3229

3330
/**

lib/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function getPath(): string
171171
$uri = Uri\normalize($uri);
172172
$baseUri = Uri\normalize($this->getBaseUrl());
173173

174-
if (0 === strpos($uri, $baseUri)) {
174+
if (str_starts_with($uri, $baseUri)) {
175175
// We're not interested in the query part (everything after the ?).
176176
[$uri] = explode('?', $uri);
177177

@@ -260,7 +260,7 @@ public function __toString(): string
260260
foreach ($this->getHeaders() as $key => $value) {
261261
foreach ($value as $v) {
262262
if ('Authorization' === $key) {
263-
[$v] = explode(' ', $v, 2);
263+
[$v] = explode(' ', (string) $v, 2);
264264
$v .= ' REDACTED';
265265
}
266266
$out .= $key.': '.$v."\r\n";

lib/RequestDecorator.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717
class RequestDecorator implements RequestInterface
1818
{
1919
use MessageDecoratorTrait;
20-
/**
21-
* The inner request object.
22-
*
23-
* All method calls will be forwarded here.
24-
*/
25-
protected RequestInterface $inner;
2620

2721
/**
2822
* Constructor.
2923
*/
30-
public function __construct(RequestInterface $inner)
31-
{
32-
$this->inner = $inner;
24+
public function __construct(
25+
/**
26+
* The inner request object.
27+
*
28+
* All method calls will be forwarded here.
29+
*/
30+
protected RequestInterface $inner,
31+
) {
3332
}
3433

3534
/**

lib/ResponseDecorator.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717
class ResponseDecorator implements ResponseInterface
1818
{
1919
use MessageDecoratorTrait;
20-
/**
21-
* The inner request object.
22-
*
23-
* All method calls will be forwarded here.
24-
*/
25-
protected ResponseInterface $inner;
2620

2721
/**
2822
* Constructor.
2923
*/
30-
public function __construct(ResponseInterface $inner)
31-
{
32-
$this->inner = $inner;
24+
public function __construct(
25+
/**
26+
* The inner request object.
27+
*
28+
* All method calls will be forwarded here.
29+
*/
30+
protected ResponseInterface $inner,
31+
) {
3332
}
3433

3534
/**

0 commit comments

Comments
 (0)