Merge branch '4.3' into 4.4
* 4.3: Fix tests on console cs fix Fix path to phpunit binary [Yaml] PHP-8: Uncaught TypeError: abs() expects parameter 1 to be int or float, string given
This commit is contained in:
commit
6328eff652
@ -116,11 +116,11 @@ TABLE
|
|||||||
$books,
|
$books,
|
||||||
'compact',
|
'compact',
|
||||||
<<<'TABLE'
|
<<<'TABLE'
|
||||||
ISBN Title Author
|
ISBN Title Author
|
||||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||||
960-425-059-0 The Lord of the Rings J. R. R. Tolkien
|
960-425-059-0 The Lord of the Rings J. R. R. Tolkien
|
||||||
80-902734-1-6 And Then There Were None Agatha Christie
|
80-902734-1-6 And Then There Were None Agatha Christie
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
],
|
],
|
||||||
@ -129,14 +129,14 @@ TABLE
|
|||||||
$books,
|
$books,
|
||||||
'borderless',
|
'borderless',
|
||||||
<<<'TABLE'
|
<<<'TABLE'
|
||||||
=============== ========================== ==================
|
=============== ========================== ==================
|
||||||
ISBN Title Author
|
ISBN Title Author
|
||||||
=============== ========================== ==================
|
=============== ========================== ==================
|
||||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||||
960-425-059-0 The Lord of the Rings J. R. R. Tolkien
|
960-425-059-0 The Lord of the Rings J. R. R. Tolkien
|
||||||
80-902734-1-6 And Then There Were None Agatha Christie
|
80-902734-1-6 And Then There Were None Agatha Christie
|
||||||
=============== ========================== ==================
|
=============== ========================== ==================
|
||||||
|
|
||||||
TABLE
|
TABLE
|
||||||
],
|
],
|
||||||
|
@ -670,7 +670,7 @@ class Parser
|
|||||||
if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
|
if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
|
||||||
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
|
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
|
||||||
|
|
||||||
$data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
|
$data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs((int) $modifiers));
|
||||||
|
|
||||||
if ('' !== $matches['tag'] && '!' !== $matches['tag']) {
|
if ('' !== $matches['tag'] && '!' !== $matches['tag']) {
|
||||||
if ('!!binary' === $matches['tag']) {
|
if ('!!binary' === $matches['tag']) {
|
||||||
|
@ -2108,6 +2108,48 @@ YAML;
|
|||||||
|
|
||||||
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
|
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseValueWithModifiers()
|
||||||
|
{
|
||||||
|
$yaml = <<<YAML
|
||||||
|
parameters:
|
||||||
|
abc: |+5 # plus five spaces indent
|
||||||
|
one
|
||||||
|
two
|
||||||
|
three
|
||||||
|
four
|
||||||
|
five
|
||||||
|
YAML;
|
||||||
|
$this->assertSame(
|
||||||
|
[
|
||||||
|
'parameters' => [
|
||||||
|
'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
$this->parser->parse($yaml)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseValueWithNegativeModifiers()
|
||||||
|
{
|
||||||
|
$yaml = <<<YAML
|
||||||
|
parameters:
|
||||||
|
abc: |-3 # minus
|
||||||
|
one
|
||||||
|
two
|
||||||
|
three
|
||||||
|
four
|
||||||
|
five
|
||||||
|
YAML;
|
||||||
|
$this->assertSame(
|
||||||
|
[
|
||||||
|
'parameters' => [
|
||||||
|
'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
$this->parser->parse($yaml)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B
|
class B
|
||||||
|
Reference in New Issue
Block a user