@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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)) { |
@@ -29,7 +29,7 @@ |
||
| 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 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -21,7 +21,7 @@ |
||
| 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); |
@@ -35,7 +35,7 @@ |
||
| 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; |
@@ -12,7 +12,7 @@ |
||
| 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; |
@@ -24,7 +24,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | return parent::add($candidate); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - protected static function litteralStripLeading(NodeList &$list): void |
|
| 47 | + protected static function litteralStripLeading(NodeList&$list): void |
|
| 48 | 48 | { |
| 49 | 49 | $list->rewind(); |
| 50 | 50 | while (!$list->isEmpty() && $list->bottom() instanceof Blank) { //remove leading blank |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $list->rewind(); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected static function litteralStripTrailing(NodeList &$list): void |
|
| 56 | + protected static function litteralStripTrailing(NodeList&$list): void |
|
| 57 | 57 | { |
| 58 | 58 | $list->rewind(); |
| 59 | 59 | while (!$list->isEmpty() && $list->top() instanceof Blank) { //remove trailing blank |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | if (!is_null($this->value)) { |
| 82 | 82 | $tmp = $this->getFinalString($this->value->filterComment()); |
| 83 | - $result = $this->identifier === '-' ? $tmp : $tmp . "\n"; |
|
| 83 | + $result = $this->identifier === '-' ? $tmp : $tmp."\n"; |
|
| 84 | 84 | } |
| 85 | 85 | if ($this->_parent instanceof Root) { |
| 86 | 86 | $this->_parent->getYamlObject()->setText($result); |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | } elseif ($value instanceof Scalar) { |
| 111 | 111 | $value = new NodeList($value); |
| 112 | 112 | } elseif ($value instanceof NodeList && !($child instanceof Scalar)) { |
| 113 | - $start = ltrim($child->raw) . "\n"; |
|
| 113 | + $start = ltrim($child->raw)."\n"; |
|
| 114 | 114 | } |
| 115 | - return $start . $this->getFinalString($value, $refIndent); |
|
| 115 | + return $start.$this->getFinalString($value, $refIndent); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function isAwaitingChild(NodeGeneric $node): bool |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | if ($this->_parent instanceof NodeGeneric) { |
| 80 | 80 | return $this->_parent; |
| 81 | 81 | } else { |
| 82 | - throw new \Exception("Cannnot find a parent for " . get_class($this), 1); |
|
| 82 | + throw new \Exception("Cannnot find a parent for ".get_class($this), 1); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | $cursor = $this->getParent(); |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | protected function getRoot(): Root |
| 106 | 106 | { |
| 107 | 107 | if (is_null($this->_parent)) { |
| 108 | - throw new \Exception(__METHOD__ . ": can only be used when Node has a parent set", 1); |
|
| 108 | + throw new \Exception(__METHOD__.": can only be used when Node has a parent set", 1); |
|
| 109 | 109 | } |
| 110 | 110 | $pointer = $this; |
| 111 | 111 | do { |
| 112 | 112 | if ($pointer->_parent instanceof NodeGeneric) { |
| 113 | 113 | $pointer = $pointer->_parent; |
| 114 | 114 | } else { |
| 115 | - throw new \Exception("Node has no _parent set : " . get_class($pointer), 1); |
|
| 115 | + throw new \Exception("Node has no _parent set : ".get_class($pointer), 1); |
|
| 116 | 116 | } |
| 117 | 117 | } while (!($pointer instanceof Root)); |
| 118 | 118 | return $pointer; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public function specialProcess( |
| 155 | 155 | /** @scrutinizer ignore-unused */ |
| 156 | - NodeGeneric &$previous, |
|
| 156 | + NodeGeneric&$previous, |
|
| 157 | 157 | /** @scrutinizer ignore-unused */ |
| 158 | 158 | array &$emptyLines |
| 159 | 159 | ): bool { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * Find parent target when current Node indentation is lesser than previous node indentation |
| 165 | 165 | * |
| 166 | 166 | */ |
| 167 | - public function getTargetOnLessIndent(NodeGeneric &$node): ?NodeGeneric |
|
| 167 | + public function getTargetOnLessIndent(NodeGeneric&$node): ?NodeGeneric |
|
| 168 | 168 | { |
| 169 | 169 | $supposedParent = $this->getParent($node->indent); |
| 170 | 170 | if ($node instanceof Item && $supposedParent instanceof Root) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * Find parent target when current Node indentation is equal to previous node indentation |
| 187 | 187 | * |
| 188 | 188 | */ |
| 189 | - public function getTargetOnEqualIndent(NodeGeneric &$node): ?NodeGeneric |
|
| 189 | + public function getTargetOnEqualIndent(NodeGeneric&$node): ?NodeGeneric |
|
| 190 | 190 | { |
| 191 | 191 | return $this->getParent(); |
| 192 | 192 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * Find parent target when current Node indentation is superior than previous node indentation |
| 196 | 196 | * |
| 197 | 197 | */ |
| 198 | - public function getTargetOnMoreIndent(NodeGeneric &$node): ?NodeGeneric |
|
| 198 | + public function getTargetOnMoreIndent(NodeGeneric&$node): ?NodeGeneric |
|
| 199 | 199 | { |
| 200 | 200 | return $this->isAwaitingChild($node) ? $this : $this->getParent(); |
| 201 | 201 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function isOneOf(...$classNameList): bool |
| 217 | 217 | { |
| 218 | 218 | foreach ($classNameList as $className) { |
| 219 | - $fqn = "Dallgoot\\Yaml\\Nodes\\$className"; |
|
| 219 | + $fqn = "Dallgoot\\Yaml\\Nodes\\$className"; |
|
| 220 | 220 | if ($this instanceof $fqn) return true; |
| 221 | 221 | } |
| 222 | 222 | return false; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | if ($this->tag) $props['tag'] = "($this->tag)"; |
| 237 | 237 | if ($this->value) $props['value'] = $this->value; |
| 238 | 238 | // $props['value'] = $this->value; |
| 239 | - $props['raw'] = $this->raw; |
|
| 239 | + $props['raw'] = $this->raw; |
|
| 240 | 240 | if (!$this->_parent) $props['parent'] = 'NO PARENT!!!'; |
| 241 | 241 | return $props; |
| 242 | 242 | } |