diff --git a/src/GraphNavigator/DeserializationGraphNavigator.php b/src/GraphNavigator/DeserializationGraphNavigator.php index a29e43c12..edf1e6a68 100644 --- a/src/GraphNavigator/DeserializationGraphNavigator.php +++ b/src/GraphNavigator/DeserializationGraphNavigator.php @@ -128,6 +128,8 @@ public function accept($data, ?array $type = null) case 'bool': case 'boolean': + case 'false': + case 'true': return $this->visitor->visitBoolean($data, $type); case 'double': diff --git a/tests/Fixtures/DataFalse.php b/tests/Fixtures/DataFalse.php new file mode 100644 index 000000000..ce3d2632f --- /dev/null +++ b/tests/Fixtures/DataFalse.php @@ -0,0 +1,13 @@ +markTestSkipped('False type requires PHP 8.2'); + return; + } + + self::assertEquals( + static::getContent('data_false'), + $this->serialize(new DataFalse(false)), + ); + + self::assertEquals( + new DataFalse(false), + $this->deserialize(static::getContent('data_false'), DataFalse::class), + ); + + //What should we expect here? + self::assertEquals( + null, + $this->deserialize(static::getContent('data_true'), DataFalse::class), + ); + } + public function testDeserializingComplexDiscriminatedUnionProperties() { if (PHP_VERSION_ID < 80000) {