Test Failed
Push — master ( 46b4fe...b81e8b )
by stéphane
02:30
created
src/Nodes/Item.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
                 return $value->add($child);
38 38
             } else {
39 39
                 // throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1);
40
-                throw new \ParseError('key @' . $value->line . ' has already a value', 1);
40
+                throw new \ParseError('key @'.$value->line.' has already a value', 1);
41 41
             }
42 42
         }
43 43
         return parent::add($child);
44 44
     }
45 45
 
46
-    public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric
46
+    public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric
47 47
     {
48 48
         $supposedParent = $this->getParent();
49 49
         if ($node->indent === $supposedParent->indent) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         return $supposedParent;
53 53
     }
54 54
 
55
-    public function getTargetOnMoreIndent(NodeGeneric &$node): NodeGeneric
55
+    public function getTargetOnMoreIndent(NodeGeneric&$node): NodeGeneric
56 56
     {
57 57
         return $this->value instanceof NodeGeneric && $this->value->isAwaitingChild($node) ? $this->value : $this;
58 58
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function build(&$parent = null)
69 69
     {
70 70
         if (!is_null($parent) && !is_array($parent) && !($parent instanceof YamlObject)) {
71
-            throw new \Exception("parent must be an array or YamlObject not " .
71
+            throw new \Exception("parent must be an array or YamlObject not ".
72 72
                 (is_object($parent) ? get_class($parent) : gettype($parent)));
73 73
         }
74 74
         $value = $this->value ? $this->value->build() : null;
Please login to merge, or discard this patch.
src/Nodes/Key.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Key extends NodeGeneric
17 17
 {
18
-    const ERROR_NO_KEYNAME = self::class . ": key has NO IDENTIFIER on line %d";
18
+    const ERROR_NO_KEYNAME = self::class.": key has NO IDENTIFIER on line %d";
19 19
 
20 20
     public function __construct(string $nodeString, int $line, array $matches = null)
21 21
     {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         }
64 64
     }
65 65
 
66
-    public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric
66
+    public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric
67 67
     {
68 68
         if ($node instanceof Item) {
69 69
             return $this;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         return $this->getParent();
72 72
     }
73 73
 
74
-    public function getTargetOnMoreIndent(NodeGeneric &$node): NodeGeneric
74
+    public function getTargetOnMoreIndent(NodeGeneric&$node): NodeGeneric
75 75
     {
76 76
         if (!is_null($this->value)) {
77 77
             if ($this->getDeepestNode()->isAwaitingChild($node)) {
Please login to merge, or discard this patch.
src/Nodes/Literal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
                 $value = "\n";
30 30
                 if (!($child instanceof Blank)) {
31 31
                     $newIndent = $indent > 0 ? $child->indent - $indent : 0;
32
-                    $value .= str_repeat(' ', $newIndent) . $this->getChildValue($child, $indent);
32
+                    $value .= str_repeat(' ', $newIndent).$this->getChildValue($child, $indent);
33 33
                 }
34 34
                 $result .= $value;
35 35
             }
Please login to merge, or discard this patch.
src/Nodes/Partial.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return     boolean  true to skip normal Loader process, false to continue
23 23
      */
24
-    public function specialProcess(NodeGeneric &$current, array &$emptyLines): bool
24
+    public function specialProcess(NodeGeneric&$current, array &$emptyLines): bool
25 25
     {
26 26
         $parent = $this->getParent();
27 27
         $addValue = ltrim($current->raw);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             $addValue = "\n";
34 34
             $separator = '';
35 35
         }
36
-        $node = NodeFactory::get($this->raw . $separator . $addValue, $this->line);
36
+        $node = NodeFactory::get($this->raw.$separator.$addValue, $this->line);
37 37
         $node->indent = null;
38 38
         $parent->value = null;
39 39
         $parent->add($node);
Please login to merge, or discard this patch.
src/Nodes/Anchor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
             try {
22 22
                 return $yamlObject->getReference($name);
23 23
             } catch (\Throwable $e) {
24
-                throw new \ParseError("Unknown anchor : '$name' this:" . $this->anchor, 1, $e);
24
+                throw new \ParseError("Unknown anchor : '$name' this:".$this->anchor, 1, $e);
25 25
             }
26 26
         } else {
27 27
             $built = is_null($this->value) ? null : $this->value->build($parent);
Please login to merge, or discard this patch.
src/Nodes/LiteralFolded.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
                 if ($child->indent > $indent || $child instanceof Blank) {
36 36
                     $separator = "\n";
37 37
                 }
38
-                $result .= $separator . $this->getChildValue($child, $indent);
38
+                $result .= $separator.$this->getChildValue($child, $indent);
39 39
             }
40 40
         }
41 41
         return $result;
Please login to merge, or discard this patch.
src/Nodes/Scalar.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,8 +97,12 @@  discard block
 block discarded – undo
97 97
  \.nan | \.NaN | \.NAN   tag:yaml.org,2002:float (Not a number)
98 98
  *   tag:yaml.org,2002:str (Default)
99 99
  */
100
-        if (Regex::isDate($v))   return ($this->getRoot()->getYamlObject()->getOptions() & Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v;
101
-        if (Regex::isNumber($v)) return $this->getNumber($v);
100
+        if (Regex::isDate($v)) {
101
+            return ($this->getRoot()->getYamlObject()->getOptions() & Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v;
102
+        }
103
+        if (Regex::isNumber($v)) {
104
+            return $this->getNumber($v);
105
+        }
102 106
         $types = [
103 107
             'yes'   => true,
104 108
             'no'    => false,
@@ -143,8 +147,12 @@  discard block
 block discarded – undo
143 147
      */
144 148
     private function getNumber(string $v)
145 149
     {
146
-        if ((bool) preg_match(Regex::OCTAL_NUM, $v)) return intval(base_convert($v, 8, 10));
147
-        if ((bool) preg_match(Regex::HEX_NUM, $v))   return intval(base_convert($v, 16, 10));
150
+        if ((bool) preg_match(Regex::OCTAL_NUM, $v)) {
151
+            return intval(base_convert($v, 8, 10));
152
+        }
153
+        if ((bool) preg_match(Regex::HEX_NUM, $v)) {
154
+            return intval(base_convert($v, 16, 10));
155
+        }
148 156
         return is_bool(strpos($v, '.')) || substr_count($v, '.') > 1 ? intval($v) : floatval($v);
149 157
     }
150 158
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         return is_null($this->value) ? $this->getScalar(trim($this->raw)) : $this->value->build();
49 49
     }
50 50
 
51
-    public function getTargetOnLessIndent(NodeGeneric &$node): NodeGeneric
51
+    public function getTargetOnLessIndent(NodeGeneric&$node): NodeGeneric
52 52
     {
53 53
         if ($node instanceof Scalar || $node instanceof Blank) {
54 54
             return $this->getParent();
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
     }
59 59
 
60
-    public function getTargetOnMoreIndent(NodeGeneric &$node): NodeGeneric
60
+    public function getTargetOnMoreIndent(NodeGeneric&$node): NodeGeneric
61 61
     {
62 62
         return $this->getParent();
63 63
     }
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function replaceSequences($value = '')
116 116
     {
117
-        $replaceUnicodeSeq = function ($matches) {
118
-            return json_decode('"' . $matches[1] . '"');
117
+        $replaceUnicodeSeq = function($matches) {
118
+            return json_decode('"'.$matches[1].'"');
119 119
         };
120
-        $replaceNonPrintable = function ($matches) {
121
-            return $matches[1] . "";
120
+        $replaceNonPrintable = function($matches) {
121
+            return $matches[1]."";
122 122
         };
123 123
         return preg_replace_callback_array(
124 124
             [
Please login to merge, or discard this patch.
src/Nodes/Comment.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
12 12
  */
13 13
 class Comment extends NodeGeneric
14 14
 {
15
-     public function specialProcess(NodeGeneric &$previous, array &$emptyLines): bool
16
-     {
17
-          $previous->getRoot()->add($this);
18
-          return true;
19
-     }
15
+        public function specialProcess(NodeGeneric &$previous, array &$emptyLines): bool
16
+        {
17
+            $previous->getRoot()->add($this);
18
+            return true;
19
+        }
20 20
 
21
-     public function build(&$parent = null)
22
-     {
23
-          $root = $this->getRoot();
24
-          $yamlObject = $root->getYamlObject();
25
-          $yamlObject->addComment($this->line, $this->raw);
26
-          return null;
27
-     }
21
+        public function build(&$parent = null)
22
+        {
23
+            $root = $this->getRoot();
24
+            $yamlObject = $root->getYamlObject();
25
+            $yamlObject->addComment($this->line, $this->raw);
26
+            return null;
27
+        }
28 28
 }
Please login to merge, or discard this 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
 class Comment extends NodeGeneric
14 14
 {
15
-     public function specialProcess(NodeGeneric &$previous, array &$emptyLines): bool
15
+     public function specialProcess(NodeGeneric&$previous, array &$emptyLines): bool
16 16
      {
17 17
           $previous->getRoot()->add($this);
18 18
           return true;
Please login to merge, or discard this patch.
src/Nodes/Tag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         return is_null($this->value);
25 25
     }
26 26
 
27
-    public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric
27
+    public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric
28 28
     {
29 29
         if (is_null($this->value) && $this->indent > 0) {
30 30
             return $this;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         } catch (\UnexpectedValueException $e) {
65 65
             return new Tagged((string) $this->tag, is_null($value) ? null : $this->value->build($parent));
66 66
         } catch (\Throwable $e) {
67
-            throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e);;
67
+            throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e); ;
68 68
         }
69 69
     }
70 70
 }
Please login to merge, or discard this patch.