@@ -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 | * |
| 76 | 76 | * @return string[] |
| 77 | 77 | */ |
| 78 | - static function (Options $options, $value): array { |
|
| 78 | + static function(Options $options, $value): array { |
|
| 79 | 79 | return Normalize::shortcodes($value); |
| 80 | 80 | } |
| 81 | 81 | ); |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $resolver->define('locale') |
| 87 | 87 | ->allowedTypes('string') |
| 88 | - ->allowedValues(static function (string $value): bool { |
|
| 89 | - return ! ! Normalize::locale($value); |
|
| 88 | + ->allowedValues(static function(string $value): bool { |
|
| 89 | + return !!Normalize::locale($value); |
|
| 90 | 90 | }) |
| 91 | 91 | ->default('en') |
| 92 | - ->normalize(static function (Options $options, string $value): string { |
|
| 92 | + ->normalize(static function(Options $options, string $value): string { |
|
| 93 | 93 | return Normalize::locale($value); |
| 94 | 94 | }); |
| 95 | 95 | } |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $resolver->define('native') |
| 100 | 100 | ->allowedTypes('bool') |
| 101 | - ->default(static function (Options $options): bool { |
|
| 101 | + ->default(static function(Options $options): bool { |
|
| 102 | 102 | return \in_array($options['locale'], DatasetInterface::NON_LATIN_LOCALES, true); |
| 103 | 103 | }) |
| 104 | - ->normalize(static function (Options $options, bool $value) { |
|
| 104 | + ->normalize(static function(Options $options, bool $value) { |
|
| 105 | 105 | return $value && \in_array($options['locale'], DatasetInterface::NON_LATIN_LOCALES, true); |
| 106 | 106 | }); |
| 107 | 107 | } |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | foreach ((array) $values as $value) { |
| 132 | 132 | \assert(\is_string($value)); |
| 133 | - if (! \in_array($value, ShortcodeInterface::SUPPORTED_PRESETS, true)) { |
|
| 133 | + if (!\in_array($value, ShortcodeInterface::SUPPORTED_PRESETS, true)) { |
|
| 134 | 134 | throw new InvalidOptionsException(\sprintf( |
| 135 | 135 | 'The option "preset" with value "%s" is invalid. Accepted values are: %s.', |
| 136 | 136 | $value, |
| 137 | - \implode(', ', \array_map(static function ($s) { |
|
| 137 | + \implode(', ', \array_map(static function($s) { |
|
| 138 | 138 | return \sprintf('"%s"', $s); |
| 139 | 139 | }, ShortcodeInterface::SUPPORTED_PRESETS)) |
| 140 | 140 | )); |
@@ -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(AbstractToken):bool $callback */ |
| 27 | - $callback = static function (AbstractToken $token): bool { |
|
| 27 | + $callback = static function(AbstractToken $token): bool { |
|
| 28 | 28 | return $token instanceof static; |
| 29 | 29 | }; |
| 30 | 30 | } |
@@ -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 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function castValue($value) |
| 78 | 78 | { |
| 79 | 79 | // Immediately return if nullable or empty. |
| 80 | - if (($this->nullable && $value === null) || ($this->emptyNullable && ! $value)) { |
|
| 80 | + if (($this->nullable && $value === null) || ($this->emptyNullable && !$value)) { |
|
| 81 | 81 | return null; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -124,6 +124,6 @@ discard block |
||
| 124 | 124 | Normalize::setType($value, $this->type); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - return $this->emptyNullable && ! $value ? null : $value; |
|
| 127 | + return $this->emptyNullable && !$value ? null : $value; |
|
| 128 | 128 | } |
| 129 | 129 | } |
@@ -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() |