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:
```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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,16 +46,16 @@ yaml: |
head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
php: |
array(
'foo' => array('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_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'),
'foo2' => array('a' => 'Ballmer'),
'ding' => array('fi', 'fei', 'fo', 'fam'),
'check' => array('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'),
'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)),
'head_inline' => array('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'),
)
[
'foo' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'],
'bar' => ['a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'x' => 'Oren'],
'bar_inline' => ['a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'e' => 'notnull', 'x' => 'Oren'],
'foo2' => ['a' => 'Ballmer'],
'ding' => ['fi', 'fei', 'fo', 'fam'],
'check' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'],
'head' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
'taz' => ['a' => 'Steve', 'w' => ['p' => 1234]],
'nested' => ['a' => 'Steve', 'w' => ['p' => 12345], 'd' => 'Doug', 'z' => ['p' => 12345]],
'head_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', '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
ex4: foo # comment
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: |
foo: '| bar'
php: |
array('foo' => '| bar')
['foo' => '| bar']
---
test: A key can be a quoted string
brief: >
@ -19,15 +19,15 @@ yaml: |
"foo4: ": bar
foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar }
php: |
array(
[
'foo1' => 'bar',
'foo2' => 'bar',
'foo " bar' => 'bar',
'foo \' bar' => 'bar',
'foo3: ' => 'bar',
'foo4: ' => 'bar',
'foo5' => array(
'foo5' => [
'foo " bar: ' => 'bar',
'foo \' bar: ' => 'bar',
),
)
],
]

View File

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

View File

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