fixed CS on YAML fixtures

This commit is contained in:
Fabien Potencier 2019-01-16 11:59:17 +01:00
parent ac9d6cff81
commit 0ba1acc82f
24 changed files with 318 additions and 318 deletions

View File

@ -113,7 +113,7 @@ CHANGELOG
* Added support for customizing the dumped YAML string through an optional bit field: * Added support for customizing the dumped YAML string through an optional bit field:
```php ```php
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT);
``` ```
3.0.0 3.0.0

View File

@ -14,7 +14,7 @@ yaml: |
- Oren - Oren
- *showell - *showell
php: | php: |
array('Steve', 'Clark', 'Brian', 'Oren', 'Steve') ['Steve', 'Clark', 'Brian', 'Oren', 'Steve']
--- ---
test: Alias of a Mapping test: Alias of a Mapping
@ -28,4 +28,4 @@ yaml: |
- banana - banana
- *hello - *hello
php: | php: |
array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato')) [['Meat'=>'pork', 'Starch'=>'potato'], 'banana', ['Meat'=>'pork', 'Starch'=>'potato']]

View File

@ -9,7 +9,7 @@ yaml: |
- banana - banana
- carrot - carrot
php: | php: |
array('apple', 'banana', 'carrot') ['apple', 'banana', 'carrot']
--- ---
test: Sequence With Item Being Null In The Middle test: Sequence With Item Being Null In The Middle
brief: | brief: |
@ -21,7 +21,7 @@ yaml: |
- -
- carrot - carrot
php: | php: |
array('apple', null, 'carrot') ['apple', null, 'carrot']
--- ---
test: Sequence With Last Item Being Null test: Sequence With Last Item Being Null
brief: | brief: |
@ -33,7 +33,7 @@ yaml: |
- banana - banana
- -
php: | php: |
array('apple', 'banana', null) ['apple', 'banana', null]
--- ---
test: Nested Sequences test: Nested Sequences
brief: | brief: |
@ -46,7 +46,7 @@ yaml: |
- bar - bar
- baz - baz
php: | php: |
array(array('foo', 'bar', 'baz')) [['foo', 'bar', 'baz']]
--- ---
test: Mixed Sequences test: Mixed Sequences
brief: | brief: |
@ -61,7 +61,7 @@ yaml: |
- banana - banana
- carrot - carrot
php: | php: |
array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot') ['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot']
--- ---
test: Deeply Nested Sequences test: Deeply Nested Sequences
brief: | brief: |
@ -74,7 +74,7 @@ yaml: |
- uno - uno
- dos - dos
php: | php: |
array(array(array('uno', 'dos'))) [[['uno', 'dos']]]
--- ---
test: Simple Mapping test: Simple Mapping
brief: | brief: |
@ -87,7 +87,7 @@ yaml: |
foo: whatever foo: whatever
bar: stuff bar: stuff
php: | php: |
array('foo' => 'whatever', 'bar' => 'stuff') ['foo' => 'whatever', 'bar' => 'stuff']
--- ---
test: Sequence in a Mapping test: Sequence in a Mapping
brief: | brief: |
@ -98,7 +98,7 @@ yaml: |
- uno - uno
- dos - dos
php: | php: |
array('foo' => 'whatever', 'bar' => array('uno', 'dos')) ['foo' => 'whatever', 'bar' => ['uno', 'dos']]
--- ---
test: Nested Mappings test: Nested Mappings
brief: | brief: |
@ -110,14 +110,14 @@ yaml: |
name: steve name: steve
sport: baseball sport: baseball
php: | php: |
array( [
'foo' => 'whatever', 'foo' => 'whatever',
'bar' => array( 'bar' => [
'fruit' => 'apple', 'fruit' => 'apple',
'name' => 'steve', 'name' => 'steve',
'sport' => 'baseball' 'sport' => 'baseball'
) ]
) ]
--- ---
test: Mixed Mapping test: Mixed Mapping
brief: | brief: |
@ -136,22 +136,22 @@ yaml: |
perl: papers perl: papers
ruby: scissorses ruby: scissorses
php: | php: |
array( [
'foo' => 'whatever', 'foo' => 'whatever',
'bar' => array( 'bar' => [
array( [
'fruit' => 'apple', 'fruit' => 'apple',
'name' => 'steve', 'name' => 'steve',
'sport' => 'baseball' 'sport' => 'baseball'
), ],
'more', 'more',
array( [
'python' => 'rocks', 'python' => 'rocks',
'perl' => 'papers', 'perl' => 'papers',
'ruby' => 'scissorses' 'ruby' => 'scissorses'
) ]
) ]
) ]
--- ---
test: Mapping-in-Sequence Shortcut test: Mapping-in-Sequence Shortcut
todo: true todo: true
@ -163,7 +163,7 @@ yaml: |
- work on YAML.py: - work on YAML.py:
- work on Store - work on Store
php: | php: |
array(array('work on YAML.py' => array('work on Store'))) [['work on YAML.py' => ['work on Store']]]
--- ---
test: Sequence-in-Mapping Shortcut test: Sequence-in-Mapping Shortcut
todo: true todo: true
@ -177,7 +177,7 @@ yaml: |
- '%.sourceforge.net' - '%.sourceforge.net'
- '%.freepan.org' - '%.freepan.org'
php: | php: |
array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org')) ['allow' => ['localhost', '%.sourceforge.net', '%.freepan.org']]
--- ---
todo: true todo: true
test: Merge key test: Merge key
@ -192,11 +192,11 @@ yaml: |
<<: <<:
age: 38 age: 38
php: | php: |
array( [
'mapping' => 'mapping' =>
array( [
'name' => 'Joe', 'name' => 'Joe',
'job' => 'Accountant', 'job' => 'Accountant',
'age' => 38 'age' => 38
) ]
) ]

View File

@ -5,7 +5,7 @@ brief: |
yaml: | yaml: |
foo: bar foo: bar
php: | php: |
array('foo' => 'bar') ['foo' => 'bar']
--- ---
test: Multi Element Mapping test: Multi Element Mapping
brief: | brief: |
@ -15,11 +15,11 @@ yaml: |
white: walls white: walls
blue: berries blue: berries
php: | php: |
array( [
'red' => 'baron', 'red' => 'baron',
'white' => 'walls', 'white' => 'walls',
'blue' => 'berries', 'blue' => 'berries',
) ]
--- ---
test: Values aligned test: Values aligned
brief: | brief: |
@ -30,11 +30,11 @@ yaml: |
white: walls white: walls
blue: berries blue: berries
php: | php: |
array( [
'red' => 'baron', 'red' => 'baron',
'white' => 'walls', 'white' => 'walls',
'blue' => 'berries', 'blue' => 'berries',
) ]
--- ---
test: Colons aligned test: Colons aligned
brief: | brief: |
@ -44,8 +44,8 @@ yaml: |
white : walls white : walls
blue : berries blue : berries
php: | php: |
array( [
'red' => 'baron', 'red' => 'baron',
'white' => 'walls', 'white' => 'walls',
'blue' => 'berries', 'blue' => 'berries',
) ]

View File

@ -49,7 +49,7 @@ yaml: |
foo: 1 foo: 1
bar: 2 bar: 2
php: | php: |
array('foo' => 1, 'bar' => 2) ['foo' => 1, 'bar' => 2]
documents: 1 documents: 1
--- ---
@ -63,7 +63,7 @@ yaml: |
foo: | foo: |
--- ---
php: | php: |
array('foo' => "---\n") ['foo' => "---\n"]
--- ---
test: Multiple Document Separators in Block test: Multiple Document Separators in Block
@ -79,7 +79,7 @@ yaml: |
bar: | bar: |
fooness fooness
php: | php: |
array( [
'foo' => "---\nfoo: bar\n---\nyo: baz\n", 'foo' => "---\nfoo: bar\n---\nyo: baz\n",
'bar' => "fooness\n" 'bar' => "fooness\n"
) ]

View File

@ -22,4 +22,4 @@ yaml: |
firstline: 1 firstline: 1
secondline: 2 secondline: 2
php: | php: |
array('foo' => null, 'firstline' => 1, 'secondline' => 2) ['foo' => null, 'firstline' => 1, 'secondline' => 2]

View File

@ -8,7 +8,7 @@ brief: >
yaml: | yaml: |
seq: [ a, b, c ] seq: [ a, b, c ]
php: | php: |
array('seq' => array('a', 'b', 'c')) ['seq' => ['a', 'b', 'c']]
--- ---
test: Simple Inline Hash test: Simple Inline Hash
brief: > brief: >
@ -21,7 +21,7 @@ brief: >
yaml: | yaml: |
hash: { name: Steve, foo: bar } hash: { name: Steve, foo: bar }
php: | php: |
array('hash' => array('name' => 'Steve', 'foo' => 'bar')) ['hash' => ['name' => 'Steve', 'foo' => 'bar']]
--- ---
test: Multi-line Inline Collections test: Multi-line Inline Collections
todo: true todo: true
@ -38,15 +38,15 @@ yaml: |
Python: python.org, Python: python.org,
Perl: use.perl.org } Perl: use.perl.org }
php: | php: |
array( [
'languages' => array('Ruby', 'Perl', 'Python'), 'languages' => ['Ruby', 'Perl', 'Python'],
'websites' => array( 'websites' => [
'YAML' => 'yaml.org', 'YAML' => 'yaml.org',
'Ruby' => 'ruby-lang.org', 'Ruby' => 'ruby-lang.org',
'Python' => 'python.org', 'Python' => 'python.org',
'Perl' => 'use.perl.org' 'Perl' => 'use.perl.org'
) ]
) ]
--- ---
test: Commas in Values (not in the spec!) test: Commas in Values (not in the spec!)
todo: true todo: true
@ -57,4 +57,4 @@ brief: >
yaml: | yaml: |
attendances: [ 45,123, 70,000, 17,222 ] attendances: [ 45,123, 70,000, 17,222 ]
php: | php: |
array('attendances' => array(45123, 70000, 17222)) ['attendances' => [45123, 70000, 17222]]

View File

@ -12,7 +12,7 @@ yaml: |
Foo Foo
Bar Bar
php: | php: |
array('this' => "Foo\nBar\n") ['this' => "Foo\nBar\n"]
--- ---
test: The '+' indicator test: The '+' indicator
brief: > brief: >
@ -28,11 +28,11 @@ yaml: |
dummy: value dummy: value
php: | php: |
array( [
'normal' => "extra new lines not kept\n", 'normal' => "extra new lines not kept\n",
'preserving' => "extra new lines are kept\n\n\n", 'preserving' => "extra new lines are kept\n\n\n",
'dummy' => 'value' 'dummy' => 'value'
) ]
--- ---
test: Three trailing newlines in literals test: Three trailing newlines in literals
brief: > brief: >
@ -64,14 +64,14 @@ yaml: |
same as "kept" above: "This has four newlines.\n\n\n\n" same as "kept" above: "This has four newlines.\n\n\n\n"
php: | php: |
array( [
'clipped' => "This has one newline.\n", 'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.', 'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.',
'kept' => "This has four newlines.\n\n\n\n", 'kept' => "This has four newlines.\n\n\n\n",
'same as "kept" above' => "This has four newlines.\n\n\n\n" 'same as "kept" above' => "This has four newlines.\n\n\n\n"
) ]
--- ---
test: Extra trailing newlines with spaces test: Extra trailing newlines with spaces
todo: true todo: true
@ -95,8 +95,8 @@ yaml: |
php: | php: |
array('this' => "Foo\n\n \n", ['this' => "Foo\n\n \n",
'kept' => "Foo\n\n \n" ) 'kept' => "Foo\n\n \n"]
--- ---
test: Folded Block in a Sequence test: Folded Block in a Sequence
@ -115,12 +115,12 @@ yaml: |
hmm hmm
- dog - dog
php: | php: |
array( [
'apple', 'apple',
'banana', 'banana',
"can't you see the beauty of yaml? hmm\n", "can't you see the beauty of yaml? hmm\n",
'dog' 'dog'
) ]
--- ---
test: Folded Block as a Mapping Value test: Folded Block as a Mapping Value
brief: > brief: >
@ -135,10 +135,10 @@ yaml: |
by a knee injury. by a knee injury.
source: espn source: espn
php: | php: |
array( [
'quote' => "Mark McGwire's year was crippled by a knee injury.\n", 'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
'source' => 'espn' 'source' => 'espn'
) ]
--- ---
test: Three trailing newlines in folded blocks test: Three trailing newlines in folded blocks
brief: > brief: >
@ -166,11 +166,11 @@ yaml: |
same as "kept" above: "This has four newlines.\n\n\n\n" same as "kept" above: "This has four newlines.\n\n\n\n"
php: | php: |
array( [
'clipped' => "This has one newline.\n", 'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.', 'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.',
'kept' => "This has four newlines.\n\n\n\n", 'kept' => "This has four newlines.\n\n\n\n",
'same as "kept" above' => "This has four newlines.\n\n\n\n" 'same as "kept" above' => "This has four newlines.\n\n\n\n"
) ]

View File

@ -6,7 +6,7 @@ brief: >
yaml: | yaml: |
empty: [] empty: []
php: | php: |
array('empty' => array()) ['empty' => []]
--- ---
test: Empty Mapping test: Empty Mapping
brief: > brief: >
@ -15,19 +15,19 @@ brief: >
yaml: | yaml: |
empty: {} empty: {}
php: | php: |
array('empty' => array()) ['empty' => []]
--- ---
test: Empty Sequence as Entire Document test: Empty Sequence as Entire Document
yaml: | yaml: |
[] []
php: | php: |
array() []
--- ---
test: Empty Mapping as Entire Document test: Empty Mapping as Entire Document
yaml: | yaml: |
{} {}
php: | php: |
array() []
--- ---
test: Null as Document test: Null as Document
yaml: | yaml: |

View File

@ -6,7 +6,7 @@ yaml: |
- Sammy Sosa - Sammy Sosa
- Ken Griffey - Ken Griffey
php: | php: |
array('Mark McGwire', 'Sammy Sosa', 'Ken Griffey') ['Mark McGwire', 'Sammy Sosa', 'Ken Griffey']
--- ---
test: Mapping of scalars to scalars test: Mapping of scalars to scalars
spec: 2.2 spec: 2.2
@ -15,7 +15,7 @@ yaml: |
avg: 0.278 avg: 0.278
rbi: 147 rbi: 147
php: | php: |
array('hr' => 65, 'avg' => 0.278, 'rbi' => 147) ['hr' => 65, 'avg' => 0.278, 'rbi' => 147]
--- ---
test: Mapping of scalars to sequences test: Mapping of scalars to sequences
spec: 2.3 spec: 2.3
@ -29,13 +29,13 @@ yaml: |
- Chicago Cubs - Chicago Cubs
- Atlanta Braves - Atlanta Braves
php: | php: |
array('american' => ['american' =>
array( 'Boston Red Sox', 'Detroit Tigers', ['Boston Red Sox', 'Detroit Tigers',
'New York Yankees' ), 'New York Yankees'],
'national' => 'national' =>
array( 'New York Mets', 'Chicago Cubs', ['New York Mets', 'Chicago Cubs',
'Atlanta Braves' ) 'Atlanta Braves']
) ]
--- ---
test: Sequence of mappings test: Sequence of mappings
spec: 2.4 spec: 2.4
@ -49,10 +49,10 @@ yaml: |
hr: 63 hr: 63
avg: 0.288 avg: 0.288
php: | php: |
array( [
array('name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278), ['name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278],
array('name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288) ['name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288]
) ]
--- ---
test: Legacy A5 test: Legacy A5
todo: true todo: true
@ -134,11 +134,11 @@ yaml: |
- [ Mark McGwire , 65 , 0.278 ] - [ Mark McGwire , 65 , 0.278 ]
- [ Sammy Sosa , 63 , 0.288 ] - [ Sammy Sosa , 63 , 0.288 ]
php: | php: |
array( [
array( 'name', 'hr', 'avg' ), [ 'name', 'hr', 'avg' ],
array( 'Mark McGwire', 65, 0.278 ), [ 'Mark McGwire', 65, 0.278 ],
array( 'Sammy Sosa', 63, 0.288 ) [ 'Sammy Sosa', 63, 0.288 ]
) ]
--- ---
test: Mapping of mappings test: Mapping of mappings
todo: true todo: true
@ -150,12 +150,12 @@ yaml: |
avg: 0.288 avg: 0.288
} }
php: | php: |
array( [
'Mark McGwire' => 'Mark McGwire' =>
array( 'hr' => 65, 'avg' => 0.278 ), [ 'hr' => 65, 'avg' => 0.278 ],
'Sammy Sosa' => 'Sammy Sosa' =>
array( 'hr' => 63, 'avg' => 0.288 ) [ 'hr' => 63, 'avg' => 0.288 ]
) ]
--- ---
test: Two documents in a stream each with a leading comment test: Two documents in a stream each with a leading comment
todo: true todo: true
@ -208,10 +208,10 @@ yaml: |
- Sammy Sosa - Sammy Sosa
- Ken Griffey - Ken Griffey
php: | php: |
array( [
'hr' => array( 'Mark McGwire', 'Sammy Sosa' ), 'hr' => [ 'Mark McGwire', 'Sammy Sosa' ],
'rbi' => array( 'Sammy Sosa', 'Ken Griffey' ) 'rbi' => [ 'Sammy Sosa', 'Ken Griffey' ]
) ]
--- ---
test: Node for Sammy Sosa appears twice in this document test: Node for Sammy Sosa appears twice in this document
spec: 2.10 spec: 2.10
@ -225,12 +225,12 @@ yaml: |
- *SS # Subsequent occurrence - *SS # Subsequent occurrence
- Ken Griffey - Ken Griffey
php: | php: |
array( [
'hr' => 'hr' =>
array('Mark McGwire', 'Sammy Sosa'), ['Mark McGwire', 'Sammy Sosa'],
'rbi' => 'rbi' =>
array('Sammy Sosa', 'Ken Griffey') ['Sammy Sosa', 'Ken Griffey']
) ]
--- ---
test: Mapping between sequences test: Mapping between sequences
todo: true todo: true
@ -297,20 +297,20 @@ yaml: |
- item : Big Shoes - item : Big Shoes
quantity: 1 quantity: 1
php: | php: |
array ( [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'item' => 'Basketball', 'item' => 'Basketball',
'quantity' => 4, 'quantity' => 4,
), ],
array ( [
'item' => 'Big Shoes', 'item' => 'Big Shoes',
'quantity' => 1, 'quantity' => 1,
) ]
) ]
perl: | perl: |
[ [
{ item => 'Super Hoop', quantity => 1 }, { item => 'Super Hoop', quantity => 1 },
@ -462,11 +462,11 @@ yaml: |
65 Home Runs 65 Home Runs
0.278 Batting Average 0.278 Batting Average
php: | php: |
array( [
'name' => 'Mark McGwire', 'name' => 'Mark McGwire',
'accomplishment' => "Mark set a major league home run record in 1998.\n", 'accomplishment' => "Mark set a major league home run record in 1998.\n",
'stats' => "65 Home Runs\n0.278 Batting Average\n" 'stats' => "65 Home Runs\n0.278 Batting Average\n"
) ]
--- ---
test: Quoted scalars test: Quoted scalars
todo: true todo: true
@ -512,11 +512,11 @@ yaml: |
octal: 014 octal: 014
hexadecimal: 0xC hexadecimal: 0xC
php: | php: |
array( [
'canonical' => 12345, 'canonical' => 12345,
'octal' => 014, 'octal' => 014,
'hexadecimal' => 0xC 'hexadecimal' => 0xC
) ]
--- ---
test: Decimal Integer test: Decimal Integer
deprecated: true deprecated: true
@ -524,9 +524,9 @@ spec: 2.19
yaml: | yaml: |
decimal: +12,345 decimal: +12,345
php: | php: |
array( [
'decimal' => 12345.0, 'decimal' => 12345.0,
) ]
--- ---
# FIX: spec shows parens around -inf and NaN # FIX: spec shows parens around -inf and NaN
test: Floating point test: Floating point
@ -538,13 +538,13 @@ yaml: |
not a number: .NaN not a number: .NaN
float as whole number: !!float 1 float as whole number: !!float 1
php: | php: |
array( [
'canonical' => 1230.15, 'canonical' => 1230.15,
'exponential' => 1230.15, 'exponential' => 1230.15,
'negative infinity' => log(0), 'negative infinity' => log(0),
'not a number' => -log(0), 'not a number' => -log(0),
'float as whole number' => (float) 1 'float as whole number' => (float) 1
) ]
--- ---
test: Fixed Floating point test: Fixed Floating point
deprecated: true deprecated: true
@ -552,9 +552,9 @@ spec: 2.20
yaml: | yaml: |
fixed: 1,230.15 fixed: 1,230.15
php: | php: |
array( [
'fixed' => 1230.15, 'fixed' => 1230.15,
) ]
--- ---
test: Timestamps test: Timestamps
todo: true todo: true
@ -565,12 +565,12 @@ yaml: |
spaced: 2001-12-14 21:59:43.10 -05:00 spaced: 2001-12-14 21:59:43.10 -05:00
date: 2002-12-14 # Time is noon UTC date: 2002-12-14 # Time is noon UTC
php: | php: |
array( [
'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ), 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'date' => Date.new( 2002, 12, 14 ) 'date' => Date.new( 2002, 12, 14 )
) ]
--- ---
test: legacy Timestamps test test: legacy Timestamps test
todo: true todo: true
@ -581,12 +581,12 @@ yaml: |
spaced: 2001-12-14 21:59:43.00 -05:00 spaced: 2001-12-14 21:59:43.00 -05:00
date: 2002-12-14 date: 2002-12-14
php: | php: |
array( [
'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ), 'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ),
'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ), 'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ),
'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ), 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ),
'date' => Date.new( 2002, 12, 14 ) 'date' => Date.new( 2002, 12, 14 )
) ]
--- ---
test: Various explicit families test: Various explicit families
todo: true todo: true
@ -754,20 +754,20 @@ yaml: |
Backup contact is Nancy Backup contact is Nancy
Billsmer @ 338-4338. Billsmer @ 338-4338.
php: | php: |
array( [
'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001), 'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'bill-to' => 'bill-to' =>
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) ) [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]
, 'ship-to' => , 'ship-to' =>
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) ) [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]
, 'product' => , 'product' =>
array( [
array( 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ), [ 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ],
array( 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ) [ 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ]
), ],
'tax' => 251.42, 'total' => 4443.52, 'tax' => 251.42, 'total' => 4443.52,
'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n" 'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n"
) ]
--- ---
test: Log file test: Log file
todo: true todo: true
@ -826,9 +826,9 @@ yaml: |
# These are three throwaway comment # These are three throwaway comment
# lines (the first line is empty). # lines (the first line is empty).
php: | php: |
array( [
'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n" 'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n"
) ]
--- ---
test: Document with a single value test: Document with a single value
todo: true todo: true
@ -878,11 +878,11 @@ yaml: |
date : 2001-01-23 date : 2001-01-23
total : 4443.52 total : 4443.52
php: | php: |
array( [
'invoice' => 34843, 'invoice' => 34843,
'date' => gmmktime(0, 0, 0, 1, 23, 2001), 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'total' => 4443.52 'total' => 4443.52
) ]
--- ---
test: Single-line documents test: Single-line documents
todo: true todo: true
@ -934,7 +934,7 @@ yaml: |
also int: ! "12" also int: ! "12"
string: !!str 12 string: !!str 12
php: | php: |
array( 'integer' => 12, 'also int' => 12, 'string' => '12' ) [ 'integer' => 12, 'also int' => 12, 'string' => '12' ]
--- ---
test: Private types test: Private types
todo: true todo: true
@ -966,7 +966,7 @@ yaml: |
# The URI is 'tag:yaml.org,2002:str' # The URI is 'tag:yaml.org,2002:str'
- !!str a Unicode string - !!str a Unicode string
php: | php: |
array( 'a Unicode string' ) [ 'a Unicode string' ]
--- ---
test: Type family under perl.yaml.org test: Type family under perl.yaml.org
todo: true todo: true
@ -1039,9 +1039,9 @@ yaml: |
repeated use of this value. repeated use of this value.
alias : *A001 alias : *A001
php: | php: |
array( 'anchor' => 'This scalar has an anchor.', [ 'anchor' => 'This scalar has an anchor.',
'override' => "The alias node below is a repeated use of this value.\n", 'override' => "The alias node below is a repeated use of this value.\n",
'alias' => "The alias node below is a repeated use of this value.\n" ) 'alias' => "The alias node below is a repeated use of this value.\n"]
--- ---
test: Flow and block formatting test: Flow and block formatting
todo: true todo: true
@ -1152,12 +1152,12 @@ yaml: |
redundant: |2 redundant: |2
This value is indented 2 spaces. This value is indented 2 spaces.
php: | php: |
array( [
'leading spaces' => " This value starts with four spaces.\n", 'leading spaces' => " This value starts with four spaces.\n",
'leading line break' => "\nThis value starts with a line break.\n", 'leading line break' => "\nThis value starts with a line break.\n",
'leading comment indicator' => "# first line starts with a\n# character.\n", 'leading comment indicator' => "# first line starts with a\n# character.\n",
'redundant' => "This value is indented 2 spaces.\n" 'redundant' => "This value is indented 2 spaces.\n"
) ]
--- ---
test: Chomping and keep modifiers test: Chomping and keep modifiers
yaml: | yaml: |
@ -1176,14 +1176,14 @@ yaml: |
same as "kept" above: "This has two newlines.\n\n" same as "kept" above: "This has two newlines.\n\n"
php: | php: |
array( [
'clipped' => "This has one newline.\n", 'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.', 'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.',
'kept' => "This has two newlines.\n\n", 'kept' => "This has two newlines.\n\n",
'same as "kept" above' => "This has two newlines.\n\n" 'same as "kept" above' => "This has two newlines.\n\n"
) ]
--- ---
test: Literal combinations test: Literal combinations
todo: true todo: true
@ -1221,7 +1221,7 @@ yaml: |
both are equal to: " This has no newline." both are equal to: " This has no newline."
php: | php: |
array( [
'empty' => '', 'empty' => '',
'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " + 'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " +
"is significant.\n\nLine breaks are significant.\nThus this value contains one\n" + "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
@ -1232,7 +1232,7 @@ php: |
'indented and chomped' => ' This has no newline.', 'indented and chomped' => ' This has no newline.',
'also written as' => ' This has no newline.', 'also written as' => ' This has no newline.',
'both are equal to' => ' This has no newline.' 'both are equal to' => ' This has no newline.'
) [
--- ---
test: Folded combinations test: Folded combinations
todo: true todo: true
@ -1288,7 +1288,7 @@ yaml: |
# Explicit comments may follow # Explicit comments may follow
# but must be less indented. # but must be less indented.
php: | php: |
array( [
'empty' => '', 'empty' => '',
'one paragraph' => 'Line feeds are converted to spaces, so this value'. 'one paragraph' => 'Line feeds are converted to spaces, so this value'.
" contains no line breaks except for the final one.\n", " contains no line breaks except for the final one.\n",
@ -1300,7 +1300,7 @@ php: |
'above is equal to' => "This is a folded paragraph followed by a list:\n". 'above is equal to' => "This is a folded paragraph followed by a list:\n".
" * first entry\n * second entry\nFollowed by another folded paragraph, ". " * first entry\n * second entry\nFollowed by another folded paragraph, ".
"another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n" "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n"
) ]
--- ---
test: Single quotes test: Single quotes
todo: true todo: true
@ -1315,13 +1315,13 @@ yaml: |
line break' line break'
is same as: "this contains six spaces\nand one line break" is same as: "this contains six spaces\nand one line break"
php: | php: |
array( [
'empty' => '', 'empty' => '',
'second' => '! : \\ etc. can be used freely.', 'second' => '! : \\ etc. can be used freely.',
'third' => "a single quote ' must be escaped.", 'third' => "a single quote ' must be escaped.",
'span' => "this contains six spaces\nand one line break", 'span' => "this contains six spaces\nand one line break",
'is same as' => "this contains six spaces\nand one line break" 'is same as' => "this contains six spaces\nand one line break"
) ]
--- ---
test: Double quotes test: Double quotes
todo: true todo: true
@ -1335,14 +1335,14 @@ yaml: |
spaces" spaces"
is equal to: "this contains four spaces" is equal to: "this contains four spaces"
php: | php: |
array( [
'empty' => '', 'empty' => '',
'second' => '! : etc. can be used freely.', 'second' => '! : etc. can be used freely.',
'third' => 'a " or a \\ must be escaped.', 'third' => 'a " or a \\ must be escaped.',
'fourth' => "this value ends with an LF.\n", 'fourth' => "this value ends with an LF.\n",
'span' => "this contains four spaces", 'span' => "this contains four spaces",
'is equal to' => "this contains four spaces" 'is equal to' => "this contains four spaces"
) ]
--- ---
test: Unquoted strings test: Unquoted strings
todo: true todo: true
@ -1371,7 +1371,7 @@ yaml: |
note: { one-line keys: but multi-line values } note: { one-line keys: but multi-line values }
php: | php: |
array( [
'first' => 'There is no unquoted empty string.', 'first' => 'There is no unquoted empty string.',
'second' => 12, 'second' => 12,
'third' => '12', 'third' => '12',
@ -1379,7 +1379,7 @@ php: |
'indicators' => "this has no comments. #:foo and bar# are both text.", 'indicators' => "this has no comments. #:foo and bar# are both text.",
'flow' => [ 'can span lines', 'like this' ], 'flow' => [ 'can span lines', 'like this' ],
'note' => { 'one-line keys' => 'but multi-line values' } 'note' => { 'one-line keys' => 'but multi-line values' }
) ]
--- ---
test: Spanning sequences test: Spanning sequences
todo: true todo: true
@ -1393,11 +1393,11 @@ yaml: |
- one - one
- two - two
php: | php: |
array( [
'flow' => [ 'one', 'two' ], 'flow' => [ 'one', 'two' ],
'spanning' => [ 'one', 'two' ], 'spanning' => [ 'one', 'two' ],
'block' => [ 'one', 'two' ] 'block' => [ 'one', 'two' ]
) ]
--- ---
test: Flow mappings test: Flow mappings
yaml: | yaml: |
@ -1408,10 +1408,10 @@ yaml: |
one: 1 one: 1
two: 2 two: 2
php: | php: |
array( [
'flow' => array( 'one' => 1, 'two' => 2 ), 'flow' => [ 'one' => 1, 'two' => 2 ],
'block' => array( 'one' => 1, 'two' => 2 ) 'block' => [ 'one' => 1, 'two' => 2 ]
) ]
--- ---
test: Representations of 12 test: Representations of 12
todo: true todo: true
@ -1433,7 +1433,7 @@ yaml: |
- foo/bar - foo/bar
- /a.*b/ - /a.*b/
php: | php: |
array( 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ) [ 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ]
--- ---
test: "Null" test: "Null"
todo: true todo: true
@ -1455,12 +1455,12 @@ yaml: |
only two with values. only two with values.
php: | php: |
array ( [
'canonical' => null, 'canonical' => null,
'english' => null, 'english' => null,
'sparse' => array( null, '2nd entry', null, '4th entry', null ]), 'sparse' => [ null, '2nd entry', null, '4th entry', null ]],
'four' => 'This mapping has five keys, only two with values.' 'four' => 'This mapping has five keys, only two with values.'
) ]
--- ---
test: Omap test: Omap
todo: true todo: true
@ -1525,29 +1525,29 @@ yaml: |
octal: 014 octal: 014
hexadecimal: 0xC hexadecimal: 0xC
php: | php: |
array( [
'canonical' => 12345, 'canonical' => 12345,
'octal' => 12, 'octal' => 12,
'hexadecimal' => 12 'hexadecimal' => 12
) ]
--- ---
test: Decimal test: Decimal
deprecated: true deprecated: true
yaml: | yaml: |
decimal: +12,345 decimal: +12,345
php: | php: |
array( [
'decimal' => 12345.0, 'decimal' => 12345.0,
) ]
--- ---
test: Fixed Float test: Fixed Float
deprecated: true deprecated: true
yaml: | yaml: |
fixed: 1,230.15 fixed: 1,230.15
php: | php: |
array( [
'fixed' => 1230.15, 'fixed' => 1230.15,
) ]
--- ---
test: Float test: Float
yaml: | yaml: |
@ -1556,12 +1556,12 @@ yaml: |
negative infinity: -.inf negative infinity: -.inf
not a number: .NaN not a number: .NaN
php: | php: |
array( [
'canonical' => 1230.15, 'canonical' => 1230.15,
'exponential' => 1230.15, 'exponential' => 1230.15,
'negative infinity' => log(0), 'negative infinity' => log(0),
'not a number' => -log(0) 'not a number' => -log(0)
) ]
--- ---
test: Timestamp test: Timestamp
todo: true todo: true
@ -1571,12 +1571,12 @@ yaml: |
space separated: 2001-12-14 21:59:43.10 -05:00 space separated: 2001-12-14 21:59:43.10 -05:00
date (noon UTC): 2002-12-14 date (noon UTC): 2002-12-14
ruby: | ruby: |
array( [
'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ), 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'date (noon UTC)' => Date.new( 2002, 12, 14 ) 'date (noon UTC)' => Date.new( 2002, 12, 14 )
) ]
--- ---
test: Binary test: Binary
todo: true todo: true

View File

@ -25,14 +25,14 @@ yaml: |
- No, I mean, "And what about Yaml?" - No, I mean, "And what about Yaml?"
- Oh, oh yeah. Uh.. Yaml for Ruby. - Oh, oh yeah. Uh.. Yaml for Ruby.
php: | php: |
array( [
"What's Yaml?", "What's Yaml?",
"It's for writing data structures in plain text.", "It's for writing data structures in plain text.",
"And?", "And?",
"And what? That's not good enough for you?", "And what? That's not good enough for you?",
"No, I mean, \"And what about Yaml?\"", "No, I mean, \"And what about Yaml?\"",
"Oh, oh yeah. Uh.. Yaml for Ruby." "Oh, oh yeah. Uh.. Yaml for Ruby."
) ]
--- ---
test: Indicators in Strings test: Indicators in Strings
brief: > brief: >
@ -43,11 +43,11 @@ yaml: |
same for the pound sign: here we have it#in a string same for the pound sign: here we have it#in a string
the comma can, honestly, be used in most cases: [ but not in, inline collections ] the comma can, honestly, be used in most cases: [ but not in, inline collections ]
php: | php: |
array( [
'the colon followed by space is an indicator' => 'but is a string:right here', 'the colon followed by space is an indicator' => 'but is a string:right here',
'same for the pound sign' => 'here we have it#in a string', 'same for the pound sign' => 'here we have it#in a string',
'the comma can, honestly, be used in most cases' => array('but not in', 'inline collections') 'the comma can, honestly, be used in most cases' => ['but not in', 'inline collections']
) ]
--- ---
test: Forcing Strings test: Forcing Strings
brief: > brief: >
@ -57,10 +57,10 @@ yaml: |
date string: !!str 2001-08-01 date string: !!str 2001-08-01
number string: !!str 192 number string: !!str 192
php: | php: |
array( [
'date string' => '2001-08-01', 'date string' => '2001-08-01',
'number string' => '192' 'number string' => '192'
) ]
--- ---
test: Single-quoted Strings test: Single-quoted Strings
brief: > brief: >
@ -75,12 +75,12 @@ yaml: |
why do i hate them?: 'it''s very hard to explain' why do i hate them?: 'it''s very hard to explain'
entities: '&pound; me' entities: '&pound; me'
php: | php: |
array( [
'all my favorite symbols' => '#:!/%.)', 'all my favorite symbols' => '#:!/%.)',
'a few i hate' => '&(*', 'a few i hate' => '&(*',
'why do i hate them?' => 'it\'s very hard to explain', 'why do i hate them?' => 'it\'s very hard to explain',
'entities' => '&pound; me' 'entities' => '&pound; me'
) ]
--- ---
test: Double-quoted Strings test: Double-quoted Strings
brief: > brief: >
@ -90,9 +90,9 @@ brief: >
yaml: | yaml: |
i know where i want my line breaks: "one here\nand another here\n" i know where i want my line breaks: "one here\nand another here\n"
php: | php: |
array( [
'i know where i want my line breaks' => "one here\nand another here\n" 'i know where i want my line breaks' => "one here\nand another here\n"
) ]
--- ---
test: Multi-line Quoted Strings test: Multi-line Quoted Strings
todo: true todo: true
@ -106,10 +106,10 @@ yaml: |
let it go on and on to other lines let it go on and on to other lines
until i end it with a quote." until i end it with a quote."
php: | php: |
array('i want a long string' => "so i'm going to ". ['i want a long string' => "so i'm going to ".
"let it go on and on to other lines ". "let it go on and on to other lines ".
"until i end it with a quote." "until i end it with a quote."
) ]
--- ---
test: Plain scalars test: Plain scalars
@ -128,7 +128,7 @@ yaml: |
- This would impair my skiing ability somewhat for the - This would impair my skiing ability somewhat for the
duration, as can be imagined. duration, as can be imagined.
php: | php: |
array( [
"My little toe is broken in two places;", "My little toe is broken in two places;",
"I'm crazy to have skied this way;", "I'm crazy to have skied this way;",
"I'm not the craziest he's seen, since there was always ". "I'm not the craziest he's seen, since there was always ".
@ -139,7 +139,7 @@ php: |
"He's going to put my foot in plaster for a month;", "He's going to put my foot in plaster for a month;",
"This would impair my skiing ability somewhat for the duration, ". "This would impair my skiing ability somewhat for the duration, ".
"as can be imagined." "as can be imagined."
) ]
--- ---
test: 'Null' test: 'Null'
brief: > brief: >
@ -149,11 +149,11 @@ yaml: |
hosted by: Bob and David hosted by: Bob and David
date of next season: ~ date of next season: ~
php: | php: |
array( [
'name' => 'Mr. Show', 'name' => 'Mr. Show',
'hosted by' => 'Bob and David', 'hosted by' => 'Bob and David',
'date of next season' => null 'date of next season' => null
) ]
--- ---
test: Boolean test: Boolean
brief: > brief: >
@ -162,10 +162,10 @@ yaml: |
Is Gus a Liar?: true Is Gus a Liar?: true
Do I rely on Gus for Sustenance?: false Do I rely on Gus for Sustenance?: false
php: | php: |
array( [
'Is Gus a Liar?' => true, 'Is Gus a Liar?' => true,
'Do I rely on Gus for Sustenance?' => false 'Do I rely on Gus for Sustenance?' => false
) ]
--- ---
test: Integers test: Integers
dump_skip: true dump_skip: true
@ -177,10 +177,10 @@ yaml: |
zero: 0 zero: 0
simple: 12 simple: 12
php: | php: |
array( [
'zero' => 0, 'zero' => 0,
'simple' => 12, 'simple' => 12,
) ]
--- ---
test: Positive Big Integer test: Positive Big Integer
deprecated: true deprecated: true
@ -192,9 +192,9 @@ brief: >
yaml: | yaml: |
one-thousand: 1,000 one-thousand: 1,000
php: | php: |
array( [
'one-thousand' => 1000.0, 'one-thousand' => 1000.0,
) ]
--- ---
test: Negative Big Integer test: Negative Big Integer
deprecated: true deprecated: true
@ -206,9 +206,9 @@ brief: >
yaml: | yaml: |
negative one-thousand: -1,000 negative one-thousand: -1,000
php: | php: |
array( [
'negative one-thousand' => -1000.0 'negative one-thousand' => -1000.0
) ]
--- ---
test: Floats test: Floats
dump_skip: true dump_skip: true
@ -220,10 +220,10 @@ yaml: |
a simple float: 2.00 a simple float: 2.00
scientific notation: 1.00009e+3 scientific notation: 1.00009e+3
php: | php: |
array( [
'a simple float' => 2.0, 'a simple float' => 2.0,
'scientific notation' => 1000.09 'scientific notation' => 1000.09
) ]
--- ---
test: Larger Float test: Larger Float
dump_skip: true dump_skip: true
@ -235,9 +235,9 @@ brief: >
yaml: | yaml: |
larger float: 1,000.09 larger float: 1,000.09
php: | php: |
array( [
'larger float' => 1000.09, 'larger float' => 1000.09,
) ]
--- ---
test: Time test: Time
todo: true todo: true
@ -250,10 +250,10 @@ yaml: |
iso8601: 2001-12-14t21:59:43.10-05:00 iso8601: 2001-12-14t21:59:43.10-05:00
space separated: 2001-12-14 21:59:43.10 -05:00 space separated: 2001-12-14 21:59:43.10 -05:00
php: | php: |
array( [
'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ) 'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" )
) ]
--- ---
test: Date test: Date
todo: true todo: true

View File

@ -5,7 +5,7 @@ yaml: |
true: true true: true
false: false false: false
php: | php: |
array( [
'true' => true, 'true' => true,
'false' => false, 'false' => false,
) ]

View File

@ -142,14 +142,14 @@ test: Double quotes with a line feed
yaml: | yaml: |
{ double: "some value\n \"some quoted string\" and 'some single quotes one'" } { double: "some value\n \"some quoted string\" and 'some single quotes one'" }
php: | php: |
array( [
'double' => "some value\n \"some quoted string\" and 'some single quotes one'" 'double' => "some value\n \"some quoted string\" and 'some single quotes one'"
) ]
--- ---
test: Backslashes test: Backslashes
yaml: | yaml: |
{ single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" } { single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" }
php: | php: |
array( [
'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var' 'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var'
) ]

View File

@ -5,10 +5,10 @@ yaml: |
true: true true: true
false: false false: false
php: | php: |
array( [
1 => true, 1 => true,
0 => false, 0 => false,
) ]
--- ---
test: Boolean test: Boolean
yaml: | yaml: |
@ -16,8 +16,8 @@ yaml: |
logical: true logical: true
answer: false answer: false
php: | php: |
array( [
false => 'used as key', false => 'used as key',
'logical' => true, 'logical' => true,
'answer' => false 'answer' => false
) ]

View File

@ -4,6 +4,6 @@ spec: 2.21
yaml: | yaml: |
null: ~ null: ~
php: | php: |
array( [
'' => null, '' => null,
) ]

View File

@ -4,6 +4,6 @@ spec: 2.21
yaml: | yaml: |
null: ~ null: ~
php: | php: |
array( [
'null' => null, 'null' => null,
) ]

View File

@ -6,7 +6,7 @@ yaml: |
1: foo 1: foo
0: bar 0: bar
php: | php: |
array(1 => 'foo', 0 => 'bar') [1 => 'foo', 0 => 'bar']
--- ---
test: Integers as Map Keys test: Integers as Map Keys
brief: > brief: >
@ -16,8 +16,8 @@ yaml: |
2: two 2: two
3: three 3: three
php: | php: |
array( [
1 => 'one', 1 => 'one',
2 => 'two', 2 => 'two',
3 => 'three' 3 => 'three'
) ]

View File

@ -11,7 +11,7 @@ yaml: |
ex6: foo#foo # comment here ex6: foo#foo # comment here
ex7: foo # ignore me # and me ex7: foo # ignore me # and me
php: | php: |
array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo') ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo']
--- ---
test: Comments in the middle test: Comments in the middle
brief: > brief: >
@ -24,7 +24,7 @@ yaml: |
# some comment # some comment
# some comment # some comment
php: | php: |
array('foo' => array('bar' => 'foo')) ['foo' => ['bar' => 'foo']]
--- ---
test: Comments on a hash line test: Comments on a hash line
brief: > brief: >
@ -33,7 +33,7 @@ yaml: |
foo: # a comment foo: # a comment
foo: bar # a comment foo: bar # a comment
php: | php: |
array('foo' => array('foo' => 'bar')) ['foo' => ['foo' => 'bar']]
--- ---
test: 'Value starting with a #' test: 'Value starting with a #'
brief: > brief: >
@ -41,7 +41,7 @@ brief: >
yaml: | yaml: |
foo: '#bar' foo: '#bar'
php: | php: |
array('foo' => '#bar') ['foo' => '#bar']
--- ---
test: Document starting with a comment and a separator test: Document starting with a comment and a separator
brief: > brief: >
@ -51,7 +51,7 @@ yaml: |
--- ---
foo: bar # a comment foo: bar # a comment
php: | php: |
array('foo' => 'bar') ['foo' => 'bar']
--- ---
test: Comment containing a colon on a hash line test: Comment containing a colon on a hash line
brief: > brief: >
@ -65,7 +65,7 @@ brief: >
'Hash key containing a #' 'Hash key containing a #'
yaml: 'foo#bar: baz' yaml: 'foo#bar: baz'
php: | php: |
array('foo#bar' => 'baz') ['foo#bar' => 'baz']
--- ---
test: 'Hash key ending with a space and a #' test: 'Hash key ending with a space and a #'
brief: > brief: >
@ -73,4 +73,4 @@ brief: >
yaml: | yaml: |
'foo #': baz 'foo #': baz
php: | php: |
array('foo #' => 'baz') ['foo #' => 'baz']

View File

@ -13,22 +13,22 @@ yaml: |
nick: Biggies nick: Biggies
quantity: 1 quantity: 1
php: | php: |
array ( [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
), ],
array ( [
'item' => 'Basketball', 'item' => 'Basketball',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'item' => array( 'item' => [
'name' => 'Big Shoes', 'name' => 'Big Shoes',
'nick' => 'Biggies' 'nick' => 'Biggies'
), ],
'quantity' => 1 'quantity' => 1
) ]
) ]
--- ---
test: Compact notation combined with inline notation test: Compact notation combined with inline notation
brief: | brief: |
@ -39,18 +39,18 @@ yaml: |
- { item: Super Hoop, quantity: 1 } - { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ] - [ Basketball, Big Shoes ]
php: | php: |
array ( [
'items' => array ( 'items' => [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'Basketball', 'Basketball',
'Big Shoes' 'Big Shoes'
) ]
) ]
) ]
--- %YAML:1.0 --- %YAML:1.0
test: Compact notation test: Compact notation
brief: | brief: |
@ -66,22 +66,22 @@ yaml: |
nick: Biggies nick: Biggies
quantity: 1 quantity: 1
php: | php: |
array ( [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
), ],
array ( [
'item' => 'Basketball', 'item' => 'Basketball',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'item' => array( 'item' => [
'name' => 'Big Shoes', 'name' => 'Big Shoes',
'nick' => 'Biggies' 'nick' => 'Biggies'
), ],
'quantity' => 1 'quantity' => 1
) ]
) ]
--- ---
test: Compact notation combined with inline notation test: Compact notation combined with inline notation
brief: | brief: |
@ -92,18 +92,18 @@ yaml: |
- { item: Super Hoop, quantity: 1 } - { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ] - [ Basketball, Big Shoes ]
php: | php: |
array ( [
'items' => array ( 'items' => [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'Basketball', 'Basketball',
'Big Shoes' 'Big Shoes'
) ]
) ]
) ]
--- %YAML:1.0 --- %YAML:1.0
test: Compact notation test: Compact notation
brief: | brief: |
@ -119,22 +119,22 @@ yaml: |
nick: Biggies nick: Biggies
quantity: 1 quantity: 1
php: | php: |
array ( [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
), ],
array ( [
'item' => 'Basketball', 'item' => 'Basketball',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'item' => array( 'item' => [
'name' => 'Big Shoes', 'name' => 'Big Shoes',
'nick' => 'Biggies' 'nick' => 'Biggies'
), ],
'quantity' => 1 'quantity' => 1
) ]
) ]
--- ---
test: Compact notation combined with inline notation test: Compact notation combined with inline notation
brief: | brief: |
@ -145,15 +145,15 @@ yaml: |
- { item: Super Hoop, quantity: 1 } - { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ] - [ Basketball, Big Shoes ]
php: | php: |
array ( [
'items' => array ( 'items' => [
array ( [
'item' => 'Super Hoop', 'item' => 'Super Hoop',
'quantity' => 1, 'quantity' => 1,
), ],
array ( [
'Basketball', 'Basketball',
'Big Shoes' 'Big Shoes'
) ]
) ]
) ]

View File

@ -46,16 +46,16 @@ yaml: |
head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] } head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
recursive_inline: { <<: *head_inline, c: { <<: *foo2 } } recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
php: | php: |
array( [
'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'), 'foo' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'],
'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'), 'bar' => ['a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'x' => 'Oren'],
'bar_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'), 'bar_inline' => ['a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'e' => 'notnull', 'x' => 'Oren'],
'foo2' => array('a' => 'Ballmer'), 'foo2' => ['a' => 'Ballmer'],
'ding' => array('fi', 'fei', 'fo', 'fam'), 'ding' => ['fi', 'fei', 'fo', 'fam'],
'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), 'check' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'],
'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), 'head' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)), 'taz' => ['a' => 'Steve', 'w' => ['p' => 1234]],
'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)), 'nested' => ['a' => 'Steve', 'w' => ['p' => 12345], 'd' => 'Doug', 'z' => ['p' => 12345]],
'head_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), 'head_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
'recursive_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => array('a' => 'Ballmer'), 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), 'recursive_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => ['a' => 'Ballmer'], 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
) ]

View File

@ -8,4 +8,4 @@ yaml: |
ex3: 'foo # bar' # comment ex3: 'foo # bar' # comment
ex4: foo # comment ex4: foo # comment
php: | php: |
array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo') ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo']

View File

@ -5,7 +5,7 @@ brief: >
yaml: | yaml: |
foo: '| bar' foo: '| bar'
php: | php: |
array('foo' => '| bar') ['foo' => '| bar']
--- ---
test: A key can be a quoted string test: A key can be a quoted string
brief: > brief: >
@ -19,15 +19,15 @@ yaml: |
"foo4: ": bar "foo4: ": bar
foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar } foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar }
php: | php: |
array( [
'foo1' => 'bar', 'foo1' => 'bar',
'foo2' => 'bar', 'foo2' => 'bar',
'foo " bar' => 'bar', 'foo " bar' => 'bar',
'foo \' bar' => 'bar', 'foo \' bar' => 'bar',
'foo3: ' => 'bar', 'foo3: ' => 'bar',
'foo4: ' => 'bar', 'foo4: ' => 'bar',
'foo5' => array( 'foo5' => [
'foo " bar: ' => 'bar', 'foo " bar: ' => 'bar',
'foo \' bar: ' => 'bar', 'foo \' bar: ' => 'bar',
), ],
) ]

View File

@ -5,19 +5,19 @@ brief: >
yaml: | yaml: |
stripped_title: { name: "foo bar", help: "bar foo" } stripped_title: { name: "foo bar", help: "bar foo" }
php: | php: |
array('stripped_title' => array('name' => 'foo bar', 'help' => 'bar foo')) ['stripped_title' => ['name' => 'foo bar', 'help' => 'bar foo']]
--- ---
test: Empty sequence test: Empty sequence
yaml: | yaml: |
foo: [ ] foo: [ ]
php: | php: |
array('foo' => array()) ['foo' => []]
--- ---
test: Empty value test: Empty value
yaml: | yaml: |
foo: foo:
php: | php: |
array('foo' => null) ['foo' => null]
--- ---
test: Inline string parsing test: Inline string parsing
brief: > brief: >
@ -25,7 +25,7 @@ brief: >
yaml: | yaml: |
test: ['complex: string', 'another [string]'] test: ['complex: string', 'another [string]']
php: | php: |
array('test' => array('complex: string', 'another [string]')) ['test' => ['complex: string', 'another [string]']]
--- ---
test: Boolean test: Boolean
brief: > brief: >
@ -40,7 +40,7 @@ yaml: |
- 'null' - 'null'
- '~' - '~'
php: | php: |
array( [
false, false,
true, true,
null, null,
@ -49,7 +49,7 @@ php: |
'true', 'true',
'null', 'null',
'~', '~',
) ]
--- ---
test: Empty lines in literal blocks test: Empty lines in literal blocks
brief: > brief: >
@ -63,7 +63,7 @@ yaml: |
bar bar
php: | php: |
array('foo' => array('bar' => "foo\n\n\n \nbar\n")) ['foo' => ['bar' => "foo\n\n\n \nbar\n"]]
--- ---
test: Empty lines in folded blocks test: Empty lines in folded blocks
brief: > brief: >
@ -77,7 +77,7 @@ yaml: |
bar bar
php: | php: |
array('foo' => array('bar' => "\nfoo\n\nbar\n")) ['foo' => ['bar' => "\nfoo\n\nbar\n"]]
--- ---
test: IP addresses test: IP addresses
brief: > brief: >
@ -85,7 +85,7 @@ brief: >
yaml: | yaml: |
foo: 10.0.0.2 foo: 10.0.0.2
php: | php: |
array('foo' => '10.0.0.2') ['foo' => '10.0.0.2']
--- ---
test: A sequence with an embedded mapping test: A sequence with an embedded mapping
brief: > brief: >
@ -94,28 +94,28 @@ yaml: |
- foo - foo
- bar: { bar: foo } - bar: { bar: foo }
php: | php: |
array('foo', array('bar' => array('bar' => 'foo'))) ['foo', ['bar' => ['bar' => 'foo']]]
--- ---
test: Octal test: Octal
brief: as in spec example 2.19, octal value is converted brief: as in spec example 2.19, octal value is converted
yaml: | yaml: |
foo: 0123 foo: 0123
php: | php: |
array('foo' => 83) ['foo' => 83]
--- ---
test: Octal strings test: Octal strings
brief: Octal notation in a string must remain a string brief: Octal notation in a string must remain a string
yaml: | yaml: |
foo: "0123" foo: "0123"
php: | php: |
array('foo' => '0123') ['foo' => '0123']
--- ---
test: Octal strings test: Octal strings
brief: Octal notation in a string must remain a string brief: Octal notation in a string must remain a string
yaml: | yaml: |
foo: '0123' foo: '0123'
php: | php: |
array('foo' => '0123') ['foo' => '0123']
--- ---
test: Octal strings test: Octal strings
brief: Octal notation in a string must remain a string brief: Octal notation in a string must remain a string
@ -123,18 +123,18 @@ yaml: |
foo: | foo: |
0123 0123
php: | php: |
array('foo' => "0123\n") ['foo' => "0123\n"]
--- ---
test: Document as a simple hash test: Document as a simple hash
brief: Document as a simple hash brief: Document as a simple hash
yaml: | yaml: |
{ foo: bar } { foo: bar }
php: | php: |
array('foo' => 'bar') ['foo' => 'bar']
--- ---
test: Document as a simple array test: Document as a simple array
brief: Document as a simple array brief: Document as a simple array
yaml: | yaml: |
[ foo, bar ] [ foo, bar ]
php: | php: |
array('foo', 'bar') ['foo', 'bar']

View File

@ -8,7 +8,7 @@ yaml: |
- item2 - item2
- item3 - item3
php: | php: |
array('collection' => array('item1', 'item2', 'item3')) ['collection' => ['item1', 'item2', 'item3']]
--- ---
test: Nested unindented collection (two levels) test: Nested unindented collection (two levels)
brief: > brief: >
@ -20,7 +20,7 @@ yaml: |
- b - b
- c - c
php: | php: |
array('collection' => array('key' => array('a', 'b', 'c'))) ['collection' => ['key' => ['a', 'b', 'c']]]
--- ---
test: Nested unindented collection (three levels) test: Nested unindented collection (three levels)
brief: > brief: >
@ -33,7 +33,7 @@ yaml: |
- two - two
- three - three
php: | php: |
array('collection' => array('key' => array('subkey' => array('one', 'two', 'three')))) ['collection' => ['key' => ['subkey' => ['one', 'two', 'three']]]]
--- ---
test: Key/value after unindented collection (1) test: Key/value after unindented collection (1)
brief: > brief: >
@ -46,7 +46,7 @@ yaml: |
- c - c
foo: bar foo: bar
php: | php: |
array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar') ['collection' => ['key' => ['a', 'b', 'c']], 'foo' => 'bar']
--- ---
test: Key/value after unindented collection (at the same level) test: Key/value after unindented collection (at the same level)
brief: > brief: >
@ -59,7 +59,7 @@ yaml: |
- c - c
foo: bar foo: bar
php: | php: |
array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar')) ['collection' => ['key' => ['a', 'b', 'c'], 'foo' => 'bar']]
--- ---
test: Shortcut Key after unindented collection test: Shortcut Key after unindented collection
brief: > brief: >
@ -69,7 +69,7 @@ yaml: |
- key: foo - key: foo
foo: bar foo: bar
php: | php: |
array('collection' => array(array('key' => 'foo', 'foo' => 'bar'))) ['collection' => [['key' => 'foo', 'foo' => 'bar']]]
--- ---
test: Shortcut Key after unindented collection with custom spaces test: Shortcut Key after unindented collection with custom spaces
brief: > brief: >
@ -79,4 +79,4 @@ yaml: |
- key: foo - key: foo
foo: bar foo: bar
php: | php: |
array('collection' => array(array('key' => 'foo', 'foo' => 'bar'))) ['collection' => [['key' => 'foo', 'foo' => 'bar']]]