Passed
Push — master ( 12b0d8...b5cc44 )
by Maurício
13:18 queued 15s
created
tests/Cache/ApcuCacheTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $msgid = 'Column';
128 128
 
129 129
         $lock = 'mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY;
130
-        apcu_entry($lock, static function () {
130
+        apcu_entry($lock, static function() {
131 131
             sleep(1);
132 132
 
133 133
             return 1;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $method->setAccessible(true);
203 203
 
204 204
         $key = 'mo_' . $locale . '.' . $domain . '.' . $msgid;
205
-        apcu_entry($key, static function () use ($expected): string {
205
+        apcu_entry($key, static function() use ($expected): string {
206 206
             sleep(1);
207 207
 
208 208
             return $expected;
Please login to merge, or discard this patch.
tests/TranslatorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
         $translator->getTranslations();
92 92
     }
93 93
 
94
-    private function getTranslator(string|null $filename): Translator
94
+    private function getTranslator(string | null $filename): Translator
95 95
     {
96 96
         return new Translator(new InMemoryCache(new MoParser($filename)));
97 97
     }
Please login to merge, or discard this patch.
src/MoParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public int $error = self::ERROR_NONE;
48 48
 
49
-    public function __construct(private readonly string|null $filename = null)
49
+    public function __construct(private readonly string | null $filename = null)
50 50
     {
51 51
     }
52 52
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             return;
60 60
         }
61 61
 
62
-        if (! is_readable($this->filename)) {
62
+        if (!is_readable($this->filename)) {
63 63
             $this->error = self::ERROR_DOES_NOT_EXIST;
64 64
 
65 65
             return;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $translations = $stream->readint($unpack, 16);
86 86
 
87 87
             /* get original and translations tables */
88
-            $totalTimesTwo = (int) ($total * 2);// Fix for issue #36 on ARM
88
+            $totalTimesTwo = (int) ($total * 2); // Fix for issue #36 on ARM
89 89
             $tableOriginals = $stream->readintarray($unpack, $originals, $totalTimesTwo);
90 90
             $tableTranslations = $stream->readintarray($unpack, $translations, $totalTimesTwo);
91 91
 
Please login to merge, or discard this patch.
src/Cache/ApcuCache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         private bool $reloadOnMiss = true,
33 33
         private string $prefix = 'mo_',
34 34
     ) {
35
-        if (! (function_exists('apcu_enabled') && apcu_enabled())) {
35
+        if (!(function_exists('apcu_enabled') && apcu_enabled())) {
36 36
             throw new CacheException('ACPu extension must be installed and enabled');
37 37
         }
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             return $msgstr;
47 47
         }
48 48
 
49
-        if (! $this->reloadOnMiss) {
49
+        if (!$this->reloadOnMiss) {
50 50
             return $msgid;
51 51
         }
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     private function reloadOnMiss(string $msgid): string
57 57
     {
58 58
         // store original if translation is not present
59
-        $cached = apcu_entry($this->getKey($msgid), static function () use ($msgid) {
59
+        $cached = apcu_entry($this->getKey($msgid), static function() use ($msgid) {
60 60
             return $msgid;
61 61
         }, $this->ttl);
62 62
         // if another process has updated cache, return early
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     /** @inheritDoc */
86 86
     public function setAll(array $translations): void
87 87
     {
88
-        $keys = array_map(function (string $msgid): string {
88
+        $keys = array_map(function(string $msgid): string {
89 89
             return $this->getKey($msgid);
90 90
         }, array_keys($translations));
91 91
         $translations = array_combine($keys, $translations);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         // Try to prevent cache slam if multiple processes are trying to load translations. There is still a race
105 105
         // between the exists check and creating the entry, but at least it's small
106 106
         $key = $this->getKey(self::LOADED_KEY);
107
-        $loaded = apcu_exists($key) || apcu_entry($key, static function (): int {
107
+        $loaded = apcu_exists($key) || apcu_entry($key, static function(): int {
108 108
             return 0;
109 109
         }, $this->ttl);
110 110
         if ($loaded) {
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 // phpcs:disable Squiz.Functions.GlobalFunction
30 30
 
31
-if (! function_exists('_setlocale')) {
31
+if (!function_exists('_setlocale')) {
32 32
     /**
33 33
      * Sets a requested locale.
34 34
      *
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     }
44 44
 }
45 45
 
46
-if (! function_exists('_bindtextdomain')) {
46
+if (!function_exists('_bindtextdomain')) {
47 47
     /**
48 48
      * Sets the path for a domain.
49 49
      *
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-if (! function_exists('_bind_textdomain_codeset')) {
59
+if (!function_exists('_bind_textdomain_codeset')) {
60 60
     /**
61 61
      * Dummy compatibility function, MoTranslator assumes
62 62
      * everything is using same character set on input and
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 }
75 75
 
76
-if (! function_exists('_textdomain')) {
76
+if (!function_exists('_textdomain')) {
77 77
     /**
78 78
      * Sets the default domain.
79 79
      *
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     }
86 86
 }
87 87
 
88
-if (! function_exists('_gettext')) {
88
+if (!function_exists('_gettext')) {
89 89
     /**
90 90
      * Translates a string.
91 91
      *
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     }
100 100
 }
101 101
 
102
-if (! function_exists('__')) {
102
+if (!function_exists('__')) {
103 103
     /**
104 104
      * Translates a string, alias for _gettext.
105 105
      *
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     }
114 114
 }
115 115
 
116
-if (! function_exists('_ngettext')) {
116
+if (!function_exists('_ngettext')) {
117 117
     /**
118 118
      * Plural version of gettext.
119 119
      *
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     }
130 130
 }
131 131
 
132
-if (! function_exists('_pgettext')) {
132
+if (!function_exists('_pgettext')) {
133 133
     /**
134 134
      * Translate with context.
135 135
      *
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     }
145 145
 }
146 146
 
147
-if (! function_exists('_npgettext')) {
147
+if (!function_exists('_npgettext')) {
148 148
     /**
149 149
      * Plural version of pgettext.
150 150
      *
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     }
162 162
 }
163 163
 
164
-if (! function_exists('_dgettext')) {
164
+if (!function_exists('_dgettext')) {
165 165
     /**
166 166
      * Translates a string.
167 167
      *
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if (! function_exists('_dngettext')) {
179
+if (!function_exists('_dngettext')) {
180 180
     /**
181 181
      * Plural version of gettext.
182 182
      *
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
 }
195 195
 
196
-if (! function_exists('_dpgettext')) {
196
+if (!function_exists('_dpgettext')) {
197 197
     /**
198 198
      * Translate with context.
199 199
      *
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     }
210 210
 }
211 211
 
212
-if (! function_exists('_dnpgettext')) {
212
+if (!function_exists('_dnpgettext')) {
213 213
     /**
214 214
      * Plural version of pgettext.
215 215
      *
Please login to merge, or discard this patch.
src/Translator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * Cache header field for plural forms.
96 96
      */
97
-    private string|null $pluralEquation = null;
97
+    private string | null $pluralEquation = null;
98 98
 
99 99
     /**
100 100
      * Evaluator for plurals
101 101
      */
102
-    private ExpressionLanguage|null $pluralExpression = null;
102
+    private ExpressionLanguage | null $pluralExpression = null;
103 103
 
104 104
     /**
105 105
      * number of plurals
106 106
      */
107
-    private int|null $pluralCount = null;
107
+    private int | null $pluralCount = null;
108 108
 
109 109
     private CacheInterface $cache;
110 110
 
111 111
     /** @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation */
112
-    public function __construct(CacheInterface|string|null $cache)
112
+    public function __construct(CacheInterface | string | null $cache)
113 113
     {
114
-        if (! $cache instanceof CacheInterface) {
114
+        if (!$cache instanceof CacheInterface) {
115 115
             $cache = new InMemoryCache(new MoParser($cache));
116 116
         }
117 117
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         // this should contains all strings separated by NULLs
278 278
         $key = $msgid . "\u{0}" . $msgidPlural;
279
-        if (! $this->cache->has($key)) {
279
+        if (!$this->cache->has($key)) {
280 280
             return $number !== 1 ? $msgidPlural : $msgid;
281 281
         }
282 282
 
Please login to merge, or discard this patch.
src/Loader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @static
44 44
      */
45
-    private static Loader|null $instance = null;
45
+    private static Loader | null $instance = null;
46 46
 
47 47
     /**
48 48
      * Factory to return a factory responsible for returning a `CacheInterface`
49 49
      *
50 50
      * @static
51 51
      */
52
-    private static CacheFactoryInterface|null $cacheFactory = null;
52
+    private static CacheFactoryInterface | null $cacheFactory = null;
53 53
 
54 54
     /**
55 55
      * Default gettext domain to use.
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             }
158 158
 
159 159
             // If the locale name doesn't match POSIX style, just include it as-is.
160
-            if (! in_array($locale, $localeNames, true)) {
160
+            if (!in_array($locale, $localeNames, true)) {
161 161
                 $localeNames[] = $locale;
162 162
             }
163 163
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     /**
169 169
      * Sets factory responsible for composing a `CacheInterface`
170 170
      */
171
-    public static function setCacheFactory(CacheFactoryInterface|null $cacheFactory): void
171
+    public static function setCacheFactory(CacheFactoryInterface | null $cacheFactory): void
172 172
     {
173 173
         self::$cacheFactory = $cacheFactory;
174 174
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         $this->domains[$this->locale] ??= [];
188 188
 
189
-        if (! isset($this->domains[$this->locale][$domain])) {
189
+        if (!isset($this->domains[$this->locale][$domain])) {
190 190
             $base = $this->paths[$domain] ?? './';
191 191
 
192 192
             $localeNames = self::listLocales($this->locale);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function setlocale(string $locale): string
246 246
     {
247
-        if (! empty($locale)) {
247
+        if (!empty($locale)) {
248 248
             $this->locale = $locale;
249 249
         }
250 250
 
Please login to merge, or discard this patch.