Skip to content

Commit 29c03af

Browse files
authored
Add php 8.2 to CI (#526)
* Add php 8.2 to CI * fix phpstan Signed-off-by: Stéphane Demonchaux <demonchaux.stephane@gmail.com> * code review Signed-off-by: Stéphane Demonchaux <demonchaux.stephane@gmail.com>
1 parent b68e96b commit 29c03af

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/continuous_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
install-args: ['', '--prefer-lowest']
21-
php-version: ['8.0', '8.1']
21+
php-version: ['8.0', '8.1', '8.2']
2222
fail-fast: false
2323

2424
steps:

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ parameters:
3737
-
3838
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::(getMethodAnnotations|getPropertyAnnotations)\(\) should return array<int, T of object> but returns array<object>.#'
3939
path: src/AnnotationReader.php
40+
-
41+
message: '#Call to an undefined method object::__toString\(\)#'
42+
path : src/Types/ID.php

src/Types/ID.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use InvalidArgumentException;
88

9+
use function is_bool;
910
use function is_object;
1011
use function is_scalar;
1112
use function method_exists;
@@ -35,6 +36,14 @@ public function val(): bool|float|int|string|object
3536

3637
public function __toString(): string
3738
{
38-
return (string) $this->value;
39+
if (is_bool($this->value)) {
40+
return $this->value === true ? '1' : '0';
41+
}
42+
43+
if (is_scalar($this->value)) {
44+
return (string) $this->value;
45+
}
46+
47+
return $this->value->__toString();
3948
}
4049
}

0 commit comments

Comments
 (0)