1CHANGELOG 2========= 3 44.2.0 5----- 6 7 * added support for multiple files or directories in `LintCommand` 8 94.0.0 10----- 11 12 * The behavior of the non-specific tag `!` is changed and now forces 13 non-evaluating your values. 14 * complex mappings will throw a `ParseException` 15 * support for the comma as a group separator for floats has been dropped, use 16 the underscore instead 17 * support for the `!!php/object` tag has been dropped, use the `!php/object` 18 tag instead 19 * duplicate mapping keys throw a `ParseException` 20 * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` 21 flag to cast them to strings 22 * `%` at the beginning of an unquoted string throw a `ParseException` 23 * mappings with a colon (`:`) that is not followed by a whitespace throw a 24 `ParseException` 25 * the `Dumper::setIndentation()` method has been removed 26 * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, 27 `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of 28 the parser and dumper is no longer supported, pass bitmask flags instead 29 * the constructor arguments of the `Parser` class have been removed 30 * the `Inline` class is internal and no longer part of the BC promise 31 * removed support for the `!str` tag, use the `!!str` tag instead 32 * added support for tagged scalars. 33 34 ```yml 35 Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); 36 // returns TaggedValue('foo', 'bar'); 37 ``` 38 393.4.0 40----- 41 42 * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method 43 44 * the `Dumper`, `Parser`, and `Yaml` classes are marked as final 45 46 * Deprecated the `!php/object:` tag which will be replaced by the 47 `!php/object` tag (without the colon) in 4.0. 48 49 * Deprecated the `!php/const:` tag which will be replaced by the 50 `!php/const` tag (without the colon) in 4.0. 51 52 * Support for the `!str` tag is deprecated, use the `!!str` tag instead. 53 54 * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. 55 It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. 56 573.3.0 58----- 59 60 * Starting an unquoted string with a question mark followed by a space is 61 deprecated and will throw a `ParseException` in Symfony 4.0. 62 63 * Deprecated support for implicitly parsing non-string mapping keys as strings. 64 Mapping keys that are no strings will lead to a `ParseException` in Symfony 65 4.0. Use quotes to opt-in for keys to be parsed as strings. 66 67 Before: 68 69 ```php 70 $yaml = <<<YAML 71 null: null key 72 true: boolean true 73 2.0: float key 74 YAML; 75 76 Yaml::parse($yaml); 77 ``` 78 79 After: 80 81 ```php 82 83 $yaml = <<<YAML 84 "null": null key 85 "true": boolean true 86 "2.0": float key 87 YAML; 88 89 Yaml::parse($yaml); 90 ``` 91 92 * Omitted mapping values will be parsed as `null`. 93 94 * Omitting the key of a mapping is deprecated and will throw a `ParseException` in Symfony 4.0. 95 96 * Added support for dumping empty PHP arrays as YAML sequences: 97 98 ```php 99 Yaml::dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); 100 ``` 101 1023.2.0 103----- 104 105 * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated 106 when the mapping key is not quoted and will lead to a `ParseException` in 107 Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`). 108 109 * Added support for parsing PHP constants: 110 111 ```php 112 Yaml::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT); 113 ``` 114 115 * Support for silently ignoring duplicate mapping keys in YAML has been 116 deprecated and will lead to a `ParseException` in Symfony 4.0. 117 1183.1.0 119----- 120 121 * Added support to dump `stdClass` and `ArrayAccess` objects as YAML mappings 122 through the `Yaml::DUMP_OBJECT_AS_MAP` flag. 123 124 * Strings that are not UTF-8 encoded will be dumped as base64 encoded binary 125 data. 126 127 * Added support for dumping multi line strings as literal blocks. 128 129 * Added support for parsing base64 encoded binary data when they are tagged 130 with the `!!binary` tag. 131 132 * Added support for parsing timestamps as `\DateTime` objects: 133 134 ```php 135 Yaml::parse('2001-12-15 21:59:43.10 -5', Yaml::PARSE_DATETIME); 136 ``` 137 138 * `\DateTime` and `\DateTimeImmutable` objects are dumped as YAML timestamps. 139 140 * Deprecated usage of `%` at the beginning of an unquoted string. 141 142 * Added support for customizing the YAML parser behavior through an optional bit field: 143 144 ```php 145 Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE | Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP); 146 ``` 147 148 * Added support for customizing the dumped YAML string through an optional bit field: 149 150 ```php 151 Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); 152 ``` 153 1543.0.0 155----- 156 157 * Yaml::parse() now throws an exception when a blackslash is not escaped 158 in double-quoted strings 159 1602.8.0 161----- 162 163 * Deprecated usage of a colon in an unquoted mapping value 164 * Deprecated usage of @, \`, | and > at the beginning of an unquoted string 165 * When surrounding strings with double-quotes, you must now escape `\` characters. Not 166 escaping those characters (when surrounded by double-quotes) is deprecated. 167 168 Before: 169 170 ```yml 171 class: "Foo\Var" 172 ``` 173 174 After: 175 176 ```yml 177 class: "Foo\\Var" 178 ``` 179 1802.1.0 181----- 182 183 * Yaml::parse() does not evaluate loaded files as PHP files by default 184 anymore (call Yaml::enablePhpParsing() to get back the old behavior) 185