Test Failed
Push — master ( 46b4fe...b81e8b )
by stéphane
02:30
created
src/Nodes/JSON.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
 class JSON extends NodeGeneric
14 14
 {
15
-    private const JSON_OPTIONS = \JSON_PARTIAL_OUTPUT_ON_ERROR | \JSON_UNESCAPED_SLASHES;
15
+    private const JSON_OPTIONS = \JSON_PARTIAL_OUTPUT_ON_ERROR|\JSON_UNESCAPED_SLASHES;
16 16
 
17 17
     public function build(&$parent = null)
18 18
     {
Please login to merge, or discard this patch.
src/NodeList.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $tmp = clone $this;
48 48
         $tmp->rewind();
49
-        $fqn = __NAMESPACE__ . "\\Nodes\\$nodeType";
49
+        $fqn = __NAMESPACE__."\\Nodes\\$nodeType";
50 50
         foreach ($tmp as $child) {
51 51
             if ($child instanceof $fqn) return true;
52 52
         }
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
             $output = trim($first->raw);
142 142
             foreach ($list as $child) {
143 143
                 if ($child instanceof Scalar) {
144
-                    $separator = isset($output[-1])  && $output[-1] === "\n" ? '' : ' ';
145
-                    $output .= $separator . trim($child->raw);
144
+                    $separator = isset($output[-1]) && $output[-1] === "\n" ? '' : ' ';
145
+                    $output .= $separator.trim($child->raw);
146 146
                 } elseif ($child instanceof Blank) {
147 147
                     $output .= "\n";
148 148
                 } else {
Please login to merge, or discard this patch.
src/DumperHandlers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     {
29 29
         if ($dataType === \INF) return '.inf';
30 30
         if ($dataType === -\INF) return '-.inf';
31
-        $precision = "%." . $this->dumper->floatPrecision . "F";
31
+        $precision = "%.".$this->dumper->floatPrecision."F";
32 32
         switch (gettype($dataType)) {
33 33
             case 'boolean':
34 34
                 return $dataType ? 'true' : 'false';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $pairs = [''];
96 96
         $realIndent = $indent + Dumper::INDENT;
97
-        if($isRoot) {
97
+        if ($isRoot) {
98 98
             $pairs = [];
99 99
             $realIndent = 0;
100 100
         }
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $pairs = [];
112 112
         foreach ($o as $key => $value) {
113
-            $pairs[] = "$key: " . $this->dumper->dump($value, 0, true, false);
113
+            $pairs[] = "$key: ".$this->dumper->dump($value, 0, true, false);
114 114
         }
115
-        return '{'. implode(', ', $pairs) . '}';
115
+        return '{'.implode(', ', $pairs).'}';
116 116
     }
117 117
 
118 118
 
119 119
     public function dumpArray(array $a, int $indent, bool $isCompact = false, $isRoot = false): string
120 120
     {
121
-        if(isset($a[0]) && $a[0] instanceof YamlObject) {
121
+        if (isset($a[0]) && $a[0] instanceof YamlObject) {
122 122
             return $this->dumper->dumpMultiDoc($a);
123 123
         }
124 124
         if (array_keys($a) !== range(0, count($a) - 1)) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $pairs = [''];
135 135
         $realIndent = $indent + Dumper::INDENT;
136
-        if($isRoot) {
136
+        if ($isRoot) {
137 137
             $pairs = [];
138 138
             $realIndent = 0;
139 139
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         foreach ($a as $value) {
152 152
             $pairs[] = $this->dumper->dump($value, $indent, true);
153 153
         }
154
-        return '[' . implode(', ', $pairs) . ']';
154
+        return '['.implode(', ', $pairs).']';
155 155
     }
156 156
 
157 157
 
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
         $separator = "\n";
187 187
         $isCompact = $obj->value instanceof Compact;
188 188
         if (is_scalar($obj->value) || $isCompact) {
189
-            $separator   = ' ';
189
+            $separator = ' ';
190 190
         }
191
-        return ($obj->tagName) . $separator . $this->dumper->dump($obj->value, $indent, $isCompact);
191
+        return ($obj->tagName).$separator.$this->dumper->dump($obj->value, $indent, $isCompact);
192 192
     }
193 193
 
194 194
 
Please login to merge, or discard this patch.
src/Dumper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function toString($dataType, ?int $options = null): string
53 53
     {
54
-        if (empty($dataType)) throw new \Exception(self::class . ": No content to convert to Yaml");
54
+        if (empty($dataType)) throw new \Exception(self::class.": No content to convert to Yaml");
55 55
         if (is_scalar($dataType)) {
56
-            return "--- " . $this->handler->dumpScalar($dataType) . PHP_EOL;
56
+            return "--- ".$this->handler->dumpScalar($dataType).PHP_EOL;
57 57
         }
58 58
         return $this->dump($dataType, 0, false, true);
59 59
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         foreach ($arrayOfYamlObject as $yamlObject) {
96 96
             $docs[] = $this->dumpYamlObject($yamlObject);
97 97
         }
98
-        return "---\n" . implode("\n---\n", $docs);
98
+        return "---\n".implode("\n---\n", $docs);
99 99
     }
100 100
 
101 101
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $pairs = [];
115 115
         if (count($properties) === 0) {
116 116
             return $this->handler->dumpArray($obj->getArrayCopy(), 0, false, true);
117
-        }else {
117
+        } else {
118 118
             return $this->handler->dumpObject($obj, 0, false, true);
119 119
         }
120 120
     }
Please login to merge, or discard this patch.
src/Yaml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         try {
48 48
             return (new Loader(null, $options, $debug))->parse($someYaml);
49 49
         } catch (\Throwable $e) {
50
-            throw new \Exception(__CLASS__ . " Error while parsing YAML string", 1, $e);
50
+            throw new \Exception(__CLASS__." Error while parsing YAML string", 1, $e);
51 51
         }
52 52
     }
53 53
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         try {
75 75
             return (new Loader($fileName, $options, (int) $debug))->parse();
76 76
         } catch (\Throwable $e) {
77
-            throw new \Exception(__CLASS__ . " Error during parsing '$fileName'", 1, $e);
77
+            throw new \Exception(__CLASS__." Error during parsing '$fileName'", 1, $e);
78 78
         }
79 79
     }
80 80
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         try {
94 94
             return (new Dumper($options))->toString($somePhpVar);
95 95
         } catch (\Throwable $e) {
96
-            throw new \Exception(__CLASS__ . " Error dumping", 1, $e);
96
+            throw new \Exception(__CLASS__." Error dumping", 1, $e);
97 97
         }
98 98
     }
99 99
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         try {
116 116
             return (new Dumper($options))->toFile($fileName, $somePhpVar);
117 117
         } catch (\Throwable $e) {
118
-            throw new \Exception(__CLASS__ . " Error during dumping '$fileName'", 1, $e);
118
+            throw new \Exception(__CLASS__." Error during dumping '$fileName'", 1, $e);
119 119
         }
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
src/Types/YamlObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 {
16 16
     private YamlProperties $__yaml__object__api;
17 17
 
18
-    const UNDEFINED_METHOD = self::class . ": undefined method '%s', valid methods are (addReference,getReference,getAllReferences,addComment,getComment,setText,addTag,hasDocStart,isTagged)";
18
+    const UNDEFINED_METHOD = self::class.": undefined method '%s', valid methods are (addReference,getReference,getAllReferences,addComment,getComment,setText,addTag,hasDocStart,isTagged)";
19 19
     const UNKNOWN_REFERENCE = "no reference named: '%s', known are : (%s)";
20 20
     const UNAMED_REFERENCE  = "reference MUST have a name";
21 21
     const TAGHANDLE_DUPLICATE = "Tag handle '%s' already declared before, handle must be unique";
Please login to merge, or discard this patch.
src/Types/Compact.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         //ArrayIterator options --> Array indices can be accessed as properties in read/write.
23 23
         parent::__construct(
24 24
         /** @scrutinizer ignore-type */
25
-        $candidate, \ArrayIterator::STD_PROP_LIST | \ArrayIterator::ARRAY_AS_PROPS);
25
+        $candidate, \ArrayIterator::STD_PROP_LIST|\ArrayIterator::ARRAY_AS_PROPS);
26 26
     }
27 27
 
28 28
     /**
Please login to merge, or discard this patch.
examples/batch_read.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 //documents to load
12 12
 $files = ['examples/dummy.yml', 'examples/config.yml'];
13 13
 
14
-foreach($files as $key => $fileName)
14
+foreach ($files as $key => $fileName)
15 15
 {
16
-    $yamlObjList[] =  $yloader->load($fileName)->parse();
16
+    $yamlObjList[] = $yloader->load($fileName)->parse();
17 17
 }
18 18
 
19 19
 print_r($yamlObjList);
Please login to merge, or discard this patch.
src/Nodes/DocStart.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
     public function build(&$parent = null)
38 38
     {
39 39
         if (is_null($parent)) {
40
-            throw new \Exception(__METHOD__ . " expects a YamlObject as parent", 1);
40
+            throw new \Exception(__METHOD__." expects a YamlObject as parent", 1);
41 41
         }
42 42
         if (!is_null($this->value)) {
43 43
             if ($this->value instanceof Tag) {
44 44
                 preg_match(Regex::TAG_PARTS, $this->value->raw, $tagparts);
45
-                if (preg_match("/(?(DEFINE)" . Regex::TAG_URI . ')(?&url)/', $tagparts['tagname'], $matches)) {
45
+                if (preg_match("/(?(DEFINE)".Regex::TAG_URI.')(?&url)/', $tagparts['tagname'], $matches)) {
46 46
                     $parent->addTag($tagparts['handle'], $tagparts['tagname']);
47 47
                 } else {
48 48
                     $this->value->build($parent);
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
         return $this->value instanceof NodeGeneric && $this->value->isOneOf('Anchor', 'Literal', 'LiteralFolded');
61 61
     }
62 62
 
63
-    public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric
63
+    public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric
64 64
     {
65 65
         if ($this->value instanceof NodeGeneric) {
66 66
             if ($this->value instanceof Tag) {
67
-                if (!preg_match("/" . Regex::TAG_URI . "/", $this->value->raw)) {
67
+                if (!preg_match("/".Regex::TAG_URI."/", $this->value->raw)) {
68 68
                     return $this->value;
69 69
                 }
70 70
             } elseif ($this->value->isAwaitingChild($node)) {
Please login to merge, or discard this patch.