@@ -31,11 +31,11 @@ |
||
31 | 31 | */ |
32 | 32 | public function cache($file, $callback) |
33 | 33 | { |
34 | - if (!\is_callable($callback)) { |
|
34 | + if ( ! \is_callable($callback)) { |
|
35 | 35 | throw new \InvalidArgumentException(\sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); |
36 | 36 | } |
37 | 37 | $cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers); |
38 | - if (!$cache->isFresh()) { |
|
38 | + if ( ! $cache->isFresh()) { |
|
39 | 39 | \call_user_func($callback, $cache); |
40 | 40 | } |
41 | 41 | return $cache; |
@@ -34,11 +34,11 @@ |
||
34 | 34 | */ |
35 | 35 | public function cache($file, $callback) |
36 | 36 | { |
37 | - if (!\is_callable($callback)) { |
|
37 | + if ( ! \is_callable($callback)) { |
|
38 | 38 | throw new \InvalidArgumentException(\sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); |
39 | 39 | } |
40 | 40 | $cache = new ConfigCache($file, $this->debug); |
41 | - if (!$cache->isFresh()) { |
|
41 | + if ( ! $cache->isFresh()) { |
|
42 | 42 | \call_user_func($callback, $cache); |
43 | 43 | } |
44 | 44 | return $cache; |
@@ -32,11 +32,11 @@ |
||
32 | 32 | // Trim the trailing period of the previous message. We only want 1 period remove so no rtrim... |
33 | 33 | if ('.' === \substr($previous->getMessage(), -1)) { |
34 | 34 | $trimmedMessage = \substr($previous->getMessage(), 0, -1); |
35 | - $message .= \sprintf('%s', $trimmedMessage) . ' in '; |
|
35 | + $message .= \sprintf('%s', $trimmedMessage).' in '; |
|
36 | 36 | } else { |
37 | - $message .= \sprintf('%s', $previous->getMessage()) . ' in '; |
|
37 | + $message .= \sprintf('%s', $previous->getMessage()).' in '; |
|
38 | 38 | } |
39 | - $message .= $resource . ' '; |
|
39 | + $message .= $resource.' '; |
|
40 | 40 | // show tweaked trace to complete the human readable sentence |
41 | 41 | if (null === $sourceResource) { |
42 | 42 | $message .= \sprintf('(which is loaded in resource "%s")', $this->varToString($resource)); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if (\is_string($resource) && \strlen($resource) !== ($i = \strcspn($resource, '*?{['))) { |
68 | 68 | $ret = []; |
69 | 69 | $isSubpath = 0 !== $i && \false !== \strpos(\substr($resource, 0, $i), '/'); |
70 | - foreach ($this->glob($resource, \false, $_, $ignoreErrors || !$isSubpath) as $path => $info) { |
|
70 | + foreach ($this->glob($resource, \false, $_, $ignoreErrors || ! $isSubpath) as $path => $info) { |
|
71 | 71 | if (null !== ($res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource))) { |
72 | 72 | $ret[] = $res; |
73 | 73 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $pattern = ''; |
90 | 90 | } elseif (0 === $i || \false === \strpos(\substr($pattern, 0, $i), '/')) { |
91 | 91 | $prefix = '.'; |
92 | - $pattern = '/' . $pattern; |
|
92 | + $pattern = '/'.$pattern; |
|
93 | 93 | } else { |
94 | 94 | $prefix = \dirname(\substr($pattern, 0, 1 + $i)); |
95 | 95 | $pattern = \substr($pattern, \strlen($prefix)); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $prefix = $this->locator->locate($prefix, $this->currentDir, \true); |
99 | 99 | } catch (FileLocatorFileNotFoundException $e) { |
100 | - if (!$ignoreErrors) { |
|
100 | + if ( ! $ignoreErrors) { |
|
101 | 101 | throw $e; |
102 | 102 | } |
103 | 103 | $resource = []; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } catch (FileLoaderImportCircularReferenceException $e) { |
140 | 140 | throw $e; |
141 | 141 | } catch (\Exception $e) { |
142 | - if (!$ignoreErrors) { |
|
142 | + if ( ! $ignoreErrors) { |
|
143 | 143 | // prevent embedded imports from nesting multiple exceptions |
144 | 144 | if ($e instanceof FileLoaderLoadException) { |
145 | 145 | throw $e; |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public function isFresh() |
49 | 49 | { |
50 | - if (!$this->debug && \is_file($this->getPath())) { |
|
50 | + if ( ! $this->debug && \is_file($this->getPath())) { |
|
51 | 51 | return \true; |
52 | 52 | } |
53 | 53 | return parent::isFresh(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function parse($content, $schemaOrCallable = null) |
45 | 45 | { |
46 | - if (!\extension_loaded('dom')) { |
|
46 | + if ( ! \extension_loaded('dom')) { |
|
47 | 47 | throw new \RuntimeException('Extension DOM is required.'); |
48 | 48 | } |
49 | 49 | $internalErrors = \libxml_use_internal_errors(\true); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | \libxml_clear_errors(); |
54 | 54 | $dom = new \DOMDocument(); |
55 | 55 | $dom->validateOnParse = \true; |
56 | - if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { |
|
56 | + if ( ! $dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { |
|
57 | 57 | if (\LIBXML_VERSION < 20900) { |
58 | 58 | \libxml_disable_entity_loader($disableEntities); |
59 | 59 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | } catch (\Exception $e) { |
80 | 80 | $valid = \false; |
81 | 81 | } |
82 | - } elseif (!\is_array($schemaOrCallable) && \is_file((string) $schemaOrCallable)) { |
|
82 | + } elseif ( ! \is_array($schemaOrCallable) && \is_file((string) $schemaOrCallable)) { |
|
83 | 83 | $schemaSource = \file_get_contents((string) $schemaOrCallable); |
84 | 84 | $valid = @$dom->schemaValidateSource($schemaSource); |
85 | 85 | } else { |
86 | 86 | \libxml_use_internal_errors($internalErrors); |
87 | 87 | throw new XmlParsingException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); |
88 | 88 | } |
89 | - if (!$valid) { |
|
89 | + if ( ! $valid) { |
|
90 | 90 | $messages = static::getXmlErrors($internalErrors); |
91 | 91 | if (empty($messages)) { |
92 | 92 | throw new InvalidXmlException('The XML is not valid.', 0, $e); |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public static function loadFile($file, $schemaOrCallable = null) |
114 | 114 | { |
115 | - if (!\is_file($file)) { |
|
115 | + if ( ! \is_file($file)) { |
|
116 | 116 | throw new \InvalidArgumentException(\sprintf('Resource "%s" is not a file.', $file)); |
117 | 117 | } |
118 | - if (!\is_readable($file)) { |
|
118 | + if ( ! \is_readable($file)) { |
|
119 | 119 | throw new \InvalidArgumentException(\sprintf('File "%s" is not readable.', $file)); |
120 | 120 | } |
121 | 121 | $content = @\file_get_contents($file); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $empty = \true; |
155 | 155 | $config = []; |
156 | 156 | foreach ($element->attributes as $name => $node) { |
157 | - if ($checkPrefix && !\in_array((string) $node->prefix, ['', $prefix], \true)) { |
|
157 | + if ($checkPrefix && ! \in_array((string) $node->prefix, ['', $prefix], \true)) { |
|
158 | 158 | continue; |
159 | 159 | } |
160 | 160 | $config[$name] = static::phpize($node->value); |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | } |
170 | 170 | } elseif ($checkPrefix && $prefix != (string) $node->prefix) { |
171 | 171 | continue; |
172 | - } elseif (!$node instanceof \DOMComment) { |
|
172 | + } elseif ( ! $node instanceof \DOMComment) { |
|
173 | 173 | $value = static::convertDomElementToArray($node, $checkPrefix); |
174 | 174 | $key = $node->localName; |
175 | 175 | if (isset($config[$key])) { |
176 | - if (!\is_array($config[$key]) || !\is_int(\key($config[$key]))) { |
|
176 | + if ( ! \is_array($config[$key]) || ! \is_int(\key($config[$key]))) { |
|
177 | 177 | $config[$key] = [$config[$key]]; |
178 | 178 | } |
179 | 179 | $config[$key][] = $value; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $config = $value; |
192 | 192 | } |
193 | 193 | } |
194 | - return !$empty ? $config : null; |
|
194 | + return ! $empty ? $config : null; |
|
195 | 195 | } |
196 | 196 | /** |
197 | 197 | * Converts an xml value to a PHP type. |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | return \true; |
220 | 220 | case 'false' === $lowercaseValue: |
221 | 221 | return \false; |
222 | - case isset($value[1]) && '0b' == $value[0] . $value[1] && \preg_match('/^0b[01]*$/', $value): |
|
222 | + case isset($value[1]) && '0b' == $value[0].$value[1] && \preg_match('/^0b[01]*$/', $value): |
|
223 | 223 | return \bindec($value); |
224 | 224 | case \is_numeric($value): |
225 | - return '0x' === $value[0] . $value[1] ? \hexdec($value) : (float) $value; |
|
225 | + return '0x' === $value[0].$value[1] ? \hexdec($value) : (float) $value; |
|
226 | 226 | case \preg_match('/^0x[0-9a-f]++$/i', $value): |
227 | 227 | return \hexdec($value); |
228 | 228 | case \preg_match('/^[+-]?[0-9]+(\\.[0-9]+)?$/', $value): |
@@ -72,13 +72,13 @@ |
||
72 | 72 | public static function normalizeConfig($config, $key, $plural = null) |
73 | 73 | { |
74 | 74 | if (null === $plural) { |
75 | - $plural = $key . 's'; |
|
75 | + $plural = $key.'s'; |
|
76 | 76 | } |
77 | 77 | if (isset($config[$plural])) { |
78 | 78 | return $config[$plural]; |
79 | 79 | } |
80 | 80 | if (isset($config[$key])) { |
81 | - if (\is_string($config[$key]) || !\is_int(\key($config[$key]))) { |
|
81 | + if (\is_string($config[$key]) || ! \is_int(\key($config[$key]))) { |
|
82 | 82 | // only one |
83 | 83 | return [$config[$key]]; |
84 | 84 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | if (\is_int($value)) { |
28 | 28 | $value = (float) $value; |
29 | 29 | } |
30 | - if (!\is_float($value)) { |
|
30 | + if ( ! \is_float($value)) { |
|
31 | 31 | $ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected float, but got %s.', $this->getPath(), \gettype($value))); |
32 | 32 | if ($hint = $this->getInfo()) { |
33 | 33 | $ex->addHint($hint); |
@@ -35,11 +35,11 @@ |
||
35 | 35 | */ |
36 | 36 | public function addHint($hint) |
37 | 37 | { |
38 | - if (!$this->containsHints) { |
|
39 | - $this->message .= "\nHint: " . $hint; |
|
38 | + if ( ! $this->containsHints) { |
|
39 | + $this->message .= "\nHint: ".$hint; |
|
40 | 40 | $this->containsHints = \true; |
41 | 41 | } else { |
42 | - $this->message .= ', ' . $hint; |
|
42 | + $this->message .= ', '.$hint; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |