Test Failed
Push — master ( 1880dd...42571c )
by stéphane
02:35
created
sources/nodes/Blank.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 {
13 13
     public function add(NodeGeneric $child):NodeGeneric
14 14
     {
15
-        if($this->_parent instanceof NodeGeneric) {
15
+        if ($this->_parent instanceof NodeGeneric) {
16 16
             return $this->_parent->add($child);
17 17
         } else {
18 18
             throw new \ParseError(__METHOD__." no parent to add to", 1);
Please login to merge, or discard this patch.
sources/nodes/SetKey.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     public function build(&$parent = null)
30 30
     {
31 31
         $built = is_null($this->value) ? null : $this->value->build();
32
-        $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" '): $built;
32
+        $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" ') : $built;
33 33
         $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES);
34 34
         if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
35 35
         $parent->{trim($key, '\'" ')} = null;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
         $built = is_null($this->value) ? null : $this->value->build();
35 35
         $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" '): $built;
36 36
         $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES);
37
-        if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
37
+        if (empty($key)) {
38
+            throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
39
+        }
38 40
         $parent->{trim($key, '\'" ')} = null;
39 41
         return null;
40 42
     }
Please login to merge, or discard this patch.
sources/nodes/LiteralFolded.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
         $result = '';
22 22
         $list = $value->filterComment();
23 23
         if ($this->identifier !== '+') {
24
-             self::litteralStripLeading($list);
25
-             self::litteralStripTrailing($list);
24
+                self::litteralStripLeading($list);
25
+                self::litteralStripTrailing($list);
26 26
         }
27 27
         if ($list->count()) {
28 28
             $refSeparator = ' ';
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
             $result = $this->getChildValue($first, $indent);
32 32
             foreach ($list as $child) {
33 33
                 $separator = ($result && $result[-1] === "\n") ? '' : $refSeparator;
34
-                if($child->indent > $indent || $child instanceof Blank) {
34
+                if ($child->indent > $indent || $child instanceof Blank) {
35 35
                     $separator = "\n";
36 36
                 }
37
-                $result .= $separator .$this->getChildValue($child, $indent);
37
+                $result .= $separator.$this->getChildValue($child, $indent);
38 38
             }
39 39
         }
40 40
         return $result;
Please login to merge, or discard this patch.
sources/nodes/abstract/Literals.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
     public function add(NodeGeneric $child):NodeGeneric
34 34
     {
35
-        if (is_null($this->value)) $this->value = new NodeList();
35
+        if (is_null($this->value)) {
36
+            $this->value = new NodeList();
37
+        }
36 38
         $candidate = $child;
37 39
         if (!$child->isOneOf('Scalar', 'Blank', 'Comment', 'Quoted')) {
38 40
             $candidate = new Scalar((string) $child->raw, $child->line);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
      * @return     string  The child value.
97 97
      * @todo       double check behaviour for KEY and ITEM
98 98
      */
99
-    protected function getChildValue($child, $refIndent=0):string
99
+    protected function getChildValue($child, $refIndent = 0):string
100 100
     {
101 101
         $value = $child->value;
102 102
         $start = '';
Please login to merge, or discard this patch.
sources/nodes/Key.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function add(NodeGeneric $child):NodeGeneric
63 63
     {
64
-        if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal','LiteralFolded', 'Anchor')) {
64
+        if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal', 'LiteralFolded', 'Anchor')) {
65 65
             return $this->value->add($child);
66 66
         } else {
67 67
             return parent::add($child);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         if ($current instanceof Comment) {
97 97
             return true;
98 98
         }
99
-        if($current instanceof Scalar) {
99
+        if ($current instanceof Scalar) {
100 100
             return $node->isOneOf('Scalar', 'Blank');
101 101
         }
102 102
         if ($current instanceof Item) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     public function setIdentifier(string $keyString)
36 36
     {
37 37
         if ($keyString === '') {
38
-           throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
38
+            throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
39 39
         } else {
40 40
             $node = NodeFactory::get($keyString);
41 41
             if ($node->isOneOf('Tag', 'Quoted')) {
Please login to merge, or discard this patch.
sources/tag/TagFactory.php 2 patches
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,6 @@  discard block
 block discarded – undo
62 62
 %TAG !! tag:example.com,2000:app/
63 63
 %TAG !e! tag:example.com,2000:app/
64 64
 !<tag:yaml.org,2002:str> foo :
65
-
66 65
      */
67 66
     /**
68 67
      * Add Handlers for legacy Yaml tags
@@ -107,16 +106,16 @@  discard block
 block discarded – undo
107 106
             self::createCoreSchema();
108 107
         }
109 108
         if (!($value instanceof NodeGeneric) && !($value instanceof NodeList) ) {
110
-              throw new \Exception(sprintf(self::WRONG_VALUE, $identifier, gettype($value)));
109
+                throw new \Exception(sprintf(self::WRONG_VALUE, $identifier, gettype($value)));
111 110
         } else {
112 111
             // try {
113 112
                 if (!preg_match(Regex::TAG_PARTS, $identifier, $matches)) {
114 113
                     throw new \UnexpectedValueException("Tag '$identifier' is invalid", 1);
115 114
                 }
116 115
                 return self::runHandler($matches['handle'],
117
-                                          $matches['tagname'],
118
-                                          $value,
119
-                                          $parent);
116
+                                            $matches['tagname'],
117
+                                            $value,
118
+                                            $parent);
120 119
             // } catch (\UnexpectedValueException $e) {
121 120
             //     return new Tagged($identifier, is_null($value) ? null : $value->build($parent));
122 121
             // } catch (\Throwable $e) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
         if (count(self::$schemas) === 0) {
107 107
             self::createCoreSchema();
108 108
         }
109
-        if (!($value instanceof NodeGeneric) && !($value instanceof NodeList) ) {
109
+        if (!($value instanceof NodeGeneric) && !($value instanceof NodeList)) {
110 110
               throw new \Exception(sprintf(self::WRONG_VALUE, $identifier, gettype($value)));
111 111
         } else {
112 112
             // try {
Please login to merge, or discard this patch.
sources/nodes/DocStart.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
             throw new \Exception(__METHOD__." expects a YamlObject as parent", 1);
40 40
         }
41 41
         if (!is_null($this->value)) {
42
-            if ($this->value instanceof Tag){
42
+            if ($this->value instanceof Tag) {
43 43
                 preg_match(Regex::TAG_PARTS, $this->value->raw, $tagparts);
44 44
                 if (preg_match("/(?(DEFINE)".Regex::TAG_URI.')(?&url)/', $tagparts['tagname'], $matches)) {
45 45
                     // throw new \UnexpectedValueException("Tag '".$this->value->raw."' is invalid", 1);
Please login to merge, or discard this patch.
sources/nodes/Tag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         } catch (\UnexpectedValueException $e) {
60 60
             return new Tagged($this->tag, is_null($value) ? null : $this->value->build($parent));
61 61
         } catch (\Throwable $e) {
62
-            throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e);;
62
+            throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e); ;
63 63
         }
64 64
     }
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
sources/DumperHandlers.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             }
102 102
         }
103 103
         $previousCompactMode = $this->dumper->_compactMode;
104
-        $this->dumper->_compactMode =  true;
104
+        $this->dumper->_compactMode = true;
105 105
         $result = $this->dumper->iteratorToString(new \ArrayIterator($source), $keyMask, ', ', $indent);
106 106
         $this->dumper->_compactMode = $previousCompactMode;
107 107
         return sprintf($structureFormat, $result);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         // Example 5.13. Escaped Characters
124 124
 
125 125
         $str = json_encode(ltrim($str));
126
-        return strspn(substr($str,1,-1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"');
126
+        return strspn(substr($str, 1, -1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"');
127 127
     }
128 128
 
129 129
     public function dumpTagged(Tagged $obj, int $indent):string
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,12 @@
 block discarded – undo
22 22
 
23 23
     public function dumpScalar($dataType):string
24 24
     {
25
-        if ($dataType === \INF) return '.inf';
26
-        if ($dataType === -\INF) return '-.inf';
25
+        if ($dataType === \INF) {
26
+            return '.inf';
27
+        }
28
+        if ($dataType === -\INF) {
29
+            return '-.inf';
30
+        }
27 31
         $precision = "%.".$this->dumper->floatPrecision."F";
28 32
         switch (gettype($dataType)) {
29 33
             case 'boolean': return $dataType ? 'true' : 'false';
Please login to merge, or discard this patch.