@@ -14,21 +14,21 @@ discard block |
||
14 | 14 | if (\PHP_VERSION_ID >= 70300) { |
15 | 15 | return; |
16 | 16 | } |
17 | -if (!\function_exists('is_countable')) { |
|
17 | +if ( ! \function_exists('is_countable')) { |
|
18 | 18 | function is_countable($value) |
19 | 19 | { |
20 | 20 | return \is_array($value) || $value instanceof \Countable || $value instanceof \ResourceBundle || $value instanceof \SimpleXmlElement; |
21 | 21 | } |
22 | 22 | } |
23 | -if (!\function_exists('hrtime')) { |
|
24 | - require_once __DIR__ . '/Php73.php'; |
|
23 | +if ( ! \function_exists('hrtime')) { |
|
24 | + require_once __DIR__.'/Php73.php'; |
|
25 | 25 | p\Php73::$startAt = (int) \microtime(\true); |
26 | 26 | function hrtime($as_number = \false) |
27 | 27 | { |
28 | 28 | return p\Php73::hrtime($as_number); |
29 | 29 | } |
30 | 30 | } |
31 | -if (!\function_exists('array_key_first')) { |
|
31 | +if ( ! \function_exists('array_key_first')) { |
|
32 | 32 | function array_key_first(array $array) |
33 | 33 | { |
34 | 34 | foreach ($array as $key => $value) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
39 | -if (!\function_exists('array_key_last')) { |
|
39 | +if ( ! \function_exists('array_key_last')) { |
|
40 | 40 | function array_key_last(array $array) |
41 | 41 | { |
42 | 42 | return \key(\array_slice($array, -1, 1, \true)); |
@@ -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; |
@@ -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): |
@@ -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)); |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function isFresh() |
60 | 60 | { |
61 | - if (!\is_file($this->file)) { |
|
61 | + if ( ! \is_file($this->file)) { |
|
62 | 62 | return \false; |
63 | 63 | } |
64 | - if ($this->resourceCheckers instanceof \Traversable && !$this->resourceCheckers instanceof \Countable) { |
|
64 | + if ($this->resourceCheckers instanceof \Traversable && ! $this->resourceCheckers instanceof \Countable) { |
|
65 | 65 | $this->resourceCheckers = \iterator_to_array($this->resourceCheckers); |
66 | 66 | } |
67 | - if (!\count($this->resourceCheckers)) { |
|
67 | + if ( ! \count($this->resourceCheckers)) { |
|
68 | 68 | return \true; |
69 | 69 | // shortcut - if we don't have any checkers we don't need to bother with the meta file at all |
70 | 70 | } |
71 | 71 | $metadata = $this->getMetaFile(); |
72 | - if (!\is_file($metadata)) { |
|
72 | + if ( ! \is_file($metadata)) { |
|
73 | 73 | return \false; |
74 | 74 | } |
75 | 75 | $meta = $this->safelyUnserialize($metadata); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | foreach ($meta as $resource) { |
81 | 81 | /* @var ResourceInterface $resource */ |
82 | 82 | foreach ($this->resourceCheckers as $checker) { |
83 | - if (!$checker->supports($resource)) { |
|
83 | + if ( ! $checker->supports($resource)) { |
|
84 | 84 | continue; |
85 | 85 | // next checker |
86 | 86 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function getMetaFile() |
135 | 135 | { |
136 | - return $this->file . '.meta'; |
|
136 | + return $this->file.'.meta'; |
|
137 | 137 | } |
138 | 138 | private function safelyUnserialize($file) |
139 | 139 | { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $content = \file_get_contents($file); |
143 | 143 | $signalingException = new \UnexpectedValueException(); |
144 | 144 | $prevUnserializeHandler = \ini_set('unserialize_callback_func', ''); |
145 | - $prevErrorHandler = \set_error_handler(function ($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
145 | + $prevErrorHandler = \set_error_handler(function($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
146 | 146 | if (__FILE__ === $file) { |
147 | 147 | throw $signalingException; |
148 | 148 | } |
@@ -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; |
@@ -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(); |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | public function isFresh($timestamp) |
59 | 59 | { |
60 | 60 | $loaded = \class_exists($this->resource, \false) || \interface_exists($this->resource, \false) || \trait_exists($this->resource, \false); |
61 | - if (null !== ($exists =& self::$existsCache[$this->resource])) { |
|
61 | + if (null !== ($exists = & self::$existsCache[$this->resource])) { |
|
62 | 62 | if ($loaded) { |
63 | 63 | $exists = [\true, null]; |
64 | - } elseif (0 >= $timestamp && !$exists[0] && null !== $exists[1]) { |
|
64 | + } elseif (0 >= $timestamp && ! $exists[0] && null !== $exists[1]) { |
|
65 | 65 | throw new \ReflectionException($exists[1]); |
66 | 66 | } |
67 | 67 | } elseif ([\false, null] === ($exists = [$loaded, null])) { |
68 | - if (!self::$autoloadLevel++) { |
|
69 | - \spl_autoload_register(__CLASS__ . '::throwOnRequiredClass'); |
|
68 | + if ( ! self::$autoloadLevel++) { |
|
69 | + \spl_autoload_register(__CLASS__.'::throwOnRequiredClass'); |
|
70 | 70 | } |
71 | 71 | $autoloadedClass = self::$autoloadedClass; |
72 | 72 | self::$autoloadedClass = \ltrim($this->resource, '\\'); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | throw $e; |
87 | 87 | } finally { |
88 | 88 | self::$autoloadedClass = $autoloadedClass; |
89 | - if (!--self::$autoloadLevel) { |
|
90 | - \spl_autoload_unregister(__CLASS__ . '::throwOnRequiredClass'); |
|
89 | + if ( !--self::$autoloadLevel) { |
|
90 | + \spl_autoload_unregister(__CLASS__.'::throwOnRequiredClass'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
94 | 94 | if (null === $this->exists) { |
95 | 95 | $this->exists = $exists; |
96 | 96 | } |
97 | - return $this->exists[0] xor !$exists[0]; |
|
97 | + return $this->exists[0] xor ! $exists[0]; |
|
98 | 98 | } |
99 | 99 | /** |
100 | 100 | * @internal |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } else { |
169 | 169 | throw $e; |
170 | 170 | } |
171 | - if (isset($callerFrame['function']) && !isset($callerFrame['class'])) { |
|
171 | + if (isset($callerFrame['function']) && ! isset($callerFrame['class'])) { |
|
172 | 172 | switch ($callerFrame['function']) { |
173 | 173 | case 'get_class_methods': |
174 | 174 | case 'get_class_vars': |
@@ -64,8 +64,8 @@ |
||
64 | 64 | if ('C' === $class[0] && 0 === \strpos($class, 'ComposerAutoloaderInit')) { |
65 | 65 | $r = new \ReflectionClass($class); |
66 | 66 | $v = \dirname(\dirname($r->getFileName())); |
67 | - if (\file_exists($v . '/composer/installed.json')) { |
|
68 | - self::$runtimeVendors[$v] = @\filemtime($v . '/composer/installed.json'); |
|
67 | + if (\file_exists($v.'/composer/installed.json')) { |
|
68 | + self::$runtimeVendors[$v] = @\filemtime($v.'/composer/installed.json'); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |