Skip to content

Commit

Permalink
Test on php 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mathroc committed Dec 9, 2023
1 parent 95dc3bf commit e7d6e36
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.2
FROM php:8.3

COPY dev.sh /tmp/library-scripts/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
}
],
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.0",
"phpspec/prophecy-phpunit": "^2.0",
"squizlabs/php_codesniffer": "^3.6",
"slevomat/coding-standard": "^8.0",
"phpstan/phpstan": "^1.4",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"vimeo/psalm": "^4.22",
"vimeo/psalm": "^5.17",
"symfony/finder": "^6.1",
"symfony/console": "^6.1",
"texthtml/doctest": "^0.2"
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<element value="destructor"/>
</property>
</properties>
<exclude-pattern>/tests/</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration">
Expand Down
8 changes: 4 additions & 4 deletions tests/Provider/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait Options
* expected:Option<string>
* }>
*/
public function andMatrix(): iterable
public static function andMatrix(): iterable
{
/** @var Option<string> $none */
$none = Option\none();
Expand Down Expand Up @@ -52,7 +52,7 @@ public function andMatrix(): iterable
* expected:Option<string>
* }>
*/
public function orMatrix(): iterable
public static function orMatrix(): iterable
{
/** @var Option<string> $none */
$none = Option\none();
Expand Down Expand Up @@ -91,7 +91,7 @@ public function orMatrix(): iterable
* expected:Option<string>
* }>
*/
public function xorMatrix(): iterable
public static function xorMatrix(): iterable
{
/** @var Option<string> $none */
$none = Option\none();
Expand Down Expand Up @@ -126,7 +126,7 @@ public function xorMatrix(): iterable
/**
* @return iterable<array{Option<mixed>, mixed, mixed, 3?:bool}>
*/
public function fromValueMatrix(): iterable
public static function fromValueMatrix(): iterable
{
$o = (object)[];

Expand Down
8 changes: 4 additions & 4 deletions tests/Provider/Results.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait Results
* expected:Result<string, null>
* }>
*/
public function andMatrix(): iterable
public static function andMatrix(): iterable
{
yield "err-err" => [
"left" => Result\err("left"),
Expand Down Expand Up @@ -47,7 +47,7 @@ public function andMatrix(): iterable
* expected:Result<string, null>
* }>
*/
public function orMatrix(): iterable
public static function orMatrix(): iterable
{
yield "err-err" => [
"left" => Result\err("left"),
Expand Down Expand Up @@ -77,7 +77,7 @@ public function orMatrix(): iterable
/**
* @return iterable<string, array{class-string<Result>}>
*/
public function resultClasses(): iterable
public static function resultClasses(): iterable
{
yield "Ok" => [Result\Ok::class];
yield "Err" => [Result\Err::class];
Expand All @@ -86,7 +86,7 @@ public function resultClasses(): iterable
/**
* @return iterable<string, array{string}>
*/
public function resultMethods(): iterable
public static function resultMethods(): iterable
{
$rc = new \ReflectionClass(Result::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/Serializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait Serializable
/**
* @return iterable<mixed>
*/
public function serializableValues(): iterable
public static function serializableValues(): iterable
{
yield "null" => [null];

Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/Transpose.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait Transpose
/**
* @return iterable<array{option:Option<mixed>, result:Result<mixed, mixed>}>
*/
public function transposeMatrix(): iterable
public static function transposeMatrix(): iterable
{
yield "none" => [
"option" => Option\none(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/Values.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait Values
/**
* @return iterable<string, array{mixed}>
*/
public function values(): iterable
public static function values(): iterable
{
yield "null" => [null];
yield "int" => [42];
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Option/ContainsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testContains(Option $option, mixed $value, bool $expect, bool $s
/**
* @return iterable<array{0:Option<mixed>, 1:mixed, 2:bool}>
*/
public function containsMatrix(): iterable
public static function containsMatrix(): iterable
{
$o = (object)[];

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Option/ConvertToResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testOkOrElse(Option $option, mixed $err, Result $expected, int $
/**
* @return iterable<array{Option<mixed>, mixed, Result<mixed, mixed>, int}>
*/
public function okOrMatrix(): iterable
public static function okOrMatrix(): iterable
{
yield "none" => [
Option\none(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Option/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testFilter(Option $option, bool $filterResult, bool $expectNone,
* array<mixed>
* }>
*/
public function filterMatrix(): iterable
public static function filterMatrix(): iterable
{
yield "none-true" => [
Option\none(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Option/FlattenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testFlatten(Option $expected, Option $option): void
/**
* @return iterable<array{Option<mixed>, Option<Option<mixed>>}>
*/
public function flattenMatrix(): iterable
public static function flattenMatrix(): iterable
{
/** @var Option<mixed> $none */
$none = Option\none();
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Option/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testMap(Option $option, mixed $mapResult, Option $expected, arra
* array<mixed>
* }>
*/
public function mapMatrix(): iterable
public static function mapMatrix(): iterable
{
yield "none" => [
Option\none(),
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testMapOr(
* array<mixed>
* }>
*/
public function mapOrMatrix(): iterable
public static function mapOrMatrix(): iterable
{
yield "none" => [
Option\none(),
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Option/ZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testZip(Option $left, Option $right, Option $expected): void
* Option<array{mixed, mixed}>,
* }>
*/
public function zipMatrix(): iterable
public static function zipMatrix(): iterable
{
yield "none-none" => [
Option\none(),
Expand Down Expand Up @@ -75,7 +75,7 @@ public function testUnzip(Option $zipped, Option $left, Option $right): void
* Option<mixed>,
* }>
*/
public function unzipMatrix(): iterable
public static function unzipMatrix(): iterable
{
yield "none" => [
Option\none(),
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Result/ContainsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testContains(Result $result, mixed $value, bool $expect, bool $s
/**
* @return iterable<array{0:Result<mixed, null>, 1:mixed, 2:bool}>
*/
public function containsMatrix(): iterable
public static function containsMatrix(): iterable
{
$o = (object)[];

Expand Down Expand Up @@ -66,7 +66,7 @@ public function testContainsErr(Result $result, mixed $value, bool $expect, bool
/**
* @return iterable<array{0:Result<mixed, mixed>, 1:mixed, 2:bool}>
*/
public function containsErrMatrix(): iterable
public static function containsErrMatrix(): iterable
{
$o = (object)[];

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Result/ConvertToOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testOk(Result $result, Option $expected): void
/**
* @return iterable<array{Option<mixed>, mixed, Result<mixed, mixed>, int}>
*/
public function okMatrix(): iterable
public static function okMatrix(): iterable
{
yield "err" => [
Result\err("Don't panic !"),
Expand All @@ -51,7 +51,7 @@ public function testErr(Result $result, Option $expected): void
/**
* @return iterable<array{Option<mixed>, mixed, Result<mixed, mixed>, int}>
*/
public function errMatrix(): iterable
public static function errMatrix(): iterable
{
yield "err" => [
Result\err("Don't panic !"),
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Result/FlattenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testFlatten(Result $expected, Result $result): void
/**
* @return iterable<array{Result<mixed, null>, Result<Result<mixed, null>, null>}>
*/
public function flattenMatrix(): iterable
public static function flattenMatrix(): iterable
{
yield "err" => [Result\err(null), Result\err(null)];

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Result/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testMap(Result $result, mixed $mapResult, Result $expected, arra
* array<mixed>
* }>
*/
public function mapMatrix(): iterable
public static function mapMatrix(): iterable
{
yield "err" => [
Result\err(null),
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testMapErr(Result $result, mixed $mapResult, Result $expected, a
* array<mixed>
* }>
*/
public function mapErrMatrix(): iterable
public static function mapErrMatrix(): iterable
{
yield "ok" => [
Result\ok(null),
Expand Down Expand Up @@ -158,7 +158,7 @@ public function testMapOr(
* array<mixed>
* }>
*/
public function mapOrMatrix(): iterable
public static function mapOrMatrix(): iterable
{
yield "err" => [
Result\err(null),
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Result/MustBeUsedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testAnUnserializedResultDontHaveToBeUsed(callable $factory): voi
/**
* @return iterable<array{callable():Result<mixed,mixed>}>
*/
public function resultsFactory(): iterable
public static function resultsFactory(): iterable
{
yield "ok" => [static fn (): Result => Result\ok(null)];
yield "err" => [static fn (): Result => Result\err(null)];
Expand Down
6 changes: 5 additions & 1 deletion tests/Unit/Result/TrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ public function testTrapOk(mixed $value): void

public function testTrapCheckedException(): void
{
$exceptionClass = \version_compare(PHP_VERSION, '8.3.0') >= 0
? \DateMalformedStringException::class
: \Exception::class;

Assert::assertEquals(
new \Exception(
new $exceptionClass(
"Failed to parse time string (nope) at position 0 (n): The timezone could not be found in the database",
),
// @phpstan-ignore-next-line
Expand Down

0 comments on commit e7d6e36

Please sign in to comment.