Passed
Push — latest ( c5296c...5fe1f6 )
by Mark
02:28
created
src/Configuration.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
                  *
88 88
                  * @return string[]
89 89
                  */
90
-                static function (Options $options, $value): array {
91
-                    if (! $value) {
90
+                static function(Options $options, $value): array {
91
+                    if (!$value) {
92 92
                         return $value;
93 93
                     }
94 94
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 
99 99
         $resolver->define('locale')
100 100
             ->allowedTypes('string')
101
-            ->allowedValues(static function (string $value): bool {
102
-                return ! ! static::normalizeLocale($value);
101
+            ->allowedValues(static function(string $value): bool {
102
+                return !!static::normalizeLocale($value);
103 103
             })
104 104
             ->default('en')
105
-            ->normalize(static function (Options $options, string $value): string {
105
+            ->normalize(static function(Options $options, string $value): string {
106 106
                 return static::normalizeLocale($value);
107 107
             });
108 108
 
109 109
         $resolver->define('native')
110 110
             ->allowedTypes('bool')
111
-            ->default(static function (Options $options): bool {
111
+            ->default(static function(Options $options): bool {
112 112
                 return \in_array($options['locale'], EmojibaseInterface::NON_LATIN_LOCALES, true);
113 113
             })
114
-            ->normalize(static function (Options $options, bool $value) {
114
+            ->normalize(static function(Options $options, bool $value) {
115 115
                 return $value && \in_array($options['locale'], EmojibaseInterface::NON_LATIN_LOCALES, true);
116 116
             });
117 117
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
                 /**
127 127
                  * @param mixed $value
128 128
                  */
129
-                static function ($value): bool {
129
+                static function($value): bool {
130 130
                     foreach ((array) $value as $v) {
131
-                        if (! \in_array($v, EmojibaseShortcodeInterface::SUPPORTED_PRESETS, true)) {
131
+                        if (!\in_array($v, EmojibaseShortcodeInterface::SUPPORTED_PRESETS, true)) {
132 132
                             throw new InvalidOptionsException(\sprintf(
133 133
                                 'The option "preset" with value "%s" is invalid. Accepted values are: %s.',
134 134
                                 $v,
135
-                                \implode(', ', \array_map(static function ($s) {
135
+                                \implode(', ', \array_map(static function($s) {
136 136
                                     return \sprintf('"%s"', $s);
137 137
                                 }, EmojibaseShortcodeInterface::SUPPORTED_PRESETS))
138 138
                             ));
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                  *
150 150
                  * @return string[]
151 151
                  */
152
-                static function (Options $options, $value): array {
152
+                static function(Options $options, $value): array {
153 153
                     // Presets.
154 154
                     $presets = [];
155 155
                     foreach ((array) $value as $preset) {
Please login to merge, or discard this patch.
src/Token/AbstractToken.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
      */
22 22
     public static function filter(array $tokens, ?callable $callback = null): array
23 23
     {
24
-        if (! $callback) {
25
-            $callback = static function (AbstractToken $token): bool {
24
+        if (!$callback) {
25
+            $callback = static function(AbstractToken $token): bool {
26 26
                 return $token instanceof static;
27 27
             };
28 28
         }
Please login to merge, or discard this patch.
src/Parser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
         $texts        = $this->dataset->indexBy('text');
49 49
 
50 50
         while (true) {
51
-            if (! $this->lookahead) {
51
+            if (!$this->lookahead) {
52 52
                 break;
53 53
             }
54 54
 
Please login to merge, or discard this patch.
scripts/build.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 const BUILD_DIRECTORY          = BASE_DIRECTORY . '/build';
15 15
 const EMOJIBASE_DATA_DIRECTORY = BASE_DIRECTORY . '/node_modules/emojibase-data';
16 16
 
17
-if (! is_dir(EMOJIBASE_DATA_DIRECTORY) || ! interface_exists(EmojibaseInterface::class)) {
17
+if (!is_dir(EMOJIBASE_DATA_DIRECTORY) || !interface_exists(EmojibaseInterface::class)) {
18 18
     throw new \RuntimeException('You must first run `npm install && npm run build` to build the datasets.');
19 19
 }
20 20
 
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
         $data = array_column($json, null, 'hexcode');
32 32
     }
33 33
 
34
-    if (! isset($data)) {
34
+    if (!isset($data)) {
35 35
         throw new \RuntimeException(sprintf('Unable to load JSON: %s', $file));
36 36
     }
37 37
 
38 38
     // Merge any skin variations into the main list (faster performance).
39 39
     foreach ($data as $hexcode => &$item) {
40
-        if (! isset($item['shortcodes'])) {
40
+        if (!isset($item['shortcodes'])) {
41 41
             $item['shortcodes'] = [];
42 42
         }
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             $item['shortcodes'] = Normalize::shortcodes($item['shortcodes'], $shortcodes[$hexcode]);
48 48
         }
49 49
 
50
-        if (! isset($item['skins']) || ! count($item['skins'])) {
50
+        if (!isset($item['skins']) || !count($item['skins'])) {
51 51
             continue;
52 52
         }
53 53
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     foreach (EmojibaseShortcodeInterface::PRESETS as $preset) {
91 91
         // Skip presets that don't exist.
92 92
         $file = sprintf('%s/%s/shortcodes/%s.json', EMOJIBASE_DATA_DIRECTORY, $locale, $preset);
93
-        if (! file_exists($file) || ! ($c = file_get_contents($file)) || ! ($shortcodes = json_decode($c, true))) {
93
+        if (!file_exists($file) || !($c = file_get_contents($file)) || !($shortcodes = json_decode($c, true))) {
94 94
             continue;
95 95
         }
96 96
 
Please login to merge, or discard this patch.
src/Emoji.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
     {
94 94
         return \current(
95 95
             $this->skins->filter(
96
-                static function (Emoji $emoji) use ($tone) {
96
+                static function(Emoji $emoji) use ($tone) {
97 97
                     return \in_array($tone, (array) $emoji->tone, true);
98 98
                 }
99 99
             )->getArrayCopy()
Please login to merge, or discard this patch.
src/Normalize.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         }
55 55
 
56 56
         // Immediately return if already empty or null.
57
-        if (($emptyNullable && ! $value) || ($nullable && $value === null)) {
57
+        if (($emptyNullable && !$value) || ($nullable && $value === null)) {
58 58
             return null;
59 59
         }
60 60
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
         // Determine if PHP type.
68 68
         $phpType = \in_array($type, self::TYPES, true);
69 69
 
70
-        if (! $phpType && \class_exists($type)) {
70
+        if (!$phpType && \class_exists($type)) {
71 71
             $value = new $type($value);
72 72
             if ($iterable && \is_iterable($value)) {
73 73
                 return $value;
74 74
             }
75 75
         }
76 76
 
77
-        if (! $phpType && \is_callable($type)) {
77
+        if (!$phpType && \is_callable($type)) {
78 78
             $value = $type($value);
79 79
             if ($iterable && \is_iterable($value)) {
80 80
                 return $value;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public static function setType($value, string $type, bool $emptyNullable = false)
103 103
     {
104
-        if ($emptyNullable && ! $value) {
104
+        if ($emptyNullable && !$value) {
105 105
             return null;
106 106
         }
107 107
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 break;
139 139
         }
140 140
 
141
-        return $emptyNullable && ! $value ? null : $value;
141
+        return $emptyNullable && !$value ? null : $value;
142 142
     }
143 143
 
144 144
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $normalized = \array_values(\array_unique(\array_merge(
154 154
                 $normalized,
155 155
                 \array_map(
156
-                    static function ($shortcode) {
156
+                    static function($shortcode) {
157 157
                         return \preg_replace('/[^a-z0-9-]/', '-', \strtolower(\trim($shortcode, ':(){}[]')));
158 158
                     },
159 159
                     (array) $shortcodes
Please login to merge, or discard this patch.
src/Dataset.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                 $emoji = new Emoji($emoji);
35 35
             }
36 36
 
37
-            if (! $emoji instanceof Emoji) {
37
+            if (!$emoji instanceof Emoji) {
38 38
                 throw new \RuntimeException(\sprintf('Passed array item must be an instance of %s.', Emoji::class));
39 39
             }
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 foreach ($emoji->skins as &$skin) {
49 49
                     $skinKeys = \array_filter((array) $skin->$index);
50 50
                     foreach ($skinKeys as $sk) {
51
-                        if (! isset($dataset[$sk])) {
51
+                        if (!isset($dataset[$sk])) {
52 52
                             $dataset[$sk] = &$skin;
53 53
                         }
54 54
                     }
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 
62 62
     public static function unarchive(string $filename): self
63 63
     {
64
-        if (! \file_exists($filename)) {
64
+        if (!\file_exists($filename)) {
65 65
             throw new FileNotFoundException($filename);
66 66
         }
67 67
 
68 68
         if (
69
-            ! ($contents = \file_get_contents($filename)) ||
70
-            ! ($decoded = \gzdecode($contents))
69
+            !($contents = \file_get_contents($filename)) ||
70
+            !($decoded = \gzdecode($contents))
71 71
         ) {
72 72
             throw new UnarchiveException($filename);
73 73
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             throw new MalformedArchiveException($filename, $throwable);
79 79
         }
80 80
 
81
-        if (! $dataset instanceof Dataset) {
81
+        if (!$dataset instanceof Dataset) {
82 82
             throw new MalformedArchiveException($filename);
83 83
         }
84 84
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     public function indexBy(string $index = 'hexcode'): Dataset
110 110
     {
111
-        if (! isset($this->indices[$index])) {
111
+        if (!isset($this->indices[$index])) {
112 112
             $this->indices[$index] = new self($this, $index);
113 113
         }
114 114
 
Please login to merge, or discard this patch.
src/Exception/UnarchiveException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/ImmutableArrayIterator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.