@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | \implode( |
186 | 186 | ', ', |
187 | 187 | \array_map( |
188 | - static function ($s) { |
|
188 | + static function($s) { |
|
189 | 189 | return \sprintf('"%s"', $s); |
190 | 190 | }, |
191 | 191 | EmojibaseShortcodeInterface::SUPPORTED_PRESETS |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | ): EnvironmentBuilderInterface { |
261 | 261 | $this->assertUninitialized('Failed to add renderer.'); |
262 | 262 | |
263 | - if (! isset($this->renderersByClass[$nodeClass])) { |
|
263 | + if (!isset($this->renderersByClass[$nodeClass])) { |
|
264 | 264 | /** @var PrioritizedList<NodeRendererInterface> $renderers */ |
265 | 265 | $renderers = new PrioritizedList(); |
266 | 266 | |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | |
355 | 355 | /** @var ListenerData $listenerData */ |
356 | 356 | foreach ($this->listenerData as $listenerData) { |
357 | - if (! \is_a($event, $listenerData->getEvent())) { |
|
357 | + if (!\is_a($event, $listenerData->getEvent())) { |
|
358 | 358 | continue; |
359 | 359 | } |
360 | 360 | |
361 | - yield function (object $event) use ($listenerData): void { |
|
361 | + yield function(object $event) use ($listenerData): void { |
|
362 | 362 | $this->initialize(); |
363 | 363 | |
364 | 364 | \call_user_func($listenerData->getListener(), $event); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | while (\class_exists($parent = (string) ($parent ?? $nodeClass)) && ($parent = \get_parent_class($parent))) { |
393 | - if (! isset($this->renderersByClass[$parent])) { |
|
393 | + if (!isset($this->renderersByClass[$parent])) { |
|
394 | 394 | continue; |
395 | 395 | } |
396 | 396 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getAttribute(string $key) |
74 | 74 | { |
75 | - if (! isset($this->attributes[$key])) { |
|
75 | + if (!isset($this->attributes[$key])) { |
|
76 | 76 | return null; |
77 | 77 | } |
78 | 78 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function getContents(bool $asString = true) |
100 | 100 | { |
101 | - if (! $asString) { |
|
101 | + if (!$asString) { |
|
102 | 102 | return $this->contents; |
103 | 103 | } |
104 | 104 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function indexBy(string $index = 'hexcode'): Dataset |
43 | 43 | { |
44 | - if (! isset($this->indices[$index])) { |
|
44 | + if (!isset($this->indices[$index])) { |
|
45 | 45 | $this->indices[$index] = new self($this, $index); |
46 | 46 | } |
47 | 47 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $key = \current(Normalize::shortcodes($key)); |
59 | 59 | } |
60 | 60 | |
61 | - if (! $key) { |
|
61 | + if (!$key) { |
|
62 | 62 | return null; |
63 | 63 | } |
64 | 64 |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | public static function unarchive(string $filename): Dataset |
59 | 59 | { |
60 | - if (! \file_exists($filename)) { |
|
60 | + if (!\file_exists($filename)) { |
|
61 | 61 | throw new FileNotFoundException($filename); |
62 | 62 | } |
63 | 63 | |
64 | 64 | if ( |
65 | - ! ($contents = \file_get_contents($filename)) || |
|
66 | - ! ($decoded = \gzdecode($contents)) |
|
65 | + !($contents = \file_get_contents($filename)) || |
|
66 | + !($decoded = \gzdecode($contents)) |
|
67 | 67 | ) { |
68 | 68 | throw new UnarchiveException($filename); |
69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | throw new MalformedArchiveException($filename, $throwable); |
76 | 76 | } |
77 | 77 | |
78 | - if (! $dataset instanceof Dataset) { |
|
78 | + if (!$dataset instanceof Dataset) { |
|
79 | 79 | throw new MalformedArchiveException($filename); |
80 | 80 | } |
81 | 81 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | throw InvalidConfigurationException::forConfigOption('preset', $preset, \sprintf( |
131 | 131 | 'Accepted values are: %s.', |
132 | 132 | \implode(', ', \array_map( |
133 | - static function ($s) { |
|
133 | + static function($s) { |
|
134 | 134 | return \sprintf('"%s"', $s); |
135 | 135 | }, |
136 | 136 | EmojibaseShortcodeInterface::SUPPORTED_PRESETS |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->lexer->moveNext(); |
70 | 70 | |
71 | 71 | while (true) { |
72 | - if (! $this->lexer->lookahead) { |
|
72 | + if (!$this->lexer->lookahead) { |
|
73 | 73 | break; |
74 | 74 | } |
75 | 75 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | protected function parseEmoji(int $type, string $value) |
91 | 91 | { |
92 | 92 | // Immediately return if not a valid type. |
93 | - if (! isset(self::T_DATASETS[$type])) { |
|
93 | + if (!isset(self::T_DATASETS[$type])) { |
|
94 | 94 | return null; |
95 | 95 | } |
96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $emoji = $dataset->offsetGet($value); |
99 | 99 | |
100 | 100 | // Return if not an emoji. |
101 | - if (! $emoji) { |
|
101 | + if (!$emoji) { |
|
102 | 102 | return null; |
103 | 103 | } |
104 | 104 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function __construct() |
17 | 17 | { |
18 | - if (! \class_exists('\Astrotomic\Twemoji\Twemoji')) { |
|
18 | + if (!\class_exists('\Astrotomic\Twemoji\Twemoji')) { |
|
19 | 19 | throw new ExtensionRequiredLibraryException('astrotomic/php-twemoji', $this); |
20 | 20 | } |
21 | 21 | } |
@@ -40,14 +40,14 @@ |
||
40 | 40 | $walker = $e->getDocument()->walker(); |
41 | 41 | while ($event = $walker->next()) { |
42 | 42 | $node = $event->getNode(); |
43 | - if (! ($node instanceof AbstractEmoji)) { |
|
43 | + if (!($node instanceof AbstractEmoji)) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | $emoji = $node->getEmoji(); |
48 | 48 | $unicode = $emoji->getUnicode(); |
49 | 49 | |
50 | - if (! $unicode) { |
|
50 | + if (!$unicode) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 |
@@ -40,12 +40,12 @@ |
||
40 | 40 | // Ensure tokens are set to the correct stringable type. |
41 | 41 | $walker = $e->getDocument()->walker(); |
42 | 42 | while ($event = $walker->next()) { |
43 | - if (! $event->isEntering()) { |
|
43 | + if (!$event->isEntering()) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | $emoji = $event->getNode(); |
48 | - if (! ($emoji instanceof AbstractEmoji)) { |
|
48 | + if (!($emoji instanceof AbstractEmoji)) { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 |
@@ -43,14 +43,14 @@ |
||
43 | 43 | */ |
44 | 44 | public function render(Node $node, ChildNodeRendererInterface $childRenderer) |
45 | 45 | { |
46 | - if (! ($node instanceof Image)) { |
|
46 | + if (!($node instanceof Image)) { |
|
47 | 47 | throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node)); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** @var array<string, mixed> $attrs */ |
51 | 51 | $attrs = $node->data->get('attributes'); |
52 | 52 | |
53 | - $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); |
|
53 | + $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links'); |
|
54 | 54 | if ($forbidUnsafeLinks && self::isLinkPotentiallyUnsafe($node->getUrl())) { |
55 | 55 | $attrs['src'] = ''; |
56 | 56 | } else { |