forked from CuyZ/Valinor
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failing test case: Valinor cannot understand
array{k: T|list<T>}
In this test, Valinor is being challenged to understand de-serialization of a given hashmap when given a type `array{a-key: T|list<T>}`. Specifically, at the time of this writing, Valinor only picks `T` during de-serialization, and seems to completely ignore the `list<T>` portion of the data. This kind of de-serialization is relevant when dealing with XML structures, where an element could be singular or plural depending on context: ```xml <Invoices> <Invoice> <!-- in this example, `Item` is singular, and needs to be handled as `Item` --> <Item><Price>123</Price></Item> </Invoice> <Invoice> <!-- in this example, `Item` is plural, and needs to be handled as `list<Item>` --> <Item><Price>456</Price></Item> <Item><Price>789</Price></Item> </Invoice> </Invoices> ``` Initially discovered by @Tigerman55
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
tests/Integration/Mapping/Fixture/SimpleObjectWithConstructor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CuyZ\Valinor\Tests\Integration\Mapping\Fixture; | ||
|
||
final class SimpleObjectWithConstructor | ||
{ | ||
public function __construct(public readonly string $value) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters