@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | protected function finalizeValue($value) |
73 | 73 | { |
74 | - if (!$this->allowEmptyValue && $this->isValueEmpty($value)) { |
|
74 | + if ( ! $this->allowEmptyValue && $this->isValueEmpty($value)) { |
|
75 | 75 | $ex = new InvalidConfigurationException(\sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), \json_encode($value))); |
76 | 76 | if ($hint = $this->getInfo()) { |
77 | 77 | $ex->addHint($hint); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $path = $this->name; |
225 | 225 | if (null !== $this->parent) { |
226 | - $path = $this->parent->getPath() . '.' . $path; |
|
226 | + $path = $this->parent->getPath().'.'.$path; |
|
227 | 227 | } |
228 | 228 | return $path; |
229 | 229 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public final function merge($leftSide, $rightSide) |
234 | 234 | { |
235 | - if (!$this->allowOverwrite) { |
|
235 | + if ( ! $this->allowOverwrite) { |
|
236 | 236 | throw new ForbiddenOverwriteException(\sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); |
237 | 237 | } |
238 | 238 | $this->validateType($leftSide); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } catch (Exception $e) { |
296 | 296 | throw $e; |
297 | 297 | } catch (\Exception $e) { |
298 | - throw new InvalidConfigurationException(\sprintf('Invalid configuration for path "%s": ', $this->getPath()) . $e->getMessage(), $e->getCode(), $e); |
|
298 | + throw new InvalidConfigurationException(\sprintf('Invalid configuration for path "%s": ', $this->getPath()).$e->getMessage(), $e->getCode(), $e); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | return $value; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | protected function finalizeValue($value) |
36 | 36 | { |
37 | 37 | $value = parent::finalizeValue($value); |
38 | - if (!\in_array($value, $this->values, \true)) { |
|
38 | + if ( ! \in_array($value, $this->values, \true)) { |
|
39 | 39 | $ex = new InvalidConfigurationException(\sprintf('The value %s is not allowed for path "%s". Permissible values: %s', \json_encode($value), $this->getPath(), \implode(', ', \array_map('json_encode', $this->values)))); |
40 | 40 | $ex->setPath($this->getPath()); |
41 | 41 | throw $ex; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | protected function validateType($value) |
25 | 25 | { |
26 | - if (!\is_int($value)) { |
|
26 | + if ( ! \is_int($value)) { |
|
27 | 27 | $ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected int, but got %s.', $this->getPath(), \gettype($value))); |
28 | 28 | if ($hint = $this->getInfo()) { |
29 | 29 | $ex->addHint($hint); |
@@ -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; |
@@ -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(); |
@@ -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 | /** |
@@ -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; |
@@ -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 | /** |