@@ -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 |
@@ -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 |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | \implode( |
193 | 193 | ', ', |
194 | 194 | \array_map( |
195 | - static function ($s) { |
|
195 | + static function($s) { |
|
196 | 196 | return \sprintf('"%s"', $s); |
197 | 197 | }, |
198 | 198 | EmojibaseShortcodeInterface::SUPPORTED_PRESETS |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | { |
252 | 252 | $this->assertUninitialized('Failed to add renderer.'); |
253 | 253 | |
254 | - if (! isset($this->renderersByClass[$nodeClass])) { |
|
254 | + if (!isset($this->renderersByClass[$nodeClass])) { |
|
255 | 255 | /** @var PrioritizedList<NodeRendererInterface> $renderers */ |
256 | 256 | $renderers = new PrioritizedList(); |
257 | 257 | |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | |
347 | 347 | /** @var ListenerData $listenerData */ |
348 | 348 | foreach ($this->listenerData as $listenerData) { |
349 | - if (! \is_a($event, $listenerData->getEvent())) { |
|
349 | + if (!\is_a($event, $listenerData->getEvent())) { |
|
350 | 350 | continue; |
351 | 351 | } |
352 | 352 | |
353 | - yield function (object $event) use ($listenerData): void { |
|
353 | + yield function(object $event) use ($listenerData): void { |
|
354 | 354 | $this->initialize(); |
355 | 355 | |
356 | 356 | \call_user_func($listenerData->getListener(), $event); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | while (\class_exists($parent = (string) ($parent ?? $nodeClass)) && ($parent = \get_parent_class($parent))) { |
383 | - if (! isset($this->renderersByClass[$parent])) { |
|
383 | + if (!isset($this->renderersByClass[$parent])) { |
|
384 | 384 | continue; |
385 | 385 | } |
386 | 386 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | $structuredConversionTypes = Expect::structure(\array_combine( |
425 | 425 | EmojiConverterInterface::TYPES, |
426 | - \array_map(static function (string $conversionType) use ($conversionTypes, $default): Schema { |
|
426 | + \array_map(static function(string $conversionType) use ($conversionTypes, $default): Schema { |
|
427 | 427 | return Expect::anyOf(false, ...$conversionTypes)->default($default)->nullable(); |
428 | 428 | }, EmojiConverterInterface::TYPES) |
429 | 429 | ))->castTo('array'); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function configureConversionTypes(string &$default, array &$conversionTypes, Data $rawConfig): void |
23 | 23 | { |
24 | 24 | // Set the default conversion type to Twemoji. |
25 | - if (! $rawConfig->has('twemoji.defaultConversionType') || $rawConfig->get('twemoji.defaultConversionType') === true) { |
|
25 | + if (!$rawConfig->has('twemoji.defaultConversionType') || $rawConfig->get('twemoji.defaultConversionType') === true) { |
|
26 | 26 | $default = TwemojiProcessor::CONVERSION_TYPE; |
27 | 27 | } |
28 | 28 |
@@ -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 |