mirror of
https://gh.wpcy.net/https://github.com/LJPc-solutions/freescout-calendar-module.git
synced 2026-07-15 17:15:21 +08:00
16 lines
No EOL
620 B
Markdown
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 |