@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | \preg_match(self::REGEX, $type, $matches, PREG_UNMATCHED_AS_NULL); |
| 37 | 37 | $this->callback = (string) ($matches['callback'] ?? null); |
| 38 | 38 | $this->customType = (string) ($matches['customType'] ?? null); |
| 39 | - $this->emptyNullable = ! ! ($matches['emptyNullable'] ?? false); |
|
| 40 | - $this->iterable = ! ! ($matches['iterable'] ?? false); |
|
| 41 | - $this->nullable = ! ! ($this->emptyNullable || ($matches['nullable'] ?? false)); |
|
| 39 | + $this->emptyNullable = !!($matches['emptyNullable'] ?? false); |
|
| 40 | + $this->iterable = !!($matches['iterable'] ?? false); |
|
| 41 | + $this->nullable = !!($this->emptyNullable || ($matches['nullable'] ?? false)); |
|
| 42 | 42 | $this->type = (string) ($matches['type'] ?? 'mixed'); |
| 43 | 43 | $this->isPhpType = \in_array($this->type, self::TYPES, true); |
| 44 | 44 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function castValue($value) |
| 80 | 80 | { |
| 81 | 81 | // Immediately return if nullable or empty. |
| 82 | - if (($this->nullable && $value === null) || ($this->emptyNullable && ! $value)) { |
|
| 82 | + if (($this->nullable && $value === null) || ($this->emptyNullable && !$value)) { |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | Normalize::setType($value, $this->type); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - return $this->emptyNullable && ! $value |
|
| 129 | + return $this->emptyNullable && !$value |
|
| 130 | 130 | ? null |
| 131 | 131 | : $value; |
| 132 | 132 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $emoji = new Emoji($emoji); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (! $emoji instanceof Emoji) { |
|
| 78 | + if (!$emoji instanceof Emoji) { |
|
| 79 | 79 | throw new \RuntimeException(\sprintf('Passed array item must be an instance of %s.', Emoji::class)); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public static function setType(&$value, string $type): bool |
| 158 | 158 | { |
| 159 | 159 | // Immediately return if not a valid type. |
| 160 | - if (! isset(self::TYPE_METHODS[$type])) { |
|
| 160 | + if (!isset(self::TYPE_METHODS[$type])) { |
|
| 161 | 161 | $value = null; |
| 162 | 162 | |
| 163 | 163 | return false; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | /** @var string|string[] $shortcodes */ |
| 184 | 184 | foreach (\func_get_args() as $shortcodes) { |
| 185 | - $normalized = \array_merge($normalized, \array_map(static function ($shortcode) { |
|
| 185 | + $normalized = \array_merge($normalized, \array_map(static function($shortcode) { |
|
| 186 | 186 | return \preg_replace('/[^a-z0-9-]/', '-', \strtolower(\trim((string) $shortcode, ':(){}[]'))); |
| 187 | 187 | }, (array) $shortcodes)); |
| 188 | 188 | } |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public static function unarchive(string $filename): Dataset |
| 58 | 58 | { |
| 59 | - if (! \file_exists($filename)) { |
|
| 59 | + if (!\file_exists($filename)) { |
|
| 60 | 60 | throw new FileNotFoundException($filename); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if ( |
| 64 | - ! ($contents = \file_get_contents($filename)) || |
|
| 65 | - ! ($decoded = \gzdecode($contents)) |
|
| 64 | + !($contents = \file_get_contents($filename)) || |
|
| 65 | + !($decoded = \gzdecode($contents)) |
|
| 66 | 66 | ) { |
| 67 | 67 | throw new UnarchiveException($filename); |
| 68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | throw new MalformedArchiveException($filename, $throwable); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! $dataset instanceof Dataset) { |
|
| 77 | + if (!$dataset instanceof Dataset) { |
|
| 78 | 78 | throw new MalformedArchiveException($filename); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | public function getSkin(int $tone = EmojibaseSkinsInterface::LIGHT_SKIN): ?self |
| 129 | 129 | { |
| 130 | 130 | /** @var ?static $skin */ |
| 131 | - $skin = \current($this->skins->filter(static function (Emoji $emoji) use ($tone) { |
|
| 131 | + $skin = \current($this->skins->filter(static function(Emoji $emoji) use ($tone) { |
|
| 132 | 132 | return \in_array($tone, (array) $emoji->tone, true); |
| 133 | 133 | })->getArrayCopy()) ?: null; |
| 134 | 134 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | public function indexBy(string $index = 'hexcode'): Dataset |
| 47 | 47 | { |
| 48 | - if (! isset($this->indices[$index])) { |
|
| 48 | + if (!isset($this->indices[$index])) { |
|
| 49 | 49 | $this->indices[$index] = new self($this, $index); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function render(Node $node) |
| 28 | 28 | { |
| 29 | - if (! ($node instanceof Text)) { |
|
| 29 | + if (!($node instanceof Text)) { |
|
| 30 | 30 | throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function render(Node $node) |
| 28 | 28 | { |
| 29 | - if (! ($node instanceof Emoji)) { |
|
| 29 | + if (!($node instanceof Emoji)) { |
|
| 30 | 30 | throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // order to keep '__' to stay '__' we first replace it with a different |
| 86 | 86 | // placeholder after checking that it is not defined as a filter. |
| 87 | 87 | $doubleUnderscoreReplacements = 0; |
| 88 | - if (! isset($filter['__'])) { |
|
| 88 | + if (!isset($filter['__'])) { |
|
| 89 | 89 | $identifier = \str_replace('__', '##', $identifier, $doubleUnderscoreReplacements); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $classes = \array_merge($existing, $classes); |
| 120 | 120 | |
| 121 | 121 | // Split any strings that may have multiple classes in them. |
| 122 | - $classes = \array_map(static function (string $class) { |
|
| 122 | + $classes = \array_map(static function(string $class) { |
|
| 123 | 123 | return \explode(' ', $class); |
| 124 | 124 | }, $classes); |
| 125 | 125 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return string[] |
| 135 | 135 | */ |
| 136 | - static function (array $a, array $v): array { |
|
| 136 | + static function(array $a, array $v): array { |
|
| 137 | 137 | return \array_merge($a, $v); |
| 138 | 138 | }, |
| 139 | 139 | [] |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getAttribute(string $key) |
| 173 | 173 | { |
| 174 | - if (! isset($this->attributes[$key])) { |
|
| 174 | + if (!isset($this->attributes[$key])) { |
|
| 175 | 175 | return null; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | if ($key === 'class') { |
| 187 | 187 | $this->attributes['class'] = ''; |
| 188 | - if (! \is_array($value)) { |
|
| 188 | + if (!\is_array($value)) { |
|
| 189 | 189 | $value = [$value]; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function getContents(bool $asString = true) |
| 209 | 209 | { |
| 210 | - if (! $asString) { |
|
| 210 | + if (!$asString) { |
|
| 211 | 211 | return $this->contents; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | */ |
| 139 | 139 | public function offsetUnset($offset): void |
| 140 | 140 | { |
| 141 | - if (! \array_key_exists($offset, $this->elements)) { |
|
| 141 | + if (!\array_key_exists($offset, $this->elements)) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |