@@ -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 | |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function render(Node $node) |
| 46 | 46 | { |
| 47 | - if (! ($node instanceof Image)) { |
|
| 47 | + if (!($node instanceof Image)) { |
|
| 48 | 48 | throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); |
|
| 51 | + $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links'); |
|
| 52 | 52 | if ($forbidUnsafeLinks && self::isLinkPotentiallyUnsafe($node->getUrl())) { |
| 53 | 53 | $node->attributes->set('src', ''); |
| 54 | 54 | } |
@@ -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 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | public static function normalizePresets($presets): ?array |
| 166 | 166 | { |
| 167 | 167 | // Map preset aliases to their correct value. |
| 168 | - return \array_unique(\array_filter(\array_map(static function (string $preset): string { |
|
| 168 | + return \array_unique(\array_filter(\array_map(static function(string $preset): string { |
|
| 169 | 169 | if (isset(EmojibaseShortcodeInterface::PRESET_ALIASES[$preset])) { |
| 170 | 170 | return EmojibaseShortcodeInterface::PRESET_ALIASES[$preset]; |
| 171 | 171 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | { |
| 220 | 220 | $this->assertUninitialized('Failed to add renderer.'); |
| 221 | 221 | |
| 222 | - if (! isset($this->renderersByClass[$nodeClass])) { |
|
| 222 | + if (!isset($this->renderersByClass[$nodeClass])) { |
|
| 223 | 223 | /** @var PrioritizedList<NodeRendererInterface> $renderers */ |
| 224 | 224 | $renderers = new PrioritizedList(); |
| 225 | 225 | |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | /** @var ListenerData $listenerData */ |
| 312 | 312 | foreach ($this->listenerData as $listenerData) { |
| 313 | - if (! \is_a($event, $listenerData->getEvent())) { |
|
| 313 | + if (!\is_a($event, $listenerData->getEvent())) { |
|
| 314 | 314 | continue; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - yield function (object $event) use ($listenerData): void { |
|
| 317 | + yield function(object $event) use ($listenerData): void { |
|
| 318 | 318 | $this->initialize(); |
| 319 | 319 | |
| 320 | 320 | \call_user_func($listenerData->getListener(), $event); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | while (\class_exists($parent = (string) ($parent ?? $nodeClass)) && ($parent = \get_parent_class($parent))) { |
| 338 | - if (! isset($this->renderersByClass[$parent])) { |
|
| 338 | + if (!isset($this->renderersByClass[$parent])) { |
|
| 339 | 339 | continue; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $structuredConversionTypes = Expect::structure(\array_combine( |
| 380 | 380 | EmojiConverterInterface::TYPES, |
| 381 | - \array_map(static function (string $conversionType) use ($conversionTypes, $default): Schema { |
|
| 381 | + \array_map(static function(string $conversionType) use ($conversionTypes, $default): Schema { |
|
| 382 | 382 | return Expect::anyOf(false, ...$conversionTypes)->default($default)->nullable(); |
| 383 | 383 | }, EmojiConverterInterface::TYPES) |
| 384 | 384 | ))->castTo('array'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $walker = $e->getDocument()->walker(); |
| 44 | 44 | while ($event = $walker->next()) { |
| 45 | 45 | $node = $event->getNode(); |
| 46 | - if (! ($node instanceof Emoji) || $node->hexcode === null) { |
|
| 46 | + if (!($node instanceof Emoji) || $node->hexcode === null) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if ($inline && $size === null) { |
| 85 | 85 | $image->attributes->set('style', 'width: 1em; height: 1em; vertical-align: middle;'); |
| 86 | 86 | } elseif ($inline && $size !== null) { |
| 87 | - if (! \is_string($size)) { |
|
| 87 | + if (!\is_string($size)) { |
|
| 88 | 88 | $size .= 'em'; |
| 89 | 89 | } |
| 90 | 90 | |