Passed
Push — main ( eb4a74...9116b3 )
by Dimitri
08:20 queued 04:05
created
src/Event/EventManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function __construct(protected array $listeners = [])
43 43
     {
44
-        if (! array_key_exists(self::WILDCARD, $this->listeners)) {
44
+        if (!array_key_exists(self::WILDCARD, $this->listeners)) {
45 45
             $this->listeners[self::WILDCARD] = [];
46 46
         }
47 47
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             return array_filter($this->listeners, static fn ($key) => $key !== self::WILDCARD, ARRAY_FILTER_USE_KEY);
53 53
         }
54 54
 
55
-        if (! array_key_exists($event, $this->listeners)) {
55
+        if (!array_key_exists($event, $this->listeners)) {
56 56
             return [];
57 57
         }
58 58
 
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function on(string $event, callable $callback, int $priority = 0): bool
78 78
     {
79
-        if (! array_key_exists($event, $this->listeners)) {
79
+        if (!array_key_exists($event, $this->listeners)) {
80 80
             $this->listeners[$event] = [];
81 81
         }
82
-        if (! array_key_exists($priority, $this->listeners[$event])) {
82
+        if (!array_key_exists($priority, $this->listeners[$event])) {
83 83
             $this->listeners[$event][$priority] = [];
84 84
         }
85 85
 
86
-        if (! in_array($callback, $this->listeners[$event][$priority], true)) {
86
+        if (!in_array($callback, $this->listeners[$event][$priority], true)) {
87 87
             $this->listeners[$event][$priority][] = $callback;
88 88
 
89 89
             return true;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function off(string $event, callable $callback): bool
107 107
     {
108
-        if (! array_key_exists($event, $this->listeners) || ! $this->listeners[$event]) {
108
+        if (!array_key_exists($event, $this->listeners) || !$this->listeners[$event]) {
109 109
             return false;
110 110
         }
111 111
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function emit($event, $target = null, $argv = [])
138 138
     {
139
-        if (! ($event instanceof EventInterface)) {
139
+        if (!($event instanceof EventInterface)) {
140 140
             $event = new Event($event, $target, $argv);
141 141
         } else {
142 142
             if ($target) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         }
149 149
 
150 150
         $eventName = $event->getName();
151
-        if (! array_key_exists($eventName, $this->listeners)) {
151
+        if (!array_key_exists($eventName, $this->listeners)) {
152 152
             $this->listeners[$eventName] = [];
153 153
         }
154 154
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         ksort($events, SORT_NUMERIC);
159 159
 
160 160
         foreach ($events as $priority) {
161
-            if (! is_array($priority)) {
161
+            if (!is_array($priority)) {
162 162
                 continue;
163 163
             }
164 164
 
Please login to merge, or discard this patch.
src/View/Adapters/SmartyAdapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         $this->renderVars['file'] = $this->getRenderedFile($options, $this->renderVars['view'], $this->ext);
68 68
 
69
-        if (! empty($layout = $this->layout)) {
69
+        if (!empty($layout = $this->layout)) {
70 70
             $pathinfo = pathinfo($layout, PATHINFO_EXTENSION);
71 71
             if ($pathinfo === [] || $pathinfo === '' || $pathinfo === '0') {
72 72
                 $layout .= '.' . $this->ext;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $this->engine->assign($this->data);
78 78
 
79 79
         // Doit-on mettre en cache?
80
-        if (! empty($this->renderVars['options']['cache_name']) || ! empty($this->renderVars['options']['cache'])) {
80
+        if (!empty($this->renderVars['options']['cache_name']) || !empty($this->renderVars['options']['cache'])) {
81 81
             $this->enableCache();
82 82
             $this->engine->setCacheLifetime(60 * ($this->renderVars['options']['cache'] ?? 60));
83 83
             $this->engine->setCompileId($this->renderVars['options']['cache_name'] ?? null);
Please login to merge, or discard this patch.
src/Router/AutoRouter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $class = $this->translateURI($segment);
162 162
 
163 163
             // dès que nous rencontrons un segment qui n'est pas compatible PSR-4, arrêter la recherche
164
-            if (! $this->isValidSegment($class)) {
164
+            if (!$this->isValidSegment($class)) {
165 165
                 return false;
166 166
             }
167 167
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             throw new MethodNotFoundException();
388 388
         }
389 389
 
390
-        if (! $refMethod->isPublic()) {
390
+        if (!$refMethod->isPublic()) {
391 391
             throw new MethodNotFoundException();
392 392
         }
393 393
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             return;
450 450
         }
451 451
 
452
-        if (! in_array(ltrim($classname, '\\'), get_declared_classes(), true)) {
452
+        if (!in_array(ltrim($classname, '\\'), get_declared_classes(), true)) {
453 453
             throw new PageNotFoundException(
454 454
                 '"' . $classname . '" n\'a pas été trouvé.'
455 455
             );
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             // Mais si un visiteur navigue vers l'URI `controller/somemethod`, `getSomemethod()` sera vérifié, et `method_exists()` retournera true parce que les noms de méthodes en PHP sont insensibles à la casse.
474 474
             method_exists($this->controller, $method)
475 475
             // Mais nous n'autorisons pas `controller/somemethod`, donc vérifiez le nom exact de la méthode.
476
-            && ! in_array($method, get_class_methods($this->controller), true)
476
+            && !in_array($method, get_class_methods($this->controller), true)
477 477
         ) {
478 478
             throw new PageNotFoundException(
479 479
                 '"' . $this->controller . '::' . $method . '()" n\'a pas été trouvé.'
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
             throw new CLIException($e->getMessage(), $exitCode, $e);
Please login to merge, or discard this patch.
src/Debug/ExceptionManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public static function registerHttpErrors(Run $debugger, array $config): Run
37 37
     {
38
-        return $debugger->pushHandler(static function (Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config): int {
39
-            if (true === $config['log'] && ! in_array($exception->getCode(), $config['ignore_codes'], true)) {
38
+        return $debugger->pushHandler(static function(Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config): int {
39
+            if (true === $config['log'] && !in_array($exception->getCode(), $config['ignore_codes'], true)) {
40 40
                 Services::logger()->error($exception);
41 41
             }
42 42
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $debugger->pushHandler(new PlainTextHandler());
89 89
         }
90 90
 
91
-        if (! is_online()) {
91
+        if (!is_online()) {
92 92
             if (Misc::isAjaxRequest() || Services::request()->isJson()) {
93 93
                 $debugger->pushHandler(new JsonResponseHandler());
94 94
             } else {
Please login to merge, or discard this patch.
src/Router/Router.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
189 189
         // Contrôleurs/répertoires, mais l'application peut ne pas
190 190
         // vouloir ceci, comme dans le cas des API.
191
-        if (! $this->collection->shouldAutoRoute()) {
191
+        if (!$this->collection->shouldAutoRoute()) {
192 192
             throw new PageNotFoundException("Impossible de trouver une route pour '{$this->collection->getHTTPVerb()}: {$uri}'.");
193 193
         }
194 194
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      */
219 219
     public function controllerName()
220 220
     {
221
-        if (! is_string($this->controller)) {
221
+        if (!is_string($this->controller)) {
222 222
             return $this->controller;
223 223
         }
224 224
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
             return [
265 265
                 $routeArray[0], // Controleur
266
-                $routeArray[1] ?? 'index',   // Methode
266
+                $routeArray[1] ?? 'index', // Methode
267 267
             ];
268 268
         }
269 269
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                 // Cette route est-elle censée rediriger vers une autre ?
390 390
                 if ($this->collection->isRedirect($routeKey)) {
391 391
                     // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1
392
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function (): string {
392
+                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function(): string {
393 393
                         static $i = 1;
394 394
 
395 395
                         return '$' . $i++;
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                     );
410 410
 
411 411
                     if ($this->collection->shouldUseSupportedLocalesOnly()
412
-                        && ! in_array($matched['locale'], config('app.supported_locales'), true)) {
412
+                        && !in_array($matched['locale'], config('app.supported_locales'), true)) {
413 413
                         // Lancer une exception pour empêcher l'autorouteur,
414 414
                         // si activé, essayer de trouver une route
415 415
                         throw PageNotFoundException::localeNotSupported($matched['locale']);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
                 // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau
423 423
                 // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur.
424
-                if (! is_string($handler) && is_callable($handler)) {
424
+                if (!is_string($handler) && is_callable($handler)) {
425 425
                     $this->controller = $handler;
426 426
 
427 427
                     // Supprime la chaîne d'origine du tableau matches
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
         return preg_replace_callback(
500 500
             $pattern,
501
-            static function ($match) use ($matches) {
501
+            static function($match) use ($matches) {
502 502
                 $index = (int) $match[1];
503 503
 
504 504
                 return $matches[$index] ?? '';
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
         // $this->method contient déjà le nom de la méthode par défaut,
540 540
         // donc ne l'écrasez pas avec le vide.
541
-        if (! empty($method)) {
541
+        if (!empty($method)) {
542 542
             $this->setMethod($method);
543 543
         }
544 544
 
Please login to merge, or discard this patch.
src/Http/Negotiator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         }
205 205
 
206 206
         // Sort to get the highest results first
207
-        usort($results, static function ($a, $b): int {
207
+        usort($results, static function($a, $b): int {
208 208
             if ($a['q'] === $b['q']) {
209 209
                 $a_ast = substr_count($a['value'], '*');
210 210
                 $b_ast = substr_count($b['value'], '*');
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         foreach ($supported['params'] as $label => $value) {
277
-            if (! isset($acceptable['params'][$label]) || $acceptable['params'][$label] !== $value) {
277
+            if (!isset($acceptable['params'][$label]) || $acceptable['params'][$label] !== $value) {
278 278
                 return false;
279 279
             }
280 280
         }
Please login to merge, or discard this patch.
src/Http/UploadedFileFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function makeUploadedFile(array $spec): UploadedFile
65 65
     {
66
-        if (! isset($spec['tmp_name']) || ! isset($spec['size']) || ! isset($spec['error'])) {
66
+        if (!isset($spec['tmp_name']) || !isset($spec['size']) || !isset($spec['error'])) {
67 67
             throw new InvalidArgumentException(sprintf(
68 68
                 '$spec fourni à %s DOIT contenir chacune des clés "tmp_name", "size", et "error" ; une ou plusieurs étaient manquantes',
69 69
                 __FUNCTION__
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
          *
104 104
          * @return list<array>|list<UploadedFile>
105 105
          */
106
-        $recursiveNormalize = static function (
106
+        $recursiveNormalize = static function(
107 107
             array $tmpNameTree,
108 108
             array $sizeTree,
109 109
             array $errorTree,
110 110
             ?array $nameTree = null,
111 111
             ?array $typeTree = null
112
-        ) use (&$recursiveNormalize): array {
112
+        ) use (&$recursiveNormalize) : array {
113 113
             $normalized = [];
114 114
 
115 115
             foreach ($tmpNameTree as $key => $value) {
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
          *
148 148
          * @return list<UploadedFile>
149 149
          */
150
-        $normalizeUploadedFileSpecification = static function (array $files = []) use (&$recursiveNormalize): array {
150
+        $normalizeUploadedFileSpecification = static function(array $files = []) use (&$recursiveNormalize): array {
151 151
             if (
152
-                ! isset($files['tmp_name']) || ! is_array($files['tmp_name'])
153
-                                            || ! isset($files['size']) || ! is_array($files['size'])
154
-                                            || ! isset($files['error']) || ! is_array($files['error'])
152
+                !isset($files['tmp_name']) || !is_array($files['tmp_name'])
153
+                                            || !isset($files['size']) || !is_array($files['size'])
154
+                                            || !isset($files['error']) || !is_array($files['error'])
155 155
             ) {
156 156
                 throw new InvalidArgumentException(sprintf(
157 157
                     'Les fichiers fournis à %s DOIVENT contenir chacune des clés "tmp_name", "size" et "error",
Please login to merge, or discard this patch.
src/Loader/Load.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             return $models;
70 70
         }
71 71
 
72
-        if (! self::isLoaded('models', $model)) {
72
+        if (!self::isLoaded('models', $model)) {
73 73
             self::loaded('models', $model, FileLocator::model($model, $connection));
74 74
         }
75 75
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private static function isLoaded(string $module, string $element): bool
83 83
     {
84
-        if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) {
84
+        if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) {
85 85
             return false;
86 86
         }
87 87
 
Please login to merge, or discard this patch.