@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | public function testAddFails($value) |
87 | 87 | { |
88 | 88 | $this->setExpectedException( |
89 | - 'SebastianBergmann\\RecursionContext\\Exception', |
|
90 | - 'Only arrays and objects are supported' |
|
89 | + 'SebastianBergmann\\RecursionContext\\Exception', |
|
90 | + 'Only arrays and objects are supported' |
|
91 | 91 | ); |
92 | 92 | $this->context->add($value); |
93 | 93 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | public function testContainsFails($value) |
101 | 101 | { |
102 | 102 | $this->setExpectedException( |
103 | - 'SebastianBergmann\\RecursionContext\\Exception', |
|
104 | - 'Only arrays and objects are supported' |
|
103 | + 'SebastianBergmann\\RecursionContext\\Exception', |
|
104 | + 'Only arrays and objects are supported' |
|
105 | 105 | ); |
106 | 106 | $this->context->contains($value); |
107 | 107 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $obj2 = new \stdClass(); |
46 | 46 | $obj2->foo = 'bar'; |
47 | 47 | |
48 | - $obj3 = (object) array(1,2,"Test\r\n",4,5,6,7,8); |
|
48 | + $obj3 = (object) array(1, 2, "Test\r\n", 4, 5, 6, 7, 8); |
|
49 | 49 | |
50 | 50 | $obj = new \stdClass(); |
51 | 51 | //@codingStandardsIgnoreStart |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $obj->object = $obj2; |
60 | 60 | $obj->objectagain = $obj2; |
61 | 61 | $obj->array = array('foo' => 'bar'); |
62 | - $obj->array2 = array(1,2,3,4,5,6); |
|
62 | + $obj->array2 = array(1, 2, 3, 4, 5, 6); |
|
63 | 63 | $obj->array3 = array($obj, $obj2, $obj3); |
64 | 64 | $obj->self = $obj; |
65 | 65 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $prefix = $indent ? str_repeat(' ', $indent) : ''; |
53 | 53 | |
54 | 54 | if ($inline <= 0 || !is_array($input) || empty($input)) { |
55 | - $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); |
|
55 | + $output .= $prefix . Inline::dump($input, $exceptionOnInvalidType, $objectSupport); |
|
56 | 56 | } else { |
57 | 57 | $isAHash = array_keys($input) !== range(0, count($input) - 1); |
58 | 58 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | |
62 | 62 | $output .= sprintf('%s%s%s%s', |
63 | 63 | $prefix, |
64 | - $isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-', |
|
64 | + $isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport) . ':' : '-', |
|
65 | 65 | $willBeInlined ? ' ' : "\n", |
66 | 66 | $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport) |
67 | - ).($willBeInlined ? "\n" : ''); |
|
67 | + ) . ($willBeInlined ? "\n" : ''); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -29,17 +29,17 @@ |
||
29 | 29 | // on the input arrays. This ordering of the characters avoids the use of strtr, |
30 | 30 | // which performs more slowly. |
31 | 31 | private static $escapees = array('\\', '\\\\', '\\"', '"', |
32 | - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
33 | - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
34 | - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
35 | - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
36 | - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); |
|
32 | + "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
33 | + "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
34 | + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
35 | + "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
36 | + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); |
|
37 | 37 | private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', |
38 | - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
39 | - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
40 | - '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
|
41 | - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
42 | - '\\N', '\\_', '\\L', '\\P'); |
|
38 | + '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
39 | + '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
40 | + '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
|
41 | + '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
42 | + '\\N', '\\_', '\\L', '\\P'); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Determines if a PHP value would require double quoting in YAML. |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | // on the input arrays. This ordering of the characters avoids the use of strtr, |
30 | 30 | // which performs more slowly. |
31 | 31 | private static $escapees = array('\\', '\\\\', '\\"', '"', |
32 | - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
33 | - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
34 | - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
35 | - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
32 | + "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", |
|
33 | + "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", |
|
34 | + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", |
|
35 | + "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", |
|
36 | 36 | "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); |
37 | 37 | private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', |
38 | - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
39 | - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
38 | + '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', |
|
39 | + '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', |
|
40 | 40 | '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', |
41 | - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
41 | + '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', |
|
42 | 42 | '\\N', '\\_', '\\L', '\\P'); |
43 | 43 | |
44 | 44 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function requiresDoubleQuoting($value) |
52 | 52 | { |
53 | - return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); |
|
53 | + return preg_match('/' . self::REGEX_CHARACTER_TO_ESCAPE . '/u', $value); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); |
99 | 99 | } else { |
100 | 100 | if (isset($values['leadspaces']) |
101 | - && preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $values['value'], $matches) |
|
101 | + && preg_match('#^(?P<key>' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $values['value'], $matches) |
|
102 | 102 | ) { |
103 | 103 | // this is a compact notation element, add to next block and parse |
104 | 104 | $c = $this->getRealCurrentLineNb(); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $block = $values['value']; |
109 | 109 | if ($this->isNextLineIndented()) { |
110 | - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); |
|
110 | + $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if ($isRef) { |
119 | 119 | $this->refs[$isRef] = end($data); |
120 | 120 | } |
121 | - } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { |
|
121 | + } elseif (preg_match('#^(?P<key>' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { |
|
122 | 122 | if ($context && 'sequence' == $context) { |
123 | 123 | throw new ParseException('You cannot define a mapping item when in a sequence'); |
124 | 124 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | return $this->refs[$value]; |
489 | 489 | } |
490 | 490 | |
491 | - if (preg_match('/^'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { |
|
491 | + if (preg_match('/^' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) { |
|
492 | 492 | $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; |
493 | 493 | |
494 | 494 | return $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers)); |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | $previousLineIndented = false; |
589 | 589 | $previousLineBlank = true; |
590 | 590 | } elseif (' ' === $blockLines[$i][0]) { |
591 | - $text .= "\n".$blockLines[$i]; |
|
591 | + $text .= "\n" . $blockLines[$i]; |
|
592 | 592 | $previousLineIndented = true; |
593 | 593 | $previousLineBlank = false; |
594 | 594 | } elseif ($previousLineIndented) { |
595 | - $text .= "\n".$blockLines[$i]; |
|
595 | + $text .= "\n" . $blockLines[$i]; |
|
596 | 596 | $previousLineIndented = false; |
597 | 597 | $previousLineBlank = false; |
598 | 598 | } elseif ($previousLineBlank || 0 === $i) { |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $previousLineIndented = false; |
601 | 601 | $previousLineBlank = false; |
602 | 602 | } else { |
603 | - $text .= ' '.$blockLines[$i]; |
|
603 | + $text .= ' ' . $blockLines[$i]; |
|
604 | 604 | $previousLineIndented = false; |
605 | 605 | $previousLineBlank = false; |
606 | 606 | } |
@@ -767,6 +767,6 @@ discard block |
||
767 | 767 | */ |
768 | 768 | private function isBlockScalarHeader() |
769 | 769 | { |
770 | - return (bool) preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine); |
|
770 | + return (bool) preg_match('~' . self::BLOCK_SCALAR_HEADER_PATTERN . '$~', $this->currentLine); |
|
771 | 771 | } |
772 | 772 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $this->parser = new Parser(); |
41 | 41 | $this->dumper = new Dumper(); |
42 | - $this->path = __DIR__.'/Fixtures'; |
|
42 | + $this->path = __DIR__ . '/Fixtures'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | protected function tearDown() |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | public function testSpecifications() |
80 | 80 | { |
81 | - $files = $this->parser->parse(file_get_contents($this->path.'/index.yml')); |
|
81 | + $files = $this->parser->parse(file_get_contents($this->path . '/index.yml')); |
|
82 | 82 | foreach ($files as $file) { |
83 | - $yamls = file_get_contents($this->path.'/'.$file.'.yml'); |
|
83 | + $yamls = file_get_contents($this->path . '/' . $file . '.yml'); |
|
84 | 84 | |
85 | 85 | // split YAMLs documents |
86 | 86 | foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } elseif (isset($test['todo']) && $test['todo']) { |
95 | 95 | // TODO |
96 | 96 | } else { |
97 | - eval('$expected = '.trim($test['php']).';'); |
|
97 | + eval('$expected = ' . trim($test['php']) . ';'); |
|
98 | 98 | $this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']); |
99 | 99 | } |
100 | 100 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | try { |
54 | 54 | $requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); |
55 | 55 | if (false === setlocale(LC_NUMERIC, $requiredLocales)) { |
56 | - $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales)); |
|
56 | + $this->markTestSkipped('Could not set any of required locales: ' . implode(', ', $requiredLocales)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $this->assertEquals('1.2', Inline::dump(1.2)); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | public function getDataFormSpecifications() |
40 | 40 | { |
41 | 41 | $parser = new Parser(); |
42 | - $path = __DIR__.'/Fixtures'; |
|
42 | + $path = __DIR__ . '/Fixtures'; |
|
43 | 43 | |
44 | 44 | $tests = array(); |
45 | - $files = $parser->parse(file_get_contents($path.'/index.yml')); |
|
45 | + $files = $parser->parse(file_get_contents($path . '/index.yml')); |
|
46 | 46 | foreach ($files as $file) { |
47 | - $yamls = file_get_contents($path.'/'.$file.'.yml'); |
|
47 | + $yamls = file_get_contents($path . '/' . $file . '.yml'); |
|
48 | 48 | |
49 | 49 | // split YAMLs documents |
50 | 50 | foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if (isset($test['todo']) && $test['todo']) { |
57 | 57 | // TODO |
58 | 58 | } else { |
59 | - eval('$expected = '.trim($test['php']).';'); |
|
59 | + eval('$expected = ' . trim($test['php']) . ';'); |
|
60 | 60 | |
61 | 61 | $tests[] = array($file, var_export($expected, true), $test['yaml'], $test['test']); |
62 | 62 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->fail('YAML files must not contain tabs'); |
84 | 84 | } catch (\Exception $e) { |
85 | 85 | $this->assertInstanceOf('\Exception', $e, 'YAML files must not contain tabs'); |
86 | - $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "'.strpbrk($yaml, "\t").'").', $e->getMessage(), 'YAML files must not contain tabs'); |
|
86 | + $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "' . strpbrk($yaml, "\t") . '").', $e->getMessage(), 'YAML files must not contain tabs'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function unescapeDoubleQuotedString($value) |
51 | 51 | { |
52 | - $callback = function ($match) { |
|
52 | + $callback = function($match) { |
|
53 | 53 | return $this->unescapeCharacter($match[0]); |
54 | 54 | }; |
55 | 55 | |
56 | 56 | // evaluate the string |
57 | - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); |
|
57 | + return preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | return chr($c); |
132 | 132 | } |
133 | 133 | if (0x800 > $c) { |
134 | - return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F); |
|
134 | + return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); |
|
135 | 135 | } |
136 | 136 | if (0x10000 > $c) { |
137 | - return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); |
|
137 | + return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); |
|
138 | 138 | } |
139 | 139 | |
140 | - return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); |
|
140 | + return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); |
|
141 | 141 | } |
142 | 142 | } |
@@ -312,6 +312,9 @@ |
||
312 | 312 | public $errors; |
313 | 313 | public $value = null; |
314 | 314 | |
315 | + /** |
|
316 | + * @param string $value |
|
317 | + */ |
|
315 | 318 | public function __construct($value) |
316 | 319 | { |
317 | 320 | $this->value = $value; |