@@ -79,12 +79,12 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | public function checkTypeCoherence($estimatedType):bool |
| 81 | 81 | { |
| 82 | - // if ($this->type === self::MAPPING) { |
|
| 83 | - // if ($estimatedType === self::SEQUENCE) { |
|
| 84 | - // throw new \ParseError("Error : no coherence in types", 1); |
|
| 85 | - // } |
|
| 86 | - // } |
|
| 87 | - return (bool) $estimatedType; |
|
| 82 | + // if ($this->type === self::MAPPING) { |
|
| 83 | + // if ($estimatedType === self::SEQUENCE) { |
|
| 84 | + // throw new \ParseError("Error : no coherence in types", 1); |
|
| 85 | + // } |
|
| 86 | + // } |
|
| 87 | + return (bool) $estimatedType; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function build(&$parent = null) |
@@ -92,13 +92,13 @@ |
||
| 92 | 92 | if (Regex::isDate($v)) return self::$dateAsObject && !$onlyScalar ? date_create($v) : $v; |
| 93 | 93 | if (Regex::isNumber($v)) return self::getNumber($v); |
| 94 | 94 | $types = ['yes' => true, |
| 95 | - 'no' => false, |
|
| 96 | - 'true' => true, |
|
| 97 | - 'false' => false, |
|
| 98 | - 'null' => null, |
|
| 99 | - '.inf' => \INF, |
|
| 100 | - '-.inf' => -\INF, |
|
| 101 | - '.nan' => \NAN |
|
| 95 | + 'no' => false, |
|
| 96 | + 'true' => true, |
|
| 97 | + 'false' => false, |
|
| 98 | + 'null' => null, |
|
| 99 | + '.inf' => \INF, |
|
| 100 | + '-.inf' => -\INF, |
|
| 101 | + '.nan' => \NAN |
|
| 102 | 102 | ]; |
| 103 | 103 | return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : $v; |
| 104 | 104 | } |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Comment extends NodeGeneric |
| 12 | 12 | { |
| 13 | - public function specialProcess(NodeGeneric &$previous, array &$emptyLines):bool |
|
| 14 | - { |
|
| 13 | + public function specialProcess(NodeGeneric &$previous, array &$emptyLines):bool |
|
| 14 | + { |
|
| 15 | 15 | $previous->getRoot()->add($this); |
| 16 | 16 | return true; |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function build(&$parent = null) |
|
| 20 | - { |
|
| 19 | + public function build(&$parent = null) |
|
| 20 | + { |
|
| 21 | 21 | $root = $this->getRoot(); |
| 22 | 22 | $yamlObject = $root->getYamlObject(); |
| 23 | 23 | $yamlObject->addComment($this->line, $this->raw); |
| 24 | 24 | return null; |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -153,7 +153,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -17,7 +17,7 @@ |
||
| 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); |
@@ -35,7 +35,7 @@ |
||
| 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 | $keyNode = NodeFactory::get($keyString); |
| 41 | 41 | if ($keyNode instanceof Tag || $keyNode instanceof Quoted) { |
@@ -21,8 +21,8 @@ |
||
| 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 = ' '; |
@@ -62,7 +62,6 @@ discard block |
||
| 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 |
@@ -114,9 +113,9 @@ discard block |
||
| 114 | 113 | throw new \UnexpectedValueException("Tag '$identifier' is invalid", 1); |
| 115 | 114 | } |
| 116 | 115 | return self::runHandler($matches['handle'], |
| 117 | - $matches['tagname'], |
|
| 118 | - $value, |
|
| 119 | - $parent); |
|
| 116 | + $matches['tagname'], |
|
| 117 | + $value, |
|
| 118 | + $parent); |
|
| 120 | 119 | } catch (\UnexpectedValueException $e) { |
| 121 | 120 | return new Tagged($identifier, is_null($value) ? null : $value->build($parent)); |
| 122 | 121 | } catch (\Throwable $e) { |
@@ -96,8 +96,8 @@ |
||
| 96 | 96 | private function dumpYamlObject(YamlObject $obj):string |
| 97 | 97 | { |
| 98 | 98 | if ($this->multipleDocs || $obj->hasDocStart() || $obj->isTagged()) { |
| 99 | - $this->multipleDocs = true; |
|
| 100 | - // && $this->$result instanceof DLL) $this->$result->push("---"); |
|
| 99 | + $this->multipleDocs = true; |
|
| 100 | + // && $this->$result instanceof DLL) $this->$result->push("---"); |
|
| 101 | 101 | } |
| 102 | 102 | if (count($obj) > 0) { |
| 103 | 103 | return $this->iteratorToString($obj, '-', 0); |