Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ on:
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
tools: composer:v2
coverage: none
env:
update: true

- name: Install Dependencies
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install PHPStan
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -41,30 +41,30 @@ jobs:

psalm:
name: Psalm
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
tools: composer:v2
coverage: none
env:
update: true

- name: Install Dependencies
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install Psalm
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
jobs:
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5

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

- name: Install PHP Dependencies
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
install:
@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
@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
@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
@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

phpunit:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.3-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.4-cli

phpstan-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.3-cli analyze
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.4-cli analyze

phpstan-baseline:
@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
@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

psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.4-cli

psalm-baseline:
@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
@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

psalm-show-info:
@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
@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

test: phpunit phpstan-analyze psalm-analyze

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
"phpunit/phpunit": "^8.5.44 || ^9.6.25 || ^10.5.53 || ^11.5.34"
},
"autoload": {
"psr-4": {
Expand Down
24 changes: 18 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
parameters:
ignoreErrors:
-
message: "#^Method PhpOption\\\\Option\\:\\:ensure\\(\\) should return PhpOption\\\\Option\\<S\\> but returns PhpOption\\\\LazyOption\\<mixed\\>\\.$#"
message: '#^Call to function is_callable\(\) with callable\(mixed \.\.\.\)\: PhpOption\\Option\<T\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/PhpOption/LazyOption.php

-
message: '#^Method PhpOption\\Option\:\:ensure\(\) should return PhpOption\\Option\<S\> but returns PhpOption\\LazyOption\<mixed\>\.$#'
identifier: return.type
count: 1
path: src/PhpOption/Option.php

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

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

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

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

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

2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505"/>
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51"/>
4 changes: 4 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
<projectFiles>
<directory name="src" />
</projectFiles>

<issueHandlers>
<MissingOverrideAttribute errorLevel="suppress" />
</issueHandlers>
</psalm>
5 changes: 0 additions & 5 deletions tests/PhpOption/Tests/EnsureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
use PhpOption\Some;
use PHPUnit\Framework\TestCase;

/**
* Tests for Option::ensure() method.
*
* @covers Option::ensure
*/
class EnsureTest extends TestCase
{
private static function ensure($value, $noneValue = null): Option
Expand Down
Loading