Passed
Push — main ( dbf00b...97749d )
by Dimitri
02:05 queued 17s
created
src/Cli/Console/Command.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     final public function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self
306 306
     {
307
-        if (! $badge) {
307
+        if (!$badge) {
308 308
             $this->writer->okBold($label);
309 309
         } else {
310 310
             $this->writer->boldWhiteBgGreen(" {$label} ");
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     final public function warning(string $message, bool $badge = true, string $label = 'WARNING'): self
320 320
     {
321
-        if (! $badge) {
321
+        if (!$badge) {
322 322
             $this->writer->warnBold($label);
323 323
         } else {
324 324
             $this->writer->boldWhiteBgYellow(" {$label} ");
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      */
333 333
     final public function info(string $message, bool $badge = true, string $label = 'INFO'): self
334 334
     {
335
-        if (! $badge) {
335
+        if (!$badge) {
336 336
             $this->writer->infoBold($label);
337 337
         } else {
338 338
             $this->writer->boldWhiteBgCyan(" {$label} ");
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     final public function error(string $message, bool $badge = true, string $label = 'ERROR'): self
348 348
     {
349
-        if (! $badge) {
349
+        if (!$badge) {
350 350
             $this->writer->errorBold($label);
351 351
         } else {
352 352
             $this->writer->boldWhiteBgRed(" {$label} ");
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
      */
450 450
     final public function json($data): self
451 451
     {
452
-        $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true);
452
+        $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true);
453 453
 
454 454
         return $this;
455 455
     }
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
      */
642 642
     protected function initProps()
643 643
     {
644
-        if (! is_cli()) {
645
-            if (! file_exists($ou = TEMP_PATH . 'blitz-cli.txt')) {
644
+        if (!is_cli()) {
645
+            if (!file_exists($ou = TEMP_PATH . 'blitz-cli.txt')) {
646 646
                 file_put_contents($ou, '', LOCK_EX);
647 647
             }
648 648
 
Please login to merge, or discard this patch.
src/Router/RouteCollection.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         // Incluez le fichier routesFile s'il n'existe pas.
258 258
         // Ne conserver que pour les fins BC pour l'instant.
259 259
         $routeFiles = $this->routeFiles;
260
-        if (! in_array($routesFile, $routeFiles, true)) {
260
+        if (!in_array($routesFile, $routeFiles, true)) {
261 261
             $routeFiles[] = $routesFile;
262 262
         }
263 263
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $routes = $this;
266 266
 
267 267
         foreach ($routeFiles as $routesFile) {
268
-            if (! is_file($routesFile)) {
268
+            if (!is_file($routesFile)) {
269 269
                 logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
270 270
 
271 271
                 continue;
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      */
315 315
     public function placeholder(array|string $placeholder, ?string $pattern = null): self
316 316
     {
317
-        if (! is_array($placeholder)) {
317
+        if (!is_array($placeholder)) {
318 318
             $placeholder = [$placeholder => $pattern];
319 319
         }
320 320
 
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
      *
1027 1027
      * @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
1028 1028
      */
1029
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
1029
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
1030 1030
     {
1031 1031
         if ($from === '' || empty($to)) {
1032 1032
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
         // Ajoutez l'espace de noms par défaut si nécessaire.
1212 1212
         $namespace = trim($this->defaultNamespace, '\\') . '\\';
1213 1213
         if (
1214
-            ! str_starts_with($search, '\\')
1215
-            && ! str_starts_with($search, $namespace)
1214
+            !str_starts_with($search, '\\')
1215
+            && !str_starts_with($search, $namespace)
1216 1216
         ) {
1217 1217
             $search = $namespace . $search;
1218 1218
         }
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
                 $from = $route['from'];
1226 1226
 
1227 1227
                 // on ignore les closures
1228
-                if (! is_string($to)) {
1228
+                if (!is_string($to)) {
1229 1229
                     continue;
1230 1230
                 }
1231 1231
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
                 // S'il y a une chance de correspondance, alors ce sera
1238 1238
                 // soit avec $search au début de la chaîne $to.
1239
-                if (! str_starts_with($to, $search)) {
1239
+                if (!str_starts_with($to, $search)) {
1240 1240
                     continue;
1241 1241
                 }
1242 1242
 
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1318 1318
         foreach ($matches[0] as $index => $placeholder) {
1319
-            if (! isset($params[$index])) {
1319
+            if (!isset($params[$index])) {
1320 1320
                 throw new InvalidArgumentException(
1321 1321
                     'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".'
1322 1322
                 );
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
             // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex.
1328 1328
             $pattern = $this->placeholders[$placeholderName] ?? $placeholder;
1329 1329
 
1330
-            if (! preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1330
+            if (!preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1331 1331
                 throw RouterException::invalidParameterType();
1332 1332
             }
1333 1333
 
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
             $from = trim($from, '/');
1389 1389
         }
1390 1390
 
1391
-        if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1391
+        if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1392 1392
             $to = [$to, '__invoke'];
1393 1393
         }
1394 1394
 
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
         if (isset($options['middleware'])) {
1403 1403
             $options['middleware'] = (array) $options['middleware'];
1404 1404
 
1405
-            if (! isset($options['middlewares'])) {
1405
+            if (!isset($options['middlewares'])) {
1406 1406
                 $options['middlewares'] = $options['middleware'];
1407 1407
             } else {
1408 1408
                 $options['middlewares'] = array_merge($options['middlewares'], $options['middleware']);
@@ -1430,9 +1430,9 @@  discard block
 block discarded – undo
1430 1430
         }
1431 1431
 
1432 1432
         // Limitation du nom d'hôte ?
1433
-        if (! empty($options['hostname'])) {
1433
+        if (!empty($options['hostname'])) {
1434 1434
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1435
-            if (! $this->checkHostname($options['hostname'])) {
1435
+            if (!$this->checkHostname($options['hostname'])) {
1436 1436
                 return;
1437 1437
             }
1438 1438
 
@@ -1440,10 +1440,10 @@  discard block
 block discarded – undo
1440 1440
         }
1441 1441
 
1442 1442
         // Limitation du nom sous-domaine ?
1443
-        elseif (! empty($options['subdomain'])) {
1443
+        elseif (!empty($options['subdomain'])) {
1444 1444
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1445 1445
             // nous n'avons pas besoin d'ajouter la route.
1446
-            if (! $this->checkSubdomains($options['subdomain'])) {
1446
+            if (!$this->checkSubdomains($options['subdomain'])) {
1447 1447
                 return;
1448 1448
             }
1449 1449
 
@@ -1476,9 +1476,9 @@  discard block
 block discarded – undo
1476 1476
         }
1477 1477
 
1478 1478
         // S'il s'agit d'une redirection, aucun traitement
1479
-        if (! isset($options['redirect']) && is_string($to)) {
1479
+        if (!isset($options['redirect']) && is_string($to)) {
1480 1480
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1481
-            if (! str_contains($to, '\\') || strpos($to, '\\') > 0) {
1481
+            if (!str_contains($to, '\\') || strpos($to, '\\') > 0) {
1482 1482
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
1483 1483
                 $to        = trim($namespace, '\\') . '\\' . $to;
1484 1484
             }
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1496 1496
         // pour tenter de router la requête.
1497 1497
         $routeKeyExists = isset($this->routes[$verb][$routeKey]);
1498
-        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) {
1498
+        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) {
1499 1499
             return;
1500 1500
         }
1501 1501
 
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
     private function checkHostname(array|string $hostname): bool
1522 1522
     {
1523 1523
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1524
-        if (! isset($this->httpHost)) {
1524
+        if (!isset($this->httpHost)) {
1525 1525
             return false;
1526 1526
         }
1527 1527
 
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
     private function checkSubdomains($subdomains): bool
1545 1545
     {
1546 1546
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1547
-        if (! isset($this->httpHost)) {
1547
+        if (!isset($this->httpHost)) {
1548 1548
             return false;
1549 1549
         }
1550 1550
 
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1553 1553
         }
1554 1554
 
1555
-        if (! is_array($subdomains)) {
1555
+        if (!is_array($subdomains)) {
1556 1556
             $subdomains = [$subdomains];
1557 1557
         }
1558 1558
 
1559 1559
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1560 1560
         // il nécessite la présence d'un sous-domaine.
1561
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1561
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1562 1562
             return true;
1563 1563
         }
1564 1564
 
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
         // sur l'URL sinon parse_url sera mal interprété
1581 1581
         // 'hôte' comme 'chemin'.
1582 1582
         $url = $this->httpHost;
1583
-        if (! str_starts_with($url, 'http')) {
1583
+        if (!str_starts_with($url, 'http')) {
1584 1584
             $url = 'http://' . $url;
1585 1585
         }
1586 1586
 
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
      */
1625 1625
     private function getControllerName(Closure|string $handler): ?string
1626 1626
     {
1627
-        if (! is_string($handler)) {
1627
+        if (!is_string($handler)) {
1628 1628
             return null;
1629 1629
         }
1630 1630
 
@@ -1683,12 +1683,12 @@  discard block
 block discarded – undo
1683 1683
      */
1684 1684
     private function replaceLocale(string $route, ?string $locale = null): string
1685 1685
     {
1686
-        if (! str_contains($route, '{locale}')) {
1686
+        if (!str_contains($route, '{locale}')) {
1687 1687
             return $route;
1688 1688
         }
1689 1689
 
1690 1690
         // Vérifier les paramètres régionaux non valides
1691
-        if ($locale !== null && ! in_array($locale, config('app.supported_locales'), true)) {
1691
+        if ($locale !== null && !in_array($locale, config('app.supported_locales'), true)) {
1692 1692
             $locale = null;
1693 1693
         }
1694 1694
 
Please login to merge, or discard this patch.
src/Mail/Mailable.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     public function send(Mail $mail): bool
194 194
     {
195 195
         foreach ($this->bcc() as $key => $value) {
196
-            if (empty($value) || ! is_string($value)) {
196
+            if (empty($value) || !is_string($value)) {
197 197
                 continue;
198 198
             }
199 199
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         }
206 206
 
207 207
         foreach ($this->cc() as $key => $value) {
208
-            if (empty($value) || ! is_string($value)) {
208
+            if (empty($value) || !is_string($value)) {
209 209
                 continue;
210 210
             }
211 211
 
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 
219 219
         $content = $this->content();
220 220
 
221
-        if (! empty($content['view'])) {
221
+        if (!empty($content['view'])) {
222 222
             $mail->view($content['view'], $this->data());
223
-        } elseif (! empty($content['html'])) {
223
+        } elseif (!empty($content['html'])) {
224 224
             $mail->html($content['html']);
225 225
         }
226
-        if (! empty($content['text'])) {
226
+        if (!empty($content['text'])) {
227 227
             $mail->text($content['text']);
228 228
         }
229 229
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $mail->priority($this->priority());
233 233
 
234 234
         foreach ($this->replyTo() as $key => $value) {
235
-            if (empty($value) || ! is_string($value)) {
235
+            if (empty($value) || !is_string($value)) {
236 236
                 continue;
237 237
             }
238 238
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $mail->subject($this->subject());
247 247
 
248 248
         foreach ($this->to() as $key => $value) {
249
-            if (empty($value) || ! is_string($value)) {
249
+            if (empty($value) || !is_string($value)) {
250 250
                 continue;
251 251
             }
252 252
 
Please login to merge, or discard this patch.
src/Cli/Commands/Translation/TranslationsFinder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
 
67 67
         if (is_string($optionLocale)) {
68
-            if (! in_array($optionLocale, config('app.supported_locales'), true)) {
68
+            if (!in_array($optionLocale, config('app.supported_locales'), true)) {
69 69
                 $this->error(
70 70
                     $this->color->error('"' . $optionLocale . '" n\'est pas supporté. Les langues supportées sont: '
71 71
                     . implode(', ', config('app.supported_locales')))
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             if (is_file($languageFilePath)) {
130 130
                 // Charge les anciennes traductions
131 131
                 $languageStoredKeys = require $languageFilePath;
132
-            } elseif (! is_dir($dir = dirname($languageFilePath))) {
132
+            } elseif (!is_dir($dir = dirname($languageFilePath))) {
133 133
                 // Si le dossier n'existe pas, on le cree
134 134
                 @mkdir($dir, 0777, true);
135 135
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             $this->table($table);
197 197
         }
198 198
 
199
-        if (! $this->showNew && $countNewKeys > 0) {
199
+        if (!$this->showNew && $countNewKeys > 0) {
200 200
             $this->eol()->writer->bgRed('Note: Vous devez utiliser votre outil de linting pour résoudre les problèmes liés aux normes de codage.', true);
201 201
         }
202 202
     }
Please login to merge, or discard this patch.
src/Cli/Console/Console.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         foreach ($options as $key => $value) {
160 160
             $key = preg_replace('/^\-\-/', '', $key);
161
-            if (! isset($options[$key])) {
161
+            if (!isset($options[$key])) {
162 162
                 $options[$key] = $value;
163 163
             }
164 164
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function commandExists(string $commandName): bool
173 173
     {
174
-        return ! empty($this->_commands[$commandName]);
174
+        return !empty($this->_commands[$commandName]);
175 175
     }
176 176
 
177 177
     /**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         foreach ($files as $file) {
207 207
             $className = $locator->findQualifiedNameFromPath($file);
208 208
 
209
-            if ($className === false || ! class_exists($className)) {
209
+            if ($className === false || !class_exists($className)) {
210 210
                 continue;
211 211
             }
212 212
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $class  = new ReflectionClass($className);
233 233
         $logger = $logger ?: Services::logger();
234 234
 
235
-        if (! $class->isInstantiable() || ! $class->isSubclassOf(Command::class)) {
235
+        if (!$class->isInstantiable() || !$class->isSubclassOf(Command::class)) {
236 236
             throw CLIException::invalidCommand($className);
237 237
         }
238 238
 
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
             $value = (array) $value;
260 260
 
261 261
             $description = $value[0];
262
-            if (! is_string($description)) {
262
+            if (!is_string($description)) {
263 263
                 continue;
264 264
             }
265 265
 
266 266
             $default = $value[1] ?? null;
267 267
             $filter  = $value[2] ?? null;
268
-            if ($filter !== null && ! is_callable($filter)) {
268
+            if ($filter !== null && !is_callable($filter)) {
269 269
                 $filter = null;
270 270
             }
271 271
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             $value = (array) $value;
278 278
 
279 279
             $description = $value[0];
280
-            if (! is_string($description)) {
280
+            if (!is_string($description)) {
281 281
                 continue;
282 282
             }
283 283
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         }
288 288
 
289 289
         $console = $this;
290
-        $action  = function (?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
290
+        $action  = function(?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
291 291
             $this->name(); // ne pas retirer. car en cas, d'absence, cs-fixer mettra cette fonction en static. Et php-cli generera une erreur
292 292
 
293 293
             foreach ($instance->required as $package) {
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
                 /** @var Interactor $io */
299 299
                 $io = $console->io();
300 300
 
301
-                if (! InstalledVersions::isInstalled($package)) {
301
+                if (!InstalledVersions::isInstalled($package)) {
302 302
                     $io->info('Cette commande nécessite le package "' . $package . '" mais vous ne l\'avez pas', true);
303
-                    if (! $io->confirm('Voulez-vous l\'installer maintenant ?')) {
303
+                    if (!$io->confirm('Voulez-vous l\'installer maintenant ?')) {
304 304
                         return;
305 305
                     }
306 306
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
 
318 318
             $suppress = $suppress ?: $console->suppress;
319
-            if (! $suppress) {
319
+            if (!$suppress) {
320 320
                 $console->start($instance);
321 321
             }
322 322
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
             $result = $instance->setOptions($options)->setArguments($arguments)->execute($parameters);
333 333
 
334
-            if (! $suppress) {
334
+            if (!$suppress) {
335 335
                 $console->end();
336 336
             }
337 337
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
     private function registerException(Logger $logger)
348 348
     {
349
-        $this->onException(static function (Throwable $e, int $exitCode) use ($logger): void {
349
+        $this->onException(static function(Throwable $e, int $exitCode) use ($logger): void {
350 350
             $logger->error((string) $e, ['exitCode' => $exitCode, 'klinge' => true]);
351 351
         });
352 352
     }
Please login to merge, or discard this patch.
src/Cli/Commands/Utilities/Optimize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
 
116 116
     private function removeDevPackages(): void
117 117
     {
118
-        if (! defined('VENDOR_PATH')) {
118
+        if (!defined('VENDOR_PATH')) {
119 119
             return;
120 120
         }
121 121
 
Please login to merge, or discard this patch.
src/Container/Services.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public static function locator(bool $shared = true): LocatorInterface
282 282
     {
283 283
         if ($shared) {
284
-            if (! isset(static::$instances[Locator::class])) {
284
+            if (!isset(static::$instances[Locator::class])) {
285 285
                 $locator = new Locator(static::autoloader());
286 286
                 if (true === config('optimize.locator_cache_enabled', false)) {
287 287
                     static::$instances[Locator::class] = new LocatorCached($locator, new FileVarExportHandler());
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
     protected static function cacheServices(): void
620 620
     {
621
-        if (! static::$discovered) {
621
+        if (!static::$discovered) {
622 622
             $locator = static::locator();
623 623
             $files   = $locator->search('Config/Services');
624 624
 
Please login to merge, or discard this patch.