Merge branch '2.2' into 2.3
* 2.2: [Routing] fix phpdoc [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash.
This commit is contained in:
commit
39f59b0fe9
@ -57,7 +57,7 @@ class Route implements \Serializable
|
|||||||
private $options = array();
|
private $options = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var null|RouteCompiler
|
* @var null|CompiledRoute
|
||||||
*/
|
*/
|
||||||
private $compiled;
|
private $compiled;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class Parser
|
|||||||
$data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
|
$data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) {
|
} elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && false === strpos($values['key'],' #')) {
|
||||||
if ($context && 'sequence' == $context) {
|
if ($context && 'sequence' == $context) {
|
||||||
throw new ParseException('You cannot define a mapping item when in a sequence');
|
throw new ParseException('You cannot define a mapping item when in a sequence');
|
||||||
}
|
}
|
||||||
|
@ -49,3 +49,17 @@ yaml: |
|
|||||||
foo: bar # a comment
|
foo: bar # a comment
|
||||||
php: |
|
php: |
|
||||||
array('foo' => 'bar')
|
array('foo' => 'bar')
|
||||||
|
---
|
||||||
|
test: Comment containing a colon on a hash line
|
||||||
|
brief: >
|
||||||
|
Comment containing a colon on a scalar line
|
||||||
|
yaml: 'foo # comment: this is also part of the comment'
|
||||||
|
php: |
|
||||||
|
'foo'
|
||||||
|
---
|
||||||
|
test: 'Hash key containing a #'
|
||||||
|
brief: >
|
||||||
|
'Hash key containing a #'
|
||||||
|
yaml: 'foo#bar: baz'
|
||||||
|
php: |
|
||||||
|
array('foo#bar' => 'baz')
|
||||||
|
Reference in New Issue
Block a user