@@ -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': |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function __toString() |
| 52 | 52 | { |
| 53 | - return 'glob.' . $this->prefix . $this->pattern . (int) $this->recursive; |
|
| 53 | + return 'glob.'.$this->prefix.$this->pattern.(int) $this->recursive; |
|
| 54 | 54 | } |
| 55 | 55 | /** |
| 56 | 56 | * {@inheritdoc} |
@@ -82,18 +82,18 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | public function getIterator() |
| 84 | 84 | { |
| 85 | - if (!\file_exists($this->prefix) || !$this->recursive && '' === $this->pattern) { |
|
| 85 | + if ( ! \file_exists($this->prefix) || ! $this->recursive && '' === $this->pattern) { |
|
| 86 | 86 | return; |
| 87 | 87 | } |
| 88 | 88 | if (0 !== \strpos($this->prefix, 'phar://') && \false === \strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || \false === \strpos($this->pattern, '{'))) { |
| 89 | - $paths = \glob($this->prefix . $this->pattern, \GLOB_NOSORT | (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0)); |
|
| 89 | + $paths = \glob($this->prefix.$this->pattern, \GLOB_NOSORT | (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0)); |
|
| 90 | 90 | \sort($paths); |
| 91 | 91 | foreach ($paths as $path) { |
| 92 | 92 | if ($this->recursive && \is_dir($path)) { |
| 93 | - $files = \iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function (\SplFileInfo $file) { |
|
| 93 | + $files = \iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function(\SplFileInfo $file) { |
|
| 94 | 94 | return '.' !== $file->getBasename()[0]; |
| 95 | 95 | }), \RecursiveIteratorIterator::LEAVES_ONLY)); |
| 96 | - \uasort($files, function (\SplFileInfo $a, \SplFileInfo $b) { |
|
| 96 | + \uasort($files, function(\SplFileInfo $a, \SplFileInfo $b) { |
|
| 97 | 97 | return (string) $a > (string) $b ? 1 : -1; |
| 98 | 98 | }); |
| 99 | 99 | foreach ($files as $path => $info) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | - if (!\class_exists(Finder::class)) { |
|
| 110 | + if ( ! \class_exists(Finder::class)) { |
|
| 111 | 111 | throw new \LogicException(\sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.', $this->pattern)); |
| 112 | 112 | } |
| 113 | 113 | $finder = new Finder(); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $hash = \hash_init('md5'); |
| 128 | 128 | foreach ($this->getIterator() as $path => $info) { |
| 129 | - \hash_update($hash, $path . "\n"); |
|
| 129 | + \hash_update($hash, $path."\n"); |
|
| 130 | 130 | } |
| 131 | 131 | return \hash_final($hash); |
| 132 | 132 | } |
@@ -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 | } |