Skip to content

Commit 798104e

Browse files
committed
test with php 8.5
1 parent 4ecf21e commit 798104e

File tree

6 files changed

+19
-27
lines changed

6 files changed

+19
-27
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
15+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v4
20-
21-
- name: Emulate PHP 8.3
22-
run: composer config platform.php 8.3.999
23-
if: matrix.php == '8.4'
19+
uses: actions/checkout@v6
2420

2521
- name: Setup PHP
2622
uses: shivammathur/setup-php@v2
@@ -41,7 +37,7 @@ jobs:
4137

4238
steps:
4339
- name: Checkout code
44-
uses: actions/checkout@v4
40+
uses: actions/checkout@v6
4541

4642
- name: Setup PHP
4743
uses: shivammathur/setup-php@v2
@@ -69,7 +65,7 @@ jobs:
6965

7066
steps:
7167
- name: Checkout code
72-
uses: actions/checkout@v4
68+
uses: actions/checkout@v6
7369

7470
- name: Setup PHP
7571
uses: shivammathur/setup-php@v2
@@ -92,7 +88,7 @@ jobs:
9288

9389
steps:
9490
- name: Checkout code
95-
uses: actions/checkout@v4
91+
uses: actions/checkout@v6
9692

9793
- name: Setup PHP
9894
uses: shivammathur/setup-php@v2

phpstan-baseline.neon

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ parameters:
1515
count: 1
1616
path: src/Builder/ResponseBuilder.php
1717

18-
-
19-
message: "#^Result of \\|\\| is always true\\.$#"
20-
count: 1
21-
path: src/Builder/ResponseBuilder.php
22-
23-
-
24-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
25-
count: 1
26-
path: src/Builder/ResponseBuilder.php
27-
2818
-
2919
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:createWithoutValidation\\(\\) has no return type specified\\.$#"
3020
count: 1
@@ -101,14 +91,14 @@ parameters:
10191
path: src/CookieJar.php
10292

10393
-
104-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return type specified\\.$#"
105-
count: 1
94+
message: "#^Cannot call method .* on mixed\\.$#"
95+
count: 4
10696
path: src/CookieJar.php
10797

10898
-
109-
message: "#^Property Http\\\\Message\\\\CookieUtil\\:\\:\\$dateFormats type has no value type specified in iterable type array\\.$#"
99+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return type specified\\.$#"
110100
count: 1
111-
path: src/CookieUtil.php
101+
path: src/CookieJar.php
112102

113103
-
114104
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\DiactorosMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
@@ -181,6 +171,4 @@ parameters:
181171
path: src/UriFactory/SlimUriFactory.php
182172

183173
-
184-
message: "#^Call to function array_key_exists\\(\\) with 'chunk' and array<int, string> will always evaluate to false\\.$#"
185-
count: 1
186-
path: src/filters.php
174+
message: '#Trait .* is used zero times and is not analysed#'

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5+
treatPhpDocTypesAsCertain: false
56
level: max
67
paths:
78
- src

src/CookieUtil.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class CookieUtil
1010
* Handles dates as defined by RFC 2616 section 3.3.1, and also some other
1111
* non-standard, but common formats.
1212
*
13-
* @var array
13+
* @var string[]
1414
*/
1515
private static $dateFormats = [
1616
'D, d M y H:i:s T',
@@ -34,6 +34,9 @@ final class CookieUtil
3434
*/
3535
public static function parseDate($dateValue)
3636
{
37+
if (!is_string($dateValue)) {
38+
throw new \InvalidArgumentException('Date must be of type string, given '.gettype($dateValue));
39+
}
3740
foreach (self::$dateFormats as $dateFormat) {
3841
if (false !== $date = \DateTime::createFromFormat($dateFormat, $dateValue, new \DateTimeZone('GMT'))) {
3942
return $date;

src/Encoding/Filter/Chunk.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ class Chunk extends \php_user_filter
1212
public function filter($in, $out, &$consumed, $closing): int
1313
{
1414
while ($bucket = stream_bucket_make_writeable($in)) {
15+
/* @phpstan-ignore argument.type */
1516
$lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n");
1617
stream_bucket_append($out, $lenbucket);
1718

1819
$consumed += $bucket->datalen;
1920
stream_bucket_append($out, $bucket);
2021

22+
/* @phpstan-ignore argument.type */
2123
$lenbucket = stream_bucket_new($this->stream, "\r\n");
2224
stream_bucket_append($out, $lenbucket);
2325
}

src/Encoding/FilteredStream.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ public function eof(): bool
113113
protected function fill(): void
114114
{
115115
$readFilterCallback = $this->readFilterCallback;
116+
/* @phpstan-ignore assignOp.invalid */
116117
$this->buffer .= $readFilterCallback($this->stream->read(self::BUFFER_SIZE));
117118

118119
if ($this->stream->eof()) {
120+
/* @phpstan-ignore assignOp.invalid */
119121
$this->buffer .= $readFilterCallback();
120122
}
121123
}

0 commit comments

Comments
 (0)