@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct(string $filename, ?string $message = null, ?Throwable $previous = null) |
12 | 12 | { |
13 | - if (! isset($message)) { |
|
13 | + if (!isset($message)) { |
|
14 | 14 | $message = \sprintf('Empty or corrupted archive: %s.', $filename); |
15 | 15 | } |
16 | 16 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function offsetExists($index) // phpcs:ignore |
49 | 49 | { |
50 | - if (! \array_key_exists($index, $this->getArrayCopy())) { |
|
50 | + if (!\array_key_exists($index, $this->getArrayCopy())) { |
|
51 | 51 | throw new \OutOfRangeException(\sprintf('Unknown property: %s', $index)); |
52 | 52 | } |
53 | 53 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | $method = 'get' . \ucfirst(\substr($key, 0, 3) === 'get' ? \substr($key, 3) : $key); |
69 | - if (! \method_exists($this, $method)) { |
|
69 | + if (!\method_exists($this, $method)) { |
|
70 | 70 | throw new \OutOfRangeException(\sprintf('Unknown property: %s', $key)); |
71 | 71 | } |
72 | 72 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | { |
57 | 57 | $tokens = []; |
58 | 58 | while (true) { |
59 | - if (! $this->lexer->lookahead) { |
|
59 | + if (!$this->lexer->lookahead) { |
|
60 | 60 | break; |
61 | 61 | } |
62 | 62 |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | |
28 | 28 | public static function unarchive(string $filename): self |
29 | 29 | { |
30 | - if (! \file_exists($filename)) { |
|
30 | + if (!\file_exists($filename)) { |
|
31 | 31 | throw new FileNotFoundException($filename); |
32 | 32 | } |
33 | 33 | |
34 | 34 | if ( |
35 | - ! ($contents = \file_get_contents($filename)) || |
|
36 | - ! ($decoded = \gzdecode($contents)) |
|
35 | + !($contents = \file_get_contents($filename)) || |
|
36 | + !($decoded = \gzdecode($contents)) |
|
37 | 37 | ) { |
38 | 38 | throw new UnarchiveException($filename); |
39 | 39 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new MalformedArchiveException($filename, $throwable); |
45 | 45 | } |
46 | 46 | |
47 | - if (! $dataset instanceof Dataset) { |
|
47 | + if (!$dataset instanceof Dataset) { |
|
48 | 48 | throw new MalformedArchiveException($filename); |
49 | 49 | } |
50 | 50 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public function indexBy(string $index = 'hexcode'): Dataset |
76 | 76 | { |
77 | - if (! isset($this->indices[$index])) { |
|
77 | + if (!isset($this->indices[$index])) { |
|
78 | 78 | $this->indices[$index] = new self($this, $index); |
79 | 79 | } |
80 | 80 |
@@ -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 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public static function setType(&$value, string $type): bool |
142 | 142 | { |
143 | 143 | // Immediately return if not a valid type. |
144 | - if (! isset(self::TYPE_METHODS[$type])) { |
|
144 | + if (!isset(self::TYPE_METHODS[$type])) { |
|
145 | 145 | $value = null; |
146 | 146 | |
147 | 147 | return false; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | /** @var string|string[] $shortcodes */ |
168 | 168 | foreach (\func_get_args() as $shortcodes) { |
169 | - $normalized = \array_merge($normalized, \array_map(static function ($shortcode) { |
|
169 | + $normalized = \array_merge($normalized, \array_map(static function($shortcode) { |
|
170 | 170 | return \preg_replace('/[^a-z0-9-]/', '-', \strtolower(\trim((string) $shortcode, ':(){}[]'))); |
171 | 171 | }, (array) $shortcodes)); |
172 | 172 | } |
@@ -100,7 +100,7 @@ |
||
100 | 100 | /** @var ?static $skin */ |
101 | 101 | $skin = \current( |
102 | 102 | $this->skins->filter( |
103 | - static function (Emoji $emoji) use ($tone) { |
|
103 | + static function(Emoji $emoji) use ($tone) { |
|
104 | 104 | return \in_array($tone, (array) $emoji->tone, true); |
105 | 105 | } |
106 | 106 | )->getArrayCopy() |
@@ -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 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | protected function defineExclude(OptionsResolver $resolver): void |
71 | 71 | { |
72 | - $resolver->setDefault('exclude', static function (OptionsResolver $resolver): void { |
|
72 | + $resolver->setDefault('exclude', static function(OptionsResolver $resolver): void { |
|
73 | 73 | $resolver->define('shortcodes') |
74 | 74 | ->allowedTypes('string', 'string[]') |
75 | 75 | ->default([]) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string[] |
81 | 81 | */ |
82 | - static function (Options $options, $value): array { |
|
82 | + static function(Options $options, $value): array { |
|
83 | 83 | return Normalize::shortcodes($value); |
84 | 84 | } |
85 | 85 | ); |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | { |
91 | 91 | $resolver->define('locale') |
92 | 92 | ->allowedTypes('string') |
93 | - ->allowedValues(static function (string $value): bool { |
|
94 | - return ! ! Normalize::locale($value); |
|
93 | + ->allowedValues(static function(string $value): bool { |
|
94 | + return !!Normalize::locale($value); |
|
95 | 95 | }) |
96 | 96 | ->default('en') |
97 | - ->normalize(static function (Options $options, string $value): string { |
|
97 | + ->normalize(static function(Options $options, string $value): string { |
|
98 | 98 | return Normalize::locale($value); |
99 | 99 | }); |
100 | 100 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | { |
104 | 104 | $resolver->define('native') |
105 | 105 | ->allowedTypes('bool') |
106 | - ->default(static function (Options $options): bool { |
|
106 | + ->default(static function(Options $options): bool { |
|
107 | 107 | return \in_array($options['locale'], DatasetInterface::NON_LATIN_LOCALES, true); |
108 | 108 | }) |
109 | - ->normalize(static function (Options $options, bool $value) { |
|
109 | + ->normalize(static function(Options $options, bool $value) { |
|
110 | 110 | return $value && \in_array($options['locale'], DatasetInterface::NON_LATIN_LOCALES, true); |
111 | 111 | }); |
112 | 112 | } |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | { |
136 | 136 | foreach ((array) $values as $value) { |
137 | 137 | \assert(\is_string($value)); |
138 | - if (! \in_array($value, ShortcodeInterface::SUPPORTED_PRESETS, true)) { |
|
138 | + if (!\in_array($value, ShortcodeInterface::SUPPORTED_PRESETS, true)) { |
|
139 | 139 | throw new InvalidOptionsException(\sprintf( |
140 | 140 | 'The option "preset" with value "%s" is invalid. Accepted values are: %s.', |
141 | 141 | $value, |
142 | - \implode(', ', \array_map(static function ($s) { |
|
142 | + \implode(', ', \array_map(static function($s) { |
|
143 | 143 | return \sprintf('"%s"', $s); |
144 | 144 | }, ShortcodeInterface::SUPPORTED_PRESETS)) |
145 | 145 | )); |
@@ -22,9 +22,9 @@ |
||
22 | 22 | */ |
23 | 23 | public static function filter(array $tokens, ?callable $callback = null): array |
24 | 24 | { |
25 | - if (! $callback) { |
|
25 | + if (!$callback) { |
|
26 | 26 | /** @var callable(TokenInterface):bool $callback */ |
27 | - $callback = static function (TokenInterface $token): bool { |
|
27 | + $callback = static function(TokenInterface $token): bool { |
|
28 | 28 | return $token instanceof static; |
29 | 29 | }; |
30 | 30 | } |