Test Failed
Push — master ( 46b4fe...b81e8b )
by stéphane
02:30
created
src/Builder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @return YamlObject the YAML document as an object
70 70
      */
71
-    public function buildDocument(NodeList &$list, int $docNum): YamlObject
71
+    public function buildDocument(NodeList&$list, int $docNum): YamlObject
72 72
     {
73 73
         $yamlObject = new YamlObject($this->_options);
74 74
         $rootNode   = new Root();
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
             }
84 84
             return $rootNode->build($yamlObject);
85 85
         } catch (\Throwable $e) {
86
-            throw new \ParseError(sprintf(self::INVALID_DOCUMENT, $docNum) . ':' . $e->getMessage(), 2, $e);
86
+            throw new \ParseError(sprintf(self::INVALID_DOCUMENT, $docNum).':'.$e->getMessage(), 2, $e);
87 87
         }
88 88
     }
89 89
 
90
-    public function pushAndSave(DocEnd $child, NodeList &$buffer, array &$documents)
90
+    public function pushAndSave(DocEnd $child, NodeList&$buffer, array &$documents)
91 91
     {
92 92
         $buffer->push($child);
93 93
         $documents[] = $this->buildDocument($buffer, count($documents) + 1);
94 94
         $buffer = new NodeList();
95 95
     }
96 96
 
97
-    public function saveAndPush(DocStart $child, NodeList &$buffer, array &$documents)
97
+    public function saveAndPush(DocStart $child, NodeList&$buffer, array &$documents)
98 98
     {
99 99
         if ($buffer->count() > 0 && $buffer->hasContent()) {
100 100
             $documents[] = $this->buildDocument($buffer, count($documents) + 1);
Please login to merge, or discard this patch.
src/NodeFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class NodeFactory
21 21
 {
22
-    private const JSON_OPTIONS = \JSON_PARTIAL_OUTPUT_ON_ERROR | \JSON_UNESCAPED_SLASHES;
22
+    private const JSON_OPTIONS = \JSON_PARTIAL_OUTPUT_ON_ERROR|\JSON_UNESCAPED_SLASHES;
23 23
 
24 24
     final public static function get(string $nodeString, int $line = 0, bool $debug = false): NodeGeneric
25 25
     {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             $match => new Nodes\Key($nodeString, $line, $matches),
33 33
             default => self::onCharacter($trimmed[0], $nodeString, $line)
34 34
         };
35
-        if ($debug) echo $line . ":" . get_class($node) . "\n";
35
+        if ($debug) echo $line.":".get_class($node)."\n";
36 36
         return $node;
37 37
     }
38 38
 
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
             $match => new Nodes\Key($nodeString, $line, $matches),
33 33
             default => self::onCharacter($trimmed[0], $nodeString, $line)
34 34
         };
35
-        if ($debug) echo $line . ":" . get_class($node) . "\n";
35
+        if ($debug) {
36
+            echo $line . ":" . get_class($node) . "\n";
37
+        }
36 38
         return $node;
37 39
     }
38 40
 
Please login to merge, or discard this patch.
src/Tag/SymfonySchema.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@
 block discarded – undo
40 40
     public function __call($name, $arguments)
41 41
     {
42 42
         //TODO : handle 'php/object'
43
-        if(in_array($name, ['php/object'])) {
43
+        if (in_array($name, ['php/object'])) {
44 44
             return match($name) {
45 45
                 'php/object' => self::PHPobjectHandler($arguments),
46 46
                 default => null,
47 47
             };
48 48
         }
49
-        throw new \Exception("no handler for tag '$name' in " . self::class, 1);
49
+        throw new \Exception("no handler for tag '$name' in ".self::class, 1);
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
src/Tag/TagFactory.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,6 @@
 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
Please login to merge, or discard this patch.
src/Tag/CoreSchema.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     const SCHEMA_URI = 'tag:yaml.org,2002:';
24 24
     const BUILDING_NAMESPACE = "\\";
25 25
 
26
-    private const ERROR_SET = 'Error : tag ' . self::class . ":'set' can NOT be a single Node : must be a NodeList";
27
-    private const ERROR_OMAP = 'Error : tag ' . self::class . ":'omap' MUST have Nodes\Item *with* a Nodes\Key";
26
+    private const ERROR_SET = 'Error : tag '.self::class.":'set' can NOT be a single Node : must be a NodeList";
27
+    private const ERROR_OMAP = 'Error : tag '.self::class.":'omap' MUST have Nodes\Item *with* a Nodes\Key";
28 28
 
29 29
     public function __call($name, $arguments)
30 30
     {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return string  The value considered as 'binary' Note: the difference with strHandler is that multiline have not separation
87 87
      */
88
-    public function binary($node, NodeGeneric &$parent = null)
88
+    public function binary($node, NodeGeneric&$parent = null)
89 89
     {
90 90
         return $this->str($node, $parent);
91 91
     }
Please login to merge, or discard this patch.
src/Loader.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
     private array $_blankBuffer = [];
36 36
 
37 37
     //Exceptions messages
38
-    private const INVALID_VALUE        = self::class . ": at line %d";
39
-    private const EXCEPTION_NO_FILE    = self::class . ": file '%s' does not exists (or path is incorrect?)";
40
-    private const EXCEPTION_READ_ERROR = self::class . ": file '%s' failed to be loaded (permission denied ?)";
41
-    private const EXCEPTION_LINE_SPLIT = self::class . ": content is not a string (maybe a file error?)";
38
+    private const INVALID_VALUE        = self::class.": at line %d";
39
+    private const EXCEPTION_NO_FILE    = self::class.": file '%s' does not exists (or path is incorrect?)";
40
+    private const EXCEPTION_READ_ERROR = self::class.": file '%s' failed to be loaded (permission denied ?)";
41
+    private const EXCEPTION_LINE_SPLIT = self::class.": content is not a string (maybe a file error?)";
42 42
 
43 43
     /**
44 44
      * Loader constructor
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     private function getSourceGenerator(?string $strContent = null): \Generator
101 101
     {
102 102
         if (is_null($strContent)) {
103
-            if(is_null($this->content)) {
103
+            if (is_null($this->content)) {
104 104
                 throw new \Exception(self::EXCEPTION_LINE_SPLIT);
105
-            }else {
105
+            } else {
106 106
                 $source = $this->content;
107 107
             }
108 108
         } else {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function parse(?string $strContent = null)
132 132
     {
133
-        if(!is_null($strContent)) {
133
+        if (!is_null($strContent)) {
134 134
             $this->content = null;
135 135
         }
136 136
         $generator = $this->getSourceGenerator($strContent);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $deepest = $previous->getDeepestNode();
187 187
         if ($deepest instanceof Nodes\Partial) {
188
-            return $deepest->specialProcess($current,  $this->_blankBuffer);
188
+            return $deepest->specialProcess($current, $this->_blankBuffer);
189 189
         } elseif (!($current instanceof Nodes\Partial)) {
190 190
             return $current->specialProcess($previous, $this->_blankBuffer);
191 191
         }
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
     private function onError(\Throwable $e)
196 196
     {
197 197
         $file = $this->filePath ? realpath($this->filePath) : '#YAML STRING#';
198
-        $message = $e->getMessage() . "\n " . $e->getFile() . ":" . $e->getLine();
198
+        $message = $e->getMessage()."\n ".$e->getFile().":".$e->getLine();
199 199
         if ($this->_options & self::NO_PARSING_EXCEPTIONS) {
200 200
             self::$error = $message;
201 201
             return null;
202 202
         }
203
-        throw new \Exception($message . " for $file:" . $e->getLine(), 1, $e);
203
+        throw new \Exception($message." for $file:".$e->getLine(), 1, $e);
204 204
     }
205 205
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         if (is_null($strContent)) {
103 103
             if(is_null($this->content)) {
104 104
                 throw new \Exception(self::EXCEPTION_LINE_SPLIT);
105
-            }else {
105
+            } else {
106 106
                 $source = $this->content;
107 107
             }
108 108
         } else {
@@ -139,7 +139,9 @@  discard block
 block discarded – undo
139 139
         try {
140 140
             foreach ($generator as $lineNB => $lineString) {
141 141
                 $node = NodeFactory::get($lineString, $lineNB, $debugNodeFactory);
142
-                if ($this->needsSpecialProcess($node, $previous)) continue;
142
+                if ($this->needsSpecialProcess($node, $previous)) {
143
+                    continue;
144
+                }
143 145
                 $this->_attachBlankLines($previous);
144 146
                 $target = match ($node->indent <=> $previous->indent) {
145 147
                     -1 => $previous->getTargetOnLessIndent($node),
Please login to merge, or discard this patch.
src/Nodes/CompactMapping.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
         parent::__construct($nodeString, $line);
22 22
         preg_match_all(Regex::MAPPING_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches);
23 23
         foreach ($matches['k'] as $index => $property) {
24
-            $pair = $property . ': ' . trim($matches['v'][$index]);
24
+            $pair = $property.': '.trim($matches['v'][$index]);
25 25
             $child = NodeFactory::get($pair, (int) $line);
26 26
             $child->indent = null;
27 27
             $this->add($child);
Please login to merge, or discard this patch.
src/Nodes/SetKey.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
     {
35 35
         $built = is_null($this->value) ? null : $this->value->build();
36 36
         $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" ') : $built;
37
-        $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);
38
-        if (empty($key)) throw new \Exception("Cant serialize complex key: " . var_export($this->value, true));
37
+        $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_UNESCAPED_SLASHES);
38
+        if (empty($key)) throw new \Exception("Cant serialize complex key: ".var_export($this->value, true));
39 39
         $parent->{trim($key, '\'" ')} = null;
40 40
         return null;
41 41
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
         $built = is_null($this->value) ? null : $this->value->build();
36 36
         $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" ') : $built;
37 37
         $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);
38
-        if (empty($key)) throw new \Exception("Cant serialize complex key: " . var_export($this->value, true));
38
+        if (empty($key)) {
39
+            throw new \Exception("Cant serialize complex key: " . var_export($this->value, true));
40
+        }
39 41
         $parent->{trim($key, '\'" ')} = null;
40 42
         return null;
41 43
     }
Please login to merge, or discard this patch.
src/Nodes/Directive.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 class Directive extends NodeGeneric
17 17
 {
18 18
     private const ERROR_BUILDING = "Error : can not build Directive";
19
-    private const WARNING_LOWER_VERSION  = "The declared version '%s' is obsolete, there may be features that are deprecated and therefore not handled, minimum supported is: " . Yaml::VERSION_SUPPORT;
20
-    private const WARNING_HIGHER_VERSION = "The declared version '%s' is not yet supported, minimum supported is: " . Yaml::VERSION_SUPPORT;
19
+    private const WARNING_LOWER_VERSION  = "The declared version '%s' is obsolete, there may be features that are deprecated and therefore not handled, minimum supported is: ".Yaml::VERSION_SUPPORT;
20
+    private const WARNING_HIGHER_VERSION = "The declared version '%s' is not yet supported, minimum supported is: ".Yaml::VERSION_SUPPORT;
21 21
 
22 22
     /**
23 23
      * Builds a Directive : update YamlObject if applicable.
Please login to merge, or discard this patch.