Passed
Push — master ( 7e9414...0260e9 )
by Maurício
13:10
created
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/Loader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @static
45 45
      */
46
-    private static Loader|null $instance = null;
46
+    private static Loader | null $instance = null;
47 47
 
48 48
     /**
49 49
      * Factory to return a factory responsible for returning a `CacheInterface`
50 50
      *
51 51
      * @static
52 52
      */
53
-    private static CacheFactoryInterface|null $cacheFactory = null;
53
+    private static CacheFactoryInterface | null $cacheFactory = null;
54 54
 
55 55
     /**
56 56
      * Default gettext domain to use.
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             }
179 179
 
180 180
             // If the locale name doesn't match POSIX style, just include it as-is.
181
-            if (! in_array($locale, $localeNames)) {
181
+            if (!in_array($locale, $localeNames)) {
182 182
                 array_push($localeNames, $locale);
183 183
             }
184 184
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     /**
190 190
      * Sets factory responsible for composing a `CacheInterface`
191 191
      */
192
-    public static function setCacheFactory(CacheFactoryInterface|null $cacheFactory): void
192
+    public static function setCacheFactory(CacheFactoryInterface | null $cacheFactory): void
193 193
     {
194 194
         self::$cacheFactory = $cacheFactory;
195 195
     }
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
             $domain = $this->defaultDomain;
206 206
         }
207 207
 
208
-        if (! isset($this->domains[$this->locale])) {
208
+        if (!isset($this->domains[$this->locale])) {
209 209
             $this->domains[$this->locale] = [];
210 210
         }
211 211
 
212
-        if (! isset($this->domains[$this->locale][$domain])) {
212
+        if (!isset($this->domains[$this->locale][$domain])) {
213 213
             if (isset($this->paths[$domain])) {
214 214
                 $base = $this->paths[$domain];
215 215
             } else {
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function setlocale(string $locale): string
273 273
     {
274
-        if (! empty($locale)) {
274
+        if (!empty($locale)) {
275 275
             $this->locale = $locale;
276 276
         }
277 277
 
Please login to merge, or discard this patch.
src/Translator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
     /**
97 97
      * Cache header field for plural forms.
98 98
      */
99
-    private string|null $pluralEquation = null;
99
+    private string | null $pluralEquation = null;
100 100
 
101 101
     /**
102 102
      * Evaluator for plurals
103 103
      */
104
-    private ExpressionLanguage|null $pluralExpression = null;
104
+    private ExpressionLanguage | null $pluralExpression = null;
105 105
 
106 106
     /**
107 107
      * number of plurals
108 108
      */
109
-    private int|null $pluralCount = null;
109
+    private int | null $pluralCount = null;
110 110
 
111 111
     private CacheInterface $cache;
112 112
 
113 113
     /** @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation */
114
-    public function __construct(CacheInterface|string|null $cache)
114
+    public function __construct(CacheInterface | string | null $cache)
115 115
     {
116
-        if (! $cache instanceof CacheInterface) {
116
+        if (!$cache instanceof CacheInterface) {
117 117
             $cache = new InMemoryCache(new MoParser($cache));
118 118
         }
119 119
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     {
283 283
         // this should contains all strings separated by NULLs
284 284
         $key = implode(chr(0), [$msgid, $msgidPlural]);
285
-        if (! $this->cache->has($key)) {
285
+        if (!$this->cache->has($key)) {
286 286
             return $number !== 1 ? $msgidPlural : $msgid;
287 287
         }
288 288
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
         $list = explode(chr(0), $result);
295 295
 
296
-        if (! isset($list[$select])) {
296
+        if (!isset($list[$select])) {
297 297
             return $list[0];
298 298
         }
299 299
 
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.