Test Failed
Push — master ( 41f581...fc4f20 )
by stéphane
13:19
created
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.
sources/nodes/Literal.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         $result = '';
18 18
         $list = $list->filterComment();
19 19
         if ($this->identifier !== '+') {
20
-             self::litteralStripTrailing($list);
20
+                self::litteralStripTrailing($list);
21 21
         }
22 22
         if ($list->count()) {
23 23
             $list->setIteratorMode(NodeList::IT_MODE_DELETE);
Please login to merge, or discard this patch.
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
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
      * @return     string  The child value.
95 95
      * @todo       double check behaviour for KEY and ITEM
96 96
      */
97
-    protected function getChildValue(object $child, $refIndent=0):string
97
+    protected function getChildValue(object $child, $refIndent = 0):string
98 98
     {
99 99
         $value = $child->value;
100 100
         $start = '';
Please login to merge, or discard this patch.
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.
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.
examples/write.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,4 +24,6 @@
 block discarded – undo
24 24
 if ($nameResultPair[$testName] !== $text) {
25 25
     var_dump('EXPECTED', $nameResultPair[$testName]);
26 26
     var_dump('RECEIVED', $text);
27
-} else echo 'WRITE OK !!!';
27
+} else {
28
+    echo 'WRITE OK !!!';
29
+}
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 define('PROJECT_ROOT', __DIR__."/../");
3 3
 
4
-require_once PROJECT_ROOT . 'vendor/autoload.php';
4
+require_once PROJECT_ROOT.'vendor/autoload.php';
5 5
 
6 6
 use Dallgoot\Yaml;
7 7
 // use Dallgoot\Yaml\{Loader, Dumper};
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 // $yaml = (new Loader('./dummy.yml', null, 0))->parse();
15 15
 // var_dump($yaml);
16 16
 $testName = 'yamlObject_properties';
17
-$yamlObject = (include PROJECT_ROOT . "tests/cases/dumping/$testName.php");
18
-echo memory_get_usage() . "\n";
17
+$yamlObject = (include PROJECT_ROOT."tests/cases/dumping/$testName.php");
18
+echo memory_get_usage()."\n";
19 19
 
20 20
 $text = Yaml::dump($yamlObject, 0);
21 21
 
22
-echo memory_get_usage() . "\n";
23
-$nameResultPair = get_object_vars(/** @scrutinizer ignore-type */ Yaml::parseFile(PROJECT_ROOT . 'tests/definitions/dumping_tests.yml'));
22
+echo memory_get_usage()."\n";
23
+$nameResultPair = get_object_vars(/** @scrutinizer ignore-type */ Yaml::parseFile(PROJECT_ROOT.'tests/definitions/dumping_tests.yml'));
24 24
 
25 25
 // var_dump($nameResultPair);
26 26
 
Please login to merge, or discard this patch.