1CHANGELOG 2========= 3 45.4 5--- 6 7 * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml` 8 option to exclude one or more specific files from multiple file list 9 * Allow negatable for the parse tags option with `--no-parse-tags` 10 115.3 12--- 13 14 * Added `github` format support & autodetection to render errors as annotations 15 when running the YAML linter command in a Github Action environment. 16 175.1.0 18----- 19 20 * Added support for parsing numbers prefixed with `0o` as octal numbers. 21 * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o` 22 so that they are parsed as octal numbers. 23 24 Before: 25 26 ```yaml 27 Yaml::parse('072'); 28 ``` 29 30 After: 31 32 ```yaml 33 Yaml::parse('0o72'); 34 ``` 35 36 * Added `yaml-lint` binary. 37 * Deprecated using the `!php/object` and `!php/const` tags without a value. 38 395.0.0 40----- 41 42 * Removed support for mappings inside multi-line strings. 43 * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. 44 454.4.0 46----- 47 48 * Added support for parsing the inline notation spanning multiple lines. 49 * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag. 50 * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. 51 524.3.0 53----- 54 55 * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0. 56 574.2.0 58----- 59 60 * added support for multiple files or directories in `LintCommand` 61 624.0.0 63----- 64 65 * The behavior of the non-specific tag `!` is changed and now forces 66 non-evaluating your values. 67 * complex mappings will throw a `ParseException` 68 * support for the comma as a group separator for floats has been dropped, use 69 the underscore instead 70 * support for the `!!php/object` tag has been dropped, use the `!php/object` 71 tag instead 72 * duplicate mapping keys throw a `ParseException` 73 * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` 74 flag to cast them to strings 75 * `%` at the beginning of an unquoted string throw a `ParseException` 76 * mappings with a colon (`:`) that is not followed by a whitespace throw a 77 `ParseException` 78 * the `Dumper::setIndentation()` method has been removed 79 * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, 80 `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of 81 the parser and dumper is no longer supported, pass bitmask flags instead 82 * the constructor arguments of the `Parser` class have been removed 83 * the `Inline` class is internal and no longer part of the BC promise 84 * removed support for the `!str` tag, use the `!!str` tag instead 85 * added support for tagged scalars. 86 87 ```yml 88 Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); 89 // returns TaggedValue('foo', 'bar'); 90 ``` 91 923.4.0 93----- 94 95 * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method 96 97 * the `Dumper`, `Parser`, and `Yaml` classes are marked as final 98 99 * Deprecated the `!php/object:` tag which will be replaced by the 100 `!php/object` tag (without the colon) in 4.0. 101 102 * Deprecated the `!php/const:` tag which will be replaced by the 103 `!php/const` tag (without the colon) in 4.0. 104 105 * Support for the `!str` tag is deprecated, use the `!!str` tag instead. 106 107 * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. 108 It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. 109 1103.3.0 111----- 112 113 * Starting an unquoted string with a question mark followed by a space is 114 deprecated and will throw a `ParseException` in Symfony 4.0. 115 116 * Deprecated support for implicitly parsing non-string mapping keys as strings. 117 Mapping keys that are no strings will lead to a `ParseException` in Symfony 118 4.0. Use quotes to opt-in for keys to be parsed as strings. 119 120 Before: 121 122 ```php 123 $yaml = <<<YAML 124 null: null key 125 true: boolean true 126 2.0: float key 127 YAML; 128 129 Yaml::parse($yaml); 130 ``` 131 132 After: 133 134 ```php 135 136 $yaml = <<<YAML 137 "null": null key 138 "true": boolean true 139 "2.0": float key 140 YAML; 141 142 Yaml::parse($yaml); 143 ``` 144 145 * Omitted mapping values will be parsed as `null`. 146 147 * Omitting the key of a mapping is deprecated and will throw a `ParseException` in Symfony 4.0. 148 149 * Added support for dumping empty PHP arrays as YAML sequences: 150 151 ```php 152 Yaml::dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); 153 ``` 154 1553.2.0 156----- 157 158 * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated 159 when the mapping key is not quoted and will lead to a `ParseException` in 160 Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`). 161 162 * Added support for parsing PHP constants: 163 164 ```php 165 Yaml::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT); 166 ``` 167 168 * Support for silently ignoring duplicate mapping keys in YAML has been 169 deprecated and will lead to a `ParseException` in Symfony 4.0. 170 1713.1.0 172----- 173 174 * Added support to dump `stdClass` and `ArrayAccess` objects as YAML mappings 175 through the `Yaml::DUMP_OBJECT_AS_MAP` flag. 176 177 * Strings that are not UTF-8 encoded will be dumped as base64 encoded binary 178 data. 179 180 * Added support for dumping multi line strings as literal blocks. 181 182 * Added support for parsing base64 encoded binary data when they are tagged 183 with the `!!binary` tag. 184 185 * Added support for parsing timestamps as `\DateTime` objects: 186 187 ```php 188 Yaml::parse('2001-12-15 21:59:43.10 -5', Yaml::PARSE_DATETIME); 189 ``` 190 191 * `\DateTime` and `\DateTimeImmutable` objects are dumped as YAML timestamps. 192 193 * Deprecated usage of `%` at the beginning of an unquoted string. 194 195 * Added support for customizing the YAML parser behavior through an optional bit field: 196 197 ```php 198 Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE | Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP); 199 ``` 200 201 * Added support for customizing the dumped YAML string through an optional bit field: 202 203 ```php 204 Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); 205 ``` 206 2073.0.0 208----- 209 210 * Yaml::parse() now throws an exception when a blackslash is not escaped 211 in double-quoted strings 212 2132.8.0 214----- 215 216 * Deprecated usage of a colon in an unquoted mapping value 217 * Deprecated usage of @, \`, | and > at the beginning of an unquoted string 218 * When surrounding strings with double-quotes, you must now escape `\` characters. Not 219 escaping those characters (when surrounded by double-quotes) is deprecated. 220 221 Before: 222 223 ```yml 224 class: "Foo\Var" 225 ``` 226 227 After: 228 229 ```yml 230 class: "Foo\\Var" 231 ``` 232 2332.1.0 234----- 235 236 * Yaml::parse() does not evaluate loaded files as PHP files by default 237 anymore (call Yaml::enablePhpParsing() to get back the old behavior) 238