@@ -45,7 +45,7 @@ |
||
45 | 45 | */ |
46 | 46 | public function denyOverwrite($deny = \true) |
47 | 47 | { |
48 | - $this->allowOverwrite = !$deny; |
|
48 | + $this->allowOverwrite = ! $deny; |
|
49 | 49 | return $this; |
50 | 50 | } |
51 | 51 | /** |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function remap($key, $plural = null) |
36 | 36 | { |
37 | - $this->remappings[] = [$key, null === $plural ? $key . 's' : $plural]; |
|
37 | + $this->remappings[] = [$key, null === $plural ? $key.'s' : $plural]; |
|
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | /** |
@@ -192,11 +192,11 @@ |
||
192 | 192 | protected function getNodeClass($type) |
193 | 193 | { |
194 | 194 | $type = \strtolower($type); |
195 | - if (!isset($this->nodeMapping[$type])) { |
|
195 | + if ( ! isset($this->nodeMapping[$type])) { |
|
196 | 196 | throw new \RuntimeException(\sprintf('The node type "%s" is not registered.', $type)); |
197 | 197 | } |
198 | 198 | $class = $this->nodeMapping[$type]; |
199 | - if (!\class_exists($class)) { |
|
199 | + if ( ! \class_exists($class)) { |
|
200 | 200 | throw new \RuntimeException(\sprintf('The node class "%s" does not exist.', $class)); |
201 | 201 | } |
202 | 202 | return $class; |
@@ -244,7 +244,7 @@ |
||
244 | 244 | */ |
245 | 245 | public function canBeEnabled() |
246 | 246 | { |
247 | - $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => \false])->treatTrueLike(['enabled' => \true])->treatNullLike(['enabled' => \true])->beforeNormalization()->ifArray()->then(function ($v) { |
|
247 | + $this->addDefaultsIfNotSet()->treatFalseLike(['enabled' => \false])->treatTrueLike(['enabled' => \true])->treatNullLike(['enabled' => \true])->beforeNormalization()->ifArray()->then(function($v) { |
|
248 | 248 | $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : \true; |
249 | 249 | return $v; |
250 | 250 | })->end()->children()->booleanNode('enabled')->defaultFalse(); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function setDefaultValue($value) |
90 | 90 | { |
91 | - if (!\is_array($value)) { |
|
92 | - throw new \InvalidArgumentException($this->getPath() . ': the default value of an array node has to be an array.'); |
|
91 | + if ( ! \is_array($value)) { |
|
92 | + throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); |
|
93 | 93 | } |
94 | 94 | $this->defaultValue = $value; |
95 | 95 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $normalized = []; |
207 | 207 | foreach ($value as $k => $v) { |
208 | 208 | if (null !== $this->keyAttribute && \is_array($v)) { |
209 | - if (!isset($v[$this->keyAttribute]) && \is_int($k) && !$isAssoc) { |
|
209 | + if ( ! isset($v[$this->keyAttribute]) && \is_int($k) && ! $isAssoc) { |
|
210 | 210 | $ex = new InvalidConfigurationException(\sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath())); |
211 | 211 | $ex->setPath($this->getPath()); |
212 | 212 | throw $ex; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // finalization pass will take care of removing this key entirely |
265 | 265 | return \false; |
266 | 266 | } |
267 | - if (\false === $leftSide || !$this->performDeepMerging) { |
|
267 | + if (\false === $leftSide || ! $this->performDeepMerging) { |
|
268 | 268 | return $rightSide; |
269 | 269 | } |
270 | 270 | foreach ($rightSide as $k => $v) { |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | continue; |
275 | 275 | } |
276 | 276 | // no conflict |
277 | - if (!\array_key_exists($k, $leftSide)) { |
|
278 | - if (!$this->allowNewKeys) { |
|
277 | + if ( ! \array_key_exists($k, $leftSide)) { |
|
278 | + if ( ! $this->allowNewKeys) { |
|
279 | 279 | $ex = new InvalidConfigurationException(\sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath())); |
280 | 280 | $ex->setPath($this->getPath()); |
281 | 281 | throw $ex; |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | private function writeNode(NodeInterface $node, $depth = 0, $root = \false, $namespace = null) |
44 | 44 | { |
45 | 45 | $rootName = $root ? 'config' : $node->getName(); |
46 | - $rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/' . $node->getName() : null); |
|
46 | + $rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null); |
|
47 | 47 | // xml remapping |
48 | 48 | if ($node->getParent()) { |
49 | - $remapping = \array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use($rootName) { |
|
49 | + $remapping = \array_filter($node->getParent()->getXmlRemappings(), function($mapping) use($rootName) { |
|
50 | 50 | return $rootName === $mapping[1]; |
51 | 51 | }); |
52 | 52 | if (\count($remapping)) { |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | $rootComments[] = $rootInfo; |
67 | 67 | } |
68 | 68 | if ($rootNamespace) { |
69 | - $rootComments[] = 'Namespace: ' . $rootNamespace; |
|
69 | + $rootComments[] = 'Namespace: '.$rootNamespace; |
|
70 | 70 | } |
71 | 71 | // render prototyped nodes |
72 | 72 | if ($node instanceof PrototypedArrayNode) { |
73 | 73 | $prototype = $node->getPrototype(); |
74 | 74 | $info = 'prototype'; |
75 | 75 | if (null !== $prototype->getInfo()) { |
76 | - $info .= ': ' . $prototype->getInfo(); |
|
76 | + $info .= ': '.$prototype->getInfo(); |
|
77 | 77 | } |
78 | 78 | \array_unshift($rootComments, $info); |
79 | 79 | if ($key = $node->getKeyAttribute()) { |
80 | - $rootAttributes[$key] = \str_replace('-', ' ', $rootName) . ' ' . $key; |
|
80 | + $rootAttributes[$key] = \str_replace('-', ' ', $rootName).' '.$key; |
|
81 | 81 | } |
82 | 82 | if ($prototype instanceof PrototypedArrayNode) { |
83 | 83 | $prototype->setName($key); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | // get attributes and elements |
112 | 112 | foreach ($children as $child) { |
113 | - if (!$child instanceof ArrayNode) { |
|
113 | + if ( ! $child instanceof ArrayNode) { |
|
114 | 114 | // get attributes |
115 | 115 | // metadata |
116 | 116 | $name = \str_replace('_', '-', $child->getName()); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $comments[] = $info; |
123 | 123 | } |
124 | 124 | if ($example = $child->getExample()) { |
125 | - $comments[] = 'Example: ' . $example; |
|
125 | + $comments[] = 'Example: '.$example; |
|
126 | 126 | } |
127 | 127 | if ($child->isRequired()) { |
128 | 128 | $comments[] = 'Required'; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $comments[] = \sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath())); |
132 | 132 | } |
133 | 133 | if ($child instanceof EnumNode) { |
134 | - $comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $child->getValues())); |
|
134 | + $comments[] = 'One of '.\implode('; ', \array_map('json_encode', $child->getValues())); |
|
135 | 135 | } |
136 | 136 | if (\count($comments)) { |
137 | 137 | $rootAttributeComments[$name] = \implode(";\n", $comments); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // root node comment |
153 | 153 | if (\count($rootComments)) { |
154 | 154 | foreach ($rootComments as $comment) { |
155 | - $this->writeLine('<!-- ' . $comment . ' -->', $depth); |
|
155 | + $this->writeLine('<!-- '.$comment.' -->', $depth); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | // attribute comments |
@@ -161,27 +161,27 @@ discard block |
||
161 | 161 | $commentDepth = $depth + 4 + \strlen($attrName) + 2; |
162 | 162 | $commentLines = \explode("\n", $comment); |
163 | 163 | $multiline = \count($commentLines) > 1; |
164 | - $comment = \implode(\PHP_EOL . \str_repeat(' ', $commentDepth), $commentLines); |
|
164 | + $comment = \implode(\PHP_EOL.\str_repeat(' ', $commentDepth), $commentLines); |
|
165 | 165 | if ($multiline) { |
166 | 166 | $this->writeLine('<!--', $depth); |
167 | - $this->writeLine($attrName . ': ' . $comment, $depth + 4); |
|
167 | + $this->writeLine($attrName.': '.$comment, $depth + 4); |
|
168 | 168 | $this->writeLine('-->', $depth); |
169 | 169 | } else { |
170 | - $this->writeLine('<!-- ' . $attrName . ': ' . $comment . ' -->', $depth); |
|
170 | + $this->writeLine('<!-- '.$attrName.': '.$comment.' -->', $depth); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | // render start tag + attributes |
175 | 175 | $rootIsVariablePrototype = isset($prototypeValue); |
176 | - $rootIsEmptyTag = 0 === \count($rootChildren) && !$rootIsVariablePrototype; |
|
177 | - $rootOpenTag = '<' . $rootName; |
|
176 | + $rootIsEmptyTag = 0 === \count($rootChildren) && ! $rootIsVariablePrototype; |
|
177 | + $rootOpenTag = '<'.$rootName; |
|
178 | 178 | if (1 >= ($attributesCount = \count($rootAttributes))) { |
179 | 179 | if (1 === $attributesCount) { |
180 | 180 | $rootOpenTag .= \sprintf(' %s="%s"', \current(\array_keys($rootAttributes)), $this->writeValue(\current($rootAttributes))); |
181 | 181 | } |
182 | 182 | $rootOpenTag .= $rootIsEmptyTag ? ' />' : '>'; |
183 | 183 | if ($rootIsVariablePrototype) { |
184 | - $rootOpenTag .= $prototypeValue . '</' . $rootName . '>'; |
|
184 | + $rootOpenTag .= $prototypeValue.'</'.$rootName.'>'; |
|
185 | 185 | } |
186 | 186 | $this->writeLine($rootOpenTag, $depth); |
187 | 187 | } else { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($attributesCount === $i++) { |
194 | 194 | $this->writeLine($rootIsEmptyTag ? '/>' : '>', $depth); |
195 | 195 | if ($rootIsVariablePrototype) { |
196 | - $rootOpenTag .= $prototypeValue . '</' . $rootName . '>'; |
|
196 | + $rootOpenTag .= $prototypeValue.'</'.$rootName.'>'; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | $this->writeNode($child, $depth + 4); |
205 | 205 | } |
206 | 206 | // render end tag |
207 | - if (!$rootIsEmptyTag && !$rootIsVariablePrototype) { |
|
207 | + if ( ! $rootIsEmptyTag && ! $rootIsVariablePrototype) { |
|
208 | 208 | $this->writeLine(''); |
209 | - $rootEndTag = '</' . $rootName . '>'; |
|
209 | + $rootEndTag = '</'.$rootName.'>'; |
|
210 | 210 | $this->writeLine($rootEndTag, $depth); |
211 | 211 | } |
212 | 212 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | private function writeLine($text, $indent = 0) |
220 | 220 | { |
221 | 221 | $indent = \strlen($text) + $indent; |
222 | - $format = '%' . $indent . 's'; |
|
223 | - $this->reference .= \sprintf($format, $text) . \PHP_EOL; |
|
222 | + $format = '%'.$indent.'s'; |
|
223 | + $this->reference .= \sprintf($format, $text).\PHP_EOL; |
|
224 | 224 | } |
225 | 225 | /** |
226 | 226 | * Renders the string conversion of the value. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree(); |
35 | 35 | foreach (\explode('.', $path) as $step) { |
36 | - if (!$node instanceof ArrayNode) { |
|
36 | + if ( ! $node instanceof ArrayNode) { |
|
37 | 37 | throw new \UnexpectedValueException(\sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); |
38 | 38 | } |
39 | 39 | /** @var NodeInterface[] $children */ |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | if ($node instanceof PrototypedArrayNode) { |
74 | 74 | $children = $this->getPrototypeChildren($node); |
75 | 75 | } |
76 | - if (!$children) { |
|
76 | + if ( ! $children) { |
|
77 | 77 | if ($node->hasDefaultValue() && \count($defaultArray = $node->getDefaultValue())) { |
78 | 78 | $default = ''; |
79 | - } elseif (!\is_array($example)) { |
|
79 | + } elseif ( ! \is_array($example)) { |
|
80 | 80 | $default = '[]'; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | } elseif ($node instanceof EnumNode) { |
84 | - $comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $node->getValues())); |
|
84 | + $comments[] = 'One of '.\implode('; ', \array_map('json_encode', $node->getValues())); |
|
85 | 85 | $default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~'; |
86 | 86 | } else { |
87 | 87 | $default = '~'; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (\is_array($default)) { |
91 | 91 | if (\count($defaultArray = $node->getDefaultValue())) { |
92 | 92 | $default = ''; |
93 | - } elseif (!\is_array($example)) { |
|
93 | + } elseif ( ! \is_array($example)) { |
|
94 | 94 | $default = '[]'; |
95 | 95 | } |
96 | 96 | } else { |
@@ -107,36 +107,36 @@ discard block |
||
107 | 107 | $comments[] = \sprintf('Deprecated (%s)', $node->getDeprecationMessage($node->getName(), $parentNode ? $parentNode->getPath() : $node->getPath())); |
108 | 108 | } |
109 | 109 | // example |
110 | - if ($example && !\is_array($example)) { |
|
111 | - $comments[] = 'Example: ' . $example; |
|
110 | + if ($example && ! \is_array($example)) { |
|
111 | + $comments[] = 'Example: '.$example; |
|
112 | 112 | } |
113 | - $default = '' != (string) $default ? ' ' . $default : ''; |
|
114 | - $comments = \count($comments) ? '# ' . \implode(', ', $comments) : ''; |
|
115 | - $key = $prototypedArray ? '-' : $node->getName() . ':'; |
|
113 | + $default = '' != (string) $default ? ' '.$default : ''; |
|
114 | + $comments = \count($comments) ? '# '.\implode(', ', $comments) : ''; |
|
115 | + $key = $prototypedArray ? '-' : $node->getName().':'; |
|
116 | 116 | $text = \rtrim(\sprintf('%-21s%s %s', $key, $default, $comments), ' '); |
117 | 117 | if ($info = $node->getInfo()) { |
118 | 118 | $this->writeLine(''); |
119 | 119 | // indenting multi-line info |
120 | - $info = \str_replace("\n", \sprintf("\n%" . $depth * 4 . 's# ', ' '), $info); |
|
121 | - $this->writeLine('# ' . $info, $depth * 4); |
|
120 | + $info = \str_replace("\n", \sprintf("\n%".$depth * 4.'s# ', ' '), $info); |
|
121 | + $this->writeLine('# '.$info, $depth * 4); |
|
122 | 122 | } |
123 | 123 | $this->writeLine($text, $depth * 4); |
124 | 124 | // output defaults |
125 | 125 | if ($defaultArray) { |
126 | 126 | $this->writeLine(''); |
127 | 127 | $message = \count($defaultArray) > 1 ? 'Defaults' : 'Default'; |
128 | - $this->writeLine('# ' . $message . ':', $depth * 4 + 4); |
|
128 | + $this->writeLine('# '.$message.':', $depth * 4 + 4); |
|
129 | 129 | $this->writeArray($defaultArray, $depth + 1); |
130 | 130 | } |
131 | 131 | if (\is_array($example)) { |
132 | 132 | $this->writeLine(''); |
133 | 133 | $message = \count($example) > 1 ? 'Examples' : 'Example'; |
134 | - $this->writeLine('# ' . $message . ':', $depth * 4 + 4); |
|
134 | + $this->writeLine('# '.$message.':', $depth * 4 + 4); |
|
135 | 135 | $this->writeArray($example, $depth + 1); |
136 | 136 | } |
137 | 137 | if ($children) { |
138 | 138 | foreach ($children as $childNode) { |
139 | - $this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && !$node->getKeyAttribute()); |
|
139 | + $this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && ! $node->getKeyAttribute()); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | private function writeLine($text, $indent = 0) |
150 | 150 | { |
151 | 151 | $indent = \strlen($text) + $indent; |
152 | - $format = '%' . $indent . 's'; |
|
153 | - $this->reference .= \sprintf($format, $text) . "\n"; |
|
152 | + $format = '%'.$indent.'s'; |
|
153 | + $this->reference .= \sprintf($format, $text)."\n"; |
|
154 | 154 | } |
155 | 155 | private function writeArray(array $array, $depth) |
156 | 156 | { |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $val = $value; |
163 | 163 | } |
164 | 164 | if ($isIndexed) { |
165 | - $this->writeLine('- ' . $val, $depth * 4); |
|
165 | + $this->writeLine('- '.$val, $depth * 4); |
|
166 | 166 | } else { |
167 | - $this->writeLine(\sprintf('%-20s %s', $key . ':', $val), $depth * 4); |
|
167 | + $this->writeLine(\sprintf('%-20s %s', $key.':', $val), $depth * 4); |
|
168 | 168 | } |
169 | 169 | if (\is_array($value)) { |
170 | 170 | $this->writeArray($value, $depth + 1); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $prototype = $node->getPrototype(); |
180 | 180 | $key = $node->getKeyAttribute(); |
181 | 181 | // Do not expand prototype if it isn't an array node nor uses attribute as key |
182 | - if (!$key && !$prototype instanceof ArrayNode) { |
|
182 | + if ( ! $key && ! $prototype instanceof ArrayNode) { |
|
183 | 183 | return $node->getChildren(); |
184 | 184 | } |
185 | 185 | if ($prototype instanceof ArrayNode) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | $info = 'Prototype'; |
199 | 199 | if (null !== $prototype->getInfo()) { |
200 | - $info .= ': ' . $prototype->getInfo(); |
|
200 | + $info .= ': '.$prototype->getInfo(); |
|
201 | 201 | } |
202 | 202 | $keyNode->setInfo($info); |
203 | 203 | return [$key => $keyNode]; |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function preNormalize($value) |
46 | 46 | { |
47 | - if (!$this->normalizeKeys || !\is_array($value)) { |
|
47 | + if ( ! $this->normalizeKeys || ! \is_array($value)) { |
|
48 | 48 | return $value; |
49 | 49 | } |
50 | 50 | $normalized = []; |
51 | 51 | foreach ($value as $k => $v) { |
52 | - if (\false !== \strpos($k, '-') && \false === \strpos($k, '_') && !\array_key_exists($normalizedKey = \str_replace('-', '_', $k), $value)) { |
|
52 | + if (\false !== \strpos($k, '-') && \false === \strpos($k, '_') && ! \array_key_exists($normalizedKey = \str_replace('-', '_', $k), $value)) { |
|
53 | 53 | $normalized[$normalizedKey] = $v; |
54 | 54 | } else { |
55 | 55 | $normalized[$k] = $v; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getDefaultValue() |
153 | 153 | { |
154 | - if (!$this->hasDefaultValue()) { |
|
154 | + if ( ! $this->hasDefaultValue()) { |
|
155 | 155 | throw new \RuntimeException(\sprintf('The node at path "%s" has no default value.', $this->getPath())); |
156 | 156 | } |
157 | 157 | $defaults = []; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function addChild(NodeInterface $node) |
172 | 172 | { |
173 | 173 | $name = $node->getName(); |
174 | - if (!\strlen($name)) { |
|
174 | + if ( ! \strlen($name)) { |
|
175 | 175 | throw new \InvalidArgumentException('Child nodes must be named.'); |
176 | 176 | } |
177 | 177 | if (isset($this->children[$name])) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | throw new UnsetKeyException(\sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), \json_encode($value))); |
196 | 196 | } |
197 | 197 | foreach ($this->children as $name => $child) { |
198 | - if (!\array_key_exists($name, $value)) { |
|
198 | + if ( ! \array_key_exists($name, $value)) { |
|
199 | 199 | if ($child->isRequired()) { |
200 | 200 | $ex = new InvalidConfigurationException(\sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath())); |
201 | 201 | $ex->setPath($this->getPath()); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | protected function validateType($value) |
228 | 228 | { |
229 | - if (!\is_array($value) && (!$this->allowFalse || \false !== $value)) { |
|
229 | + if ( ! \is_array($value) && ( ! $this->allowFalse || \false !== $value)) { |
|
230 | 230 | $ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), \gettype($value))); |
231 | 231 | if ($hint = $this->getInfo()) { |
232 | 232 | $ex->addHint($hint); |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | } catch (UnsetKeyException $e) { |
259 | 259 | } |
260 | 260 | unset($value[$name]); |
261 | - } elseif (!$this->removeExtraKeys) { |
|
261 | + } elseif ( ! $this->removeExtraKeys) { |
|
262 | 262 | $normalized[$name] = $val; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | // if extra fields are present, throw exception |
266 | - if (\count($value) && !$this->ignoreExtraKeys) { |
|
266 | + if (\count($value) && ! $this->ignoreExtraKeys) { |
|
267 | 267 | $ex = new InvalidConfigurationException(\sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', \implode(', ', \array_keys($value)), $this->getPath())); |
268 | 268 | $ex->setPath($this->getPath()); |
269 | 269 | throw $ex; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | protected function remapXml($value) |
281 | 281 | { |
282 | 282 | foreach ($this->xmlRemappings as list($singular, $plural)) { |
283 | - if (!isset($value[$singular])) { |
|
283 | + if ( ! isset($value[$singular])) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 | $value[$plural] = Processor::normalizeConfig($value, $singular, $plural); |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | // finalization pass will take care of removing this key entirely |
307 | 307 | return \false; |
308 | 308 | } |
309 | - if (\false === $leftSide || !$this->performDeepMerging) { |
|
309 | + if (\false === $leftSide || ! $this->performDeepMerging) { |
|
310 | 310 | return $rightSide; |
311 | 311 | } |
312 | 312 | foreach ($rightSide as $k => $v) { |
313 | 313 | // no conflict |
314 | - if (!\array_key_exists($k, $leftSide)) { |
|
315 | - if (!$this->allowNewKeys) { |
|
314 | + if ( ! \array_key_exists($k, $leftSide)) { |
|
315 | + if ( ! $this->allowNewKeys) { |
|
316 | 316 | $ex = new InvalidConfigurationException(\sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); |
317 | 317 | $ex->setPath($this->getPath()); |
318 | 318 | throw $ex; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $leftSide[$k] = $v; |
321 | 321 | continue; |
322 | 322 | } |
323 | - if (!isset($this->children[$k])) { |
|
323 | + if ( ! isset($this->children[$k])) { |
|
324 | 324 | throw new \RuntimeException('merge() expects a normalized config array.'); |
325 | 325 | } |
326 | 326 | $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | protected function validateType($value) |
32 | 32 | { |
33 | - if (!\is_scalar($value) && null !== $value) { |
|
33 | + if ( ! \is_scalar($value) && null !== $value) { |
|
34 | 34 | $ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected scalar, but got %s.', $this->getPath(), \gettype($value))); |
35 | 35 | if ($hint = $this->getInfo()) { |
36 | 36 | $ex->addHint($hint); |