Skip to content

Commit 638a154

Browse files
PHP 8.5 compatibility (#79)
* PHP 8.5 compatibility * Fixes * Update LazyOptionTest.php * Update static.yml
1 parent e3fac8b commit 638a154

File tree

11 files changed

+208
-40
lines changed

11 files changed

+208
-40
lines changed

.github/workflows/static.yml

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

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

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.3'
19+
php-version: '8.4'
2020
tools: composer:v2
2121
coverage: none
2222
env:
2323
update: true
2424

2525
- name: Install Dependencies
26-
uses: nick-invision/retry@v2
26+
uses: nick-invision/retry@v3
2727
with:
2828
timeout_minutes: 5
2929
max_attempts: 5
3030
command: composer update --no-interaction --no-progress
3131

3232
- name: Install PHPStan
33-
uses: nick-invision/retry@v2
33+
uses: nick-invision/retry@v3
3434
with:
3535
timeout_minutes: 5
3636
max_attempts: 5
@@ -41,30 +41,30 @@ jobs:
4141

4242
psalm:
4343
name: Psalm
44-
runs-on: ubuntu-22.04
44+
runs-on: ubuntu-24.04
4545

4646
steps:
4747
- name: Checkout code
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v5
4949

5050
- name: Setup PHP
5151
uses: shivammathur/setup-php@v2
5252
with:
53-
php-version: '8.3'
53+
php-version: '8.4'
5454
tools: composer:v2
5555
coverage: none
5656
env:
5757
update: true
5858

5959
- name: Install Dependencies
60-
uses: nick-invision/retry@v2
60+
uses: nick-invision/retry@v3
6161
with:
6262
timeout_minutes: 5
6363
max_attempts: 5
6464
command: composer update --no-interaction --no-progress
6565

6666
- name: Install Psalm
67-
uses: nick-invision/retry@v2
67+
uses: nick-invision/retry@v3
6868
with:
6969
timeout_minutes: 5
7070
max_attempts: 5

.github/workflows/tests.yml

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

1212
strategy:
1313
matrix:
14-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
14+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
1515

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

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
@@ -30,7 +30,7 @@ jobs:
3030
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
3131

3232
- name: Install PHP Dependencies
33-
uses: nick-invision/retry@v2
33+
uses: nick-invision/retry@v3
3434
with:
3535
timeout_minutes: 5
3636
max_attempts: 5

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.3-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.3-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.4-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.4-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.3-cli
6+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.4-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.3-cli analyze
9+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.4-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.3-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.4-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.3-cli
15+
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.4-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.3-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.4-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.3-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.4-cli --show-info=true
2222

2323
test: phpunit phpstan-analyze psalm-analyze
2424

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"require-dev": {
2222
"bamarni/composer-bin-plugin": "^1.8.2",
23-
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
23+
"phpunit/phpunit": "^8.5.44 || ^9.6.25 || ^10.5.53 || ^11.5.34"
2424
},
2525
"autoload": {
2626
"psr-4": {

phpstan-baseline.neon

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Method PhpOption\\\\Option\\:\\:ensure\\(\\) should return PhpOption\\\\Option\\<S\\> but returns PhpOption\\\\LazyOption\\<mixed\\>\\.$#"
4+
message: '#^Call to function is_callable\(\) with callable\(mixed \.\.\.\)\: PhpOption\\Option\<T\> will always evaluate to true\.$#'
5+
identifier: function.alreadyNarrowedType
6+
count: 1
7+
path: src/PhpOption/LazyOption.php
8+
9+
-
10+
message: '#^Method PhpOption\\Option\:\:ensure\(\) should return PhpOption\\Option\<S\> but returns PhpOption\\LazyOption\<mixed\>\.$#'
11+
identifier: return.type
512
count: 1
613
path: src/PhpOption/Option.php
714

815
-
9-
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#"
16+
message: '#^Method PhpOption\\Option\:\:fromReturn\(\) has parameter \$arguments with no value type specified in iterable type array\.$#'
17+
identifier: missingType.iterableValue
1018
count: 1
1119
path: src/PhpOption/Option.php
1220

1321
-
14-
message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) should return PhpOption\\\\LazyOption\\<S\\> but returns PhpOption\\\\LazyOption\\<mixed\\>\\.$#"
22+
message: '#^Method PhpOption\\Option\:\:fromReturn\(\) should return PhpOption\\LazyOption\<S\> but returns PhpOption\\LazyOption\<mixed\>\.$#'
23+
identifier: return.type
1524
count: 1
1625
path: src/PhpOption/Option.php
1726

1827
-
19-
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(PhpOption\\\\Option\\)\\: T given\\.$#"
28+
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(mixed\)\: mixed\)\|null, Closure\(PhpOption\\Option\)\: T given\.$#'
29+
identifier: argument.type
2030
count: 1
2131
path: src/PhpOption/Option.php
2232

2333
-
24-
message: "#^Parameter \\#2 \\$callback of function array_reduce expects callable\\(bool\\|TReturn, mixed\\)\\: \\(bool\\|TReturn\\), Closure\\(mixed, PhpOption\\\\Option\\)\\: \\(bool\\|TReturn\\) given\\.$#"
34+
message: '#^Parameter \#2 \$callback of function array_reduce expects callable\(bool\|TReturn, mixed\)\: \(bool\|TReturn\), Closure\(mixed, PhpOption\\Option\)\: \(bool\|TReturn\) given\.$#'
35+
identifier: argument.type
2536
count: 1
2637
path: src/PhpOption/Option.php
2738

2839
-
29-
message: "#^Template type S of method PhpOption\\\\Option\\:\\:lift\\(\\) is not referenced in a parameter\\.$#"
40+
message: '#^Template type S of method PhpOption\\Option\:\:lift\(\) is not referenced in a parameter\.$#'
41+
identifier: method.templateTypeNotInParameter
3042
count: 1
3143
path: src/PhpOption/Option.php
3244

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505"/>
2+
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51"/>

psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
<projectFiles>
1313
<directory name="src" />
1414
</projectFiles>
15+
16+
<issueHandlers>
17+
<MissingOverrideAttribute errorLevel="suppress" />
18+
</issueHandlers>
1519
</psalm>

tests/PhpOption/Tests/EnsureTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
use PhpOption\Some;
88
use PHPUnit\Framework\TestCase;
99

10-
/**
11-
* Tests for Option::ensure() method.
12-
*
13-
* @covers Option::ensure
14-
*/
1510
class EnsureTest extends TestCase
1611
{
1712
private static function ensure($value, $noneValue = null): Option

0 commit comments

Comments
 (0)