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