Test Failed
Push — master ( 1880dd...42571c )
by stéphane
02:35
created
sources/API.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
             return $this->_anchors[$name];
70 70
         }
71 71
         throw new \UnexpectedValueException(sprintf(self::UNKNOWN_REFERENCE,
72
-                                                    $name, implode(',',array_keys($this->_anchors)))
72
+                                                    $name, implode(',', array_keys($this->_anchors)))
73 73
                                                 );
74 74
     }
75 75
 
Please login to merge, or discard this patch.
sources/types/YamlObject.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,12 @@
 block discarded – undo
74 74
     {
75 75
         $prop = get_object_vars($this);
76 76
         unset($prop["__yaml__object__api"]);
77
-        if (count($prop) > 0) return $prop;
78
-        if (count($this) > 0) return iterator_to_array($this);
77
+        if (count($prop) > 0) {
78
+            return $prop;
79
+        }
80
+        if (count($this) > 0) {
81
+            return iterator_to_array($this);
82
+        }
79 83
         return $this->__yaml__object__api->value ?? "_Empty YamlObject_";
80 84
     }
81 85
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         try {
58 58
             return call_user_func_array([$this->__yaml__object__api, $funcName], $arguments);
59 59
         } catch (\Throwable $e) {
60
-            throw new \BadMethodCallException(sprintf(self::UNDEFINED_METHOD, $funcName), 1,$e);
60
+            throw new \BadMethodCallException(sprintf(self::UNDEFINED_METHOD, $funcName), 1, $e);
61 61
         }
62 62
     }
63 63
 
Please login to merge, or discard this patch.
sources/NodeList.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,12 +79,12 @@
 block discarded – undo
79 79
      */
80 80
     public function checkTypeCoherence($estimatedType):bool
81 81
     {
82
-       // if ($this->type === self::MAPPING) {
83
-       //     if ($estimatedType === self::SEQUENCE) {
84
-       //         throw new \ParseError("Error : no coherence in types", 1);
85
-       //     }
86
-       // }
87
-       return (bool) $estimatedType;
82
+        // if ($this->type === self::MAPPING) {
83
+        //     if ($estimatedType === self::SEQUENCE) {
84
+        //         throw new \ParseError("Error : no coherence in types", 1);
85
+        //     }
86
+        // }
87
+        return (bool) $estimatedType;
88 88
     }
89 89
 
90 90
     public function build(&$parent = null)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 && !($child instanceof Directive)
65 65
                 && !($child instanceof Blank)
66 66
                 && !($child instanceof Docstart
67
-                && is_null($child->value)) ) return true;
67
+                && is_null($child->value))) return true;
68 68
         }
69 69
         return false;
70 70
     }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
     public function push($node)
73 73
     {
74 74
         $type = null;
75
-        if     ($node instanceof Item )    $type = self::SEQUENCE;
75
+        if ($node instanceof Item)    $type = self::SEQUENCE;
76 76
         elseif ($node instanceof Key)      $type = self::MAPPING;
77 77
         elseif ($node instanceof SetKey
78 78
              || $node instanceof SetValue) {
79 79
             $type = self::SET;
80
-        } elseif ($node instanceof Scalar ){
80
+        } elseif ($node instanceof Scalar) {
81 81
             $type = self::MULTILINE;
82 82
         }
83 83
         if (!is_null($type) && $this->checkTypeCoherence($type)) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             $output = trim($first->raw);
140 140
             foreach ($list as $child) {
141 141
                 if ($child instanceof Scalar) {
142
-                    $separator = isset($output[-1])  && $output[-1] === "\n" ? '' : ' ';
142
+                    $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' ';
143 143
                     $output .= $separator.trim($child->raw);
144 144
                 } elseif ($child instanceof Blank) {
145 145
                     $output .= "\n";
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
             if ($child instanceof Comment) {
166 166
                 // $child->build();
167 167
             } else {
168
-                if($child->value instanceof Comment) {
168
+                if ($child->value instanceof Comment) {
169 169
                     // $child->value->build();
170 170
                     // $child->value = null;
171
-                } elseif($child->value instanceof NodeList) {
171
+                } elseif ($child->value instanceof NodeList) {
172 172
                     $child->value = $child->value->filterComment();
173 173
                 }
174 174
                 $out->push($child);
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
         $tmp->rewind();
51 51
         $fqn = __NAMESPACE__."\\Nodes\\$nodeType";
52 52
         foreach ($tmp as $child) {
53
-            if ($child instanceof $fqn) return true;
53
+            if ($child instanceof $fqn) {
54
+                return true;
55
+            }
54 56
         }
55 57
         return false;
56 58
     }
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
                 && !($child instanceof Directive)
65 67
                 && !($child instanceof Blank)
66 68
                 && !($child instanceof Docstart
67
-                && is_null($child->value)) ) return true;
69
+                && is_null($child->value)) ) {
70
+                return true;
71
+            }
68 72
         }
69 73
         return false;
70 74
     }
@@ -72,9 +76,11 @@  discard block
 block discarded – undo
72 76
     public function push($node)
73 77
     {
74 78
         $type = null;
75
-        if     ($node instanceof Item )    $type = self::SEQUENCE;
76
-        elseif ($node instanceof Key)      $type = self::MAPPING;
77
-        elseif ($node instanceof SetKey
79
+        if     ($node instanceof Item ) {
80
+            $type = self::SEQUENCE;
81
+        } elseif ($node instanceof Key) {
82
+            $type = self::MAPPING;
83
+        } elseif ($node instanceof SetKey
78 84
              || $node instanceof SetValue) {
79 85
             $type = self::SET;
80 86
         } elseif ($node instanceof Scalar ){
Please login to merge, or discard this patch.
examples/load_modify_save.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Dallgoot\Yaml;
3 3
 
4
-require_once __DIR__ . '/../../vendor/autoload.php';
4
+require_once __DIR__.'/../../vendor/autoload.php';
5 5
 
6 6
 use Dallgoot;
7 7
 
8
-$fileName = __DIR__ . '/../dummy.yml';
8
+$fileName = __DIR__.'/../dummy.yml';
9 9
 
10 10
 $yamlObject = Yaml::parseFile($fileName, $options = null, $debug = null);
11 11
 
Please login to merge, or discard this patch.
sources/nodes/CompactMapping.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(string $nodeString, int $line)
14 14
     {
15 15
         parent::__construct($nodeString, $line);
16
-        preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches);
16
+        preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
17 17
         foreach ($matches['k'] as $index => $property) {
18 18
             $pair = $property.': '.trim($matches['v'][$index]);
19 19
             $child = NodeFactory::get($pair, $line);
Please login to merge, or discard this patch.
sources/nodes/Comment.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
  */
11 11
 class Comment extends NodeGeneric
12 12
 {
13
-   public function specialProcess(NodeGeneric &$previous, array &$emptyLines):bool
14
-   {
13
+    public function specialProcess(NodeGeneric &$previous, array &$emptyLines):bool
14
+    {
15 15
         $previous->getRoot()->add($this);
16 16
         return true;
17
-   }
17
+    }
18 18
 
19
-   public function build(&$parent = null)
20
-   {
19
+    public function build(&$parent = null)
20
+    {
21 21
         $root = $this->getRoot();
22 22
         $yamlObject = $root->getYamlObject();
23 23
         $yamlObject->addComment($this->line, $this->raw);
24 24
         return null;
25
-   }
25
+    }
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
sources/nodes/CompactSequence.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function __construct(string $nodeString, int $line)
19 19
     {
20 20
         parent::__construct($nodeString, $line);
21
-        preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches);
21
+        preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
22 22
         foreach ($matches['item'] as $key => $item) {
23 23
             $i = new Item('', $line);
24 24
             $i->indent = null;
Please login to merge, or discard this patch.
sources/nodes/abstract/NodeGeneric.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         return false;
154 154
     }
155 155
 
156
-   /**
156
+    /**
157 157
      * Find parent target when current Node indentation is lesser than previous node indentation
158 158
      *
159 159
      * @param NodeGeneric $node
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         return $this->getParent();
190 190
     }
191 191
 
192
-   /**
192
+    /**
193 193
      * Find parent target when current Node indentation is superior than previous node indentation
194 194
      *
195 195
      * @param NodeGeneric $node
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getParent(int $indent = null):NodeGeneric
73 73
     {
74
-        if (!is_int($indent)){
74
+        if (!is_int($indent)) {
75 75
             if ($this->_parent instanceof NodeGeneric) {
76 76
                 return $this->_parent;
77 77
             } else {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         if ($this->tag)        $props['tag']        = "($this->tag)";
246 246
         if ($this->value)      $props['value']      = $this->value;
247 247
         // $props['value'] = $this->value;
248
-        $props['raw']   = $this->raw;
248
+        $props['raw'] = $this->raw;
249 249
         if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
250 250
         return $props;
251 251
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -226,7 +226,9 @@  discard block
 block discarded – undo
226 226
     {
227 227
         foreach ($classNameList as $className) {
228 228
             $fqn = __NAMESPACE__."\\$className";
229
-            if ($this instanceof $fqn) return true;
229
+            if ($this instanceof $fqn) {
230
+                return true;
231
+            }
230 232
         }
231 233
         return false;
232 234
     }
@@ -240,13 +242,23 @@  discard block
 block discarded – undo
240 242
     {
241 243
         $props = [];
242 244
         $props['line->indent'] = "$this->line -> $this->indent";
243
-        if ($this->identifier) $props['identifier'] = "($this->identifier)";
244
-        if ($this->anchor)     $props['anchor']     = "($this->anchor)";
245
-        if ($this->tag)        $props['tag']        = "($this->tag)";
246
-        if ($this->value)      $props['value']      = $this->value;
245
+        if ($this->identifier) {
246
+            $props['identifier'] = "($this->identifier)";
247
+        }
248
+        if ($this->anchor) {
249
+            $props['anchor']     = "($this->anchor)";
250
+        }
251
+        if ($this->tag) {
252
+            $props['tag']        = "($this->tag)";
253
+        }
254
+        if ($this->value) {
255
+            $props['value']      = $this->value;
256
+        }
247 257
         // $props['value'] = $this->value;
248 258
         $props['raw']   = $this->raw;
249
-        if (!$this->_parent)  $props['parent'] = 'NO PARENT!!!';
259
+        if (!$this->_parent) {
260
+            $props['parent'] = 'NO PARENT!!!';
261
+        }
250 262
         return $props;
251 263
     }
252 264
 }
Please login to merge, or discard this patch.
sources/nodes/Item.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         if ($value instanceof Key && $child instanceof Key) {
32 32
             if ($value->indent === $child->indent) {
33 33
                 return parent::add($child);
34
-            } elseif ($value->isAwaitingChild($child)){
34
+            } elseif ($value->isAwaitingChild($child)) {
35 35
                 return $value->add($child);
36 36
             } else {
37 37
                 // throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1);
Please login to merge, or discard this patch.