freescout-calendar-module/vendor/dallgoot/yaml/documentation/coherence.md
2024-09-10 16:29:40 +02:00

16 lines
No EOL
620 B
Markdown

# Sometimes the handling of dataypes in other libraries can be confusing
## Example from Symfony Yaml
```php
$object = new \stdClass();
$object->foo = 'bar';
$dumped = Yaml::dump(['data' => $object], 2, 4, Yaml::DUMP_OBJECT_AS_MAP);
// $dumped = "data:\n foo: bar"
```
## Dallgoot\Yaml removes this ambiguity by matching a specific PHP data types with its YAML counterpart like so :
- PHP standard objects -> YAML mapping
- PHP standard array -> YAML sequence
- _Dallgoot\Types\Compact_ -> YAML mapping or sequence according to content
- _Dallgoot\Types\YamlObject_ -> YAML mapping or sequence according to content