Passed
Push — main ( d71b68...a743f7 )
by Dimitri
08:12 queued 04:09
created
src/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         $this->_streamMode   = $options['streamMode'] ?? $this->_streamMode;
379 379
 
380 380
         if (isset($options['stream'])) {
381
-            if (! $options['stream'] instanceof StreamInterface) {
381
+            if (!$options['stream'] instanceof StreamInterface) {
382 382
                 throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface');
383 383
             }
384 384
             $this->stream = $options['stream'];
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $this->_setStatus($options['status']);
395 395
         }
396 396
 
397
-        if (! isset($options['charset'])) {
397
+        if (!isset($options['charset'])) {
398 398
             $options['charset'] = config('app.charset');
399 399
         }
400 400
         $this->_charset = $options['charset'];
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             $charset = true;
443 443
         }
444 444
 
445
-        if ($charset && ! str_contains($type, ';')) {
445
+        if ($charset && !str_contains($type, ';')) {
446 446
             $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}");
447 447
         } else {
448 448
             $this->_setHeader('Content-Type', $type);
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
     protected function _clearHeader(string $header): void
523 523
     {
524 524
         $normalized = strtolower($header);
525
-        if (! isset($this->headerNames[$normalized])) {
525
+        if (!isset($this->headerNames[$normalized])) {
526 526
             return;
527 527
         }
528 528
         $original = $this->headerNames[$normalized];
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
             throw HttpException::invalidStatusCode($code);
590 590
         }
591 591
 
592
-        if (! array_key_exists($code, $this->_statusCodes) && ($reasonPhrase === '' || $reasonPhrase === '0')) {
592
+        if (!array_key_exists($code, $this->_statusCodes) && ($reasonPhrase === '' || $reasonPhrase === '0')) {
593 593
             throw HttpException::unkownStatusCode($code);
594 594
         }
595 595
 
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
         if ($mapped) {
683 683
             return is_array($mapped) ? current($mapped) : $mapped;
684 684
         }
685
-        if (! str_contains($contentType, '/')) {
685
+        if (!str_contains($contentType, '/')) {
686 686
             throw new InvalidArgumentException(sprintf('`%s` est un content type invalide.', $contentType));
687 687
         }
688 688
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
      */
766 766
     public function withCache($since, $time = '+1 day'): static
767 767
     {
768
-        if (! is_int($time)) {
768
+        if (!is_int($time)) {
769 769
             $time = strtotime($time);
770 770
             if ($time === false) {
771 771
                 throw new InvalidArgumentException(
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
      */
1234 1234
     public function getCookie(string $name): ?array
1235 1235
     {
1236
-        if (! $this->hasCookie($name)) {
1236
+        if (!$this->hasCookie($name)) {
1237 1237
             return null;
1238 1238
         }
1239 1239
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
      */
1246 1246
     public function hasCookie(string $name, ?string $value = null): bool
1247 1247
     {
1248
-        if (! $this->_cookies->has($name)) {
1248
+        if (!$this->_cookies->has($name)) {
1249 1249
             return false;
1250 1250
         }
1251 1251
 
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 
1323 1323
         $extension = strtolower($file->getExtension());
1324 1324
         $mapped    = $this->getMimeType($extension);
1325
-        if ((! $extension || ! $mapped) && $options['download'] === null) {
1325
+        if ((!$extension || !$mapped) && $options['download'] === null) {
1326 1326
             $options['download'] = true;
1327 1327
         }
1328 1328
 
@@ -1384,12 +1384,12 @@  discard block
 block discarded – undo
1384 1384
         if (str_contains($path, '../') || str_contains($path, '..\\')) {
1385 1385
             throw new LoadException('The requested file contains `..` and will not be read.');
1386 1386
         }
1387
-        if (! is_file($path)) {
1387
+        if (!is_file($path)) {
1388 1388
             $path = APP_PATH . $path;
1389 1389
         }
1390 1390
 
1391 1391
         $file = new SplFileInfo($path);
1392
-        if (! $file->isFile() || ! $file->isReadable()) {
1392
+        if (!$file->isFile() || !$file->isReadable()) {
1393 1393
             if (on_dev()) {
1394 1394
                 throw new LoadException(sprintf('The requested file %s was not found or not readable', $path));
1395 1395
             }
Please login to merge, or discard this patch.
src/Http/Uri.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
             return '';
148 148
         }
149 149
 
150
-        if (! empty($userInfo = $this->getUserInfo())) {
150
+        if (!empty($userInfo = $this->getUserInfo())) {
151 151
             $authority = $userInfo . '@' . $authority;
152 152
         }
153 153
 
154 154
         // N'ajoute pas de port s'il s'agit d'un port standard pour ce schéma
155
-        if ($this->port !== null && $this->port !== 0 && ! $ignorePort && $this->port !== $this->defaultPorts[$this->scheme]) {
155
+        if ($this->port !== null && $this->port !== 0 && !$ignorePort && $this->port !== $this->defaultPorts[$this->scheme]) {
156 156
             $authority .= ':' . $this->port;
157 157
         }
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $userInfo = $this->user ?: '';
170 170
 
171
-        if ($this->showPassword === true && ! empty($this->password)) {
171
+        if ($this->showPassword === true && !empty($this->password)) {
172 172
             $userInfo .= ':' . $this->password;
173 173
         }
174 174
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $vars = $this->query;
219 219
 
220 220
         if (array_key_exists('except', $options)) {
221
-            if (! is_array($options['except'])) {
221
+            if (!is_array($options['except'])) {
222 222
                 $options['except'] = [$options['except']];
223 223
             }
224 224
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         } elseif (array_key_exists('only', $options)) {
229 229
             $temp = [];
230 230
 
231
-            if (! is_array($options['only'])) {
231
+            if (!is_array($options['only'])) {
232 232
                 $options['only'] = [$options['only']];
233 233
             }
234 234
 
@@ -342,16 +342,16 @@  discard block
 block discarded – undo
342 342
     public static function createURIString(?string $scheme = null, ?string $authority = null, ?string $path = null, ?string $query = null, ?string $fragment = null): string
343 343
     {
344 344
         $uri = '';
345
-        if (! empty($scheme)) {
345
+        if (!empty($scheme)) {
346 346
             $uri .= $scheme . '://';
347 347
         }
348 348
 
349
-        if (! empty($authority)) {
349
+        if (!empty($authority)) {
350 350
             $uri .= $authority;
351 351
         }
352 352
 
353 353
         if (isset($path) && $path !== '') {
354
-            $uri .= ! str_ends_with($uri, '/')
354
+            $uri .= !str_ends_with($uri, '/')
355 355
                 ? '/' . ltrim($path, '/')
356 356
                 : ltrim($path, '/');
357 357
         }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     {
375 375
         $parts = parse_url($str);
376 376
 
377
-        if (! isset($parts['path'])) {
377
+        if (!isset($parts['path'])) {
378 378
             $parts['path'] = $this->getPath();
379 379
         }
380 380
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         $temp = [];
624 624
 
625 625
         foreach ($this->query as $key => $value) {
626
-            if (! in_array($key, $params, true)) {
626
+            if (!in_array($key, $params, true)) {
627 627
                 continue;
628 628
             }
629 629
 
@@ -698,19 +698,19 @@  discard block
 block discarded – undo
698 698
      */
699 699
     protected function applyParts(array $parts)
700 700
     {
701
-        if (! empty($parts['host'])) {
701
+        if (!empty($parts['host'])) {
702 702
             $this->host = $parts['host'];
703 703
         }
704
-        if (! empty($parts['user'])) {
704
+        if (!empty($parts['user'])) {
705 705
             $this->user = $parts['user'];
706 706
         }
707
-        if (! empty($parts['path'])) {
707
+        if (!empty($parts['path'])) {
708 708
             $this->path = $this->filterPath($parts['path']);
709 709
         }
710
-        if (! empty($parts['query'])) {
710
+        if (!empty($parts['query'])) {
711 711
             $this->setQuery($parts['query']);
712 712
         }
713
-        if (! empty($parts['fragment'])) {
713
+        if (!empty($parts['fragment'])) {
714 714
             $this->fragment = $parts['fragment'];
715 715
         }
716 716
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $transformed = clone $relative;
759 759
 
760 760
         // 5.2.2 Transformer les références dans une méthode non stricte (pas de schéma)
761
-        if (! empty($relative->getAuthority())) {
761
+        if (!empty($relative->getAuthority())) {
762 762
             $transformed->setAuthority($relative->getAuthority())
763 763
                 ->setPath($relative->getPath())
764 764
                 ->setQuery($relative->getQuery());
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             $basePath = trim($baseUri->getPath(), '/') . '/';
882 882
             $trimPath = ltrim($path, '/');
883 883
 
884
-            if ($basePath !== '/' && ! str_starts_with($trimPath, $basePath)) {
884
+            if ($basePath !== '/' && !str_starts_with($trimPath, $basePath)) {
885 885
                 $path = $basePath . $trimPath;
886 886
             }
887 887
 
Please login to merge, or discard this patch.
src/Http/Redirection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         // Si cela semble être une URL relative, alors convertissez-la en URL complète
70 70
         // pour une meilleure sécurité.
71
-        if (! str_starts_with($uri, 'http')) {
71
+        if (!str_starts_with($uri, 'http')) {
72 72
             $uri = site_url($uri);
73 73
         }
74 74
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $request = $this->generator->getRequest();
139 139
 
140
-        $intended = $request->method() === 'GET' && ! $request->expectsJson()
140
+        $intended = $request->method() === 'GET' && !$request->expectsJson()
141 141
                         ? $this->generator->full()
142 142
                         : $this->generator->previous();
143 143
 
Please login to merge, or discard this patch.
src/Http/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     public function validation(array|string $rules, array $messages = []): Validation
66 66
     {
67 67
         if (is_string($rules)) {
68
-            if (! class_exists($rules) || ! is_subclass_of($rules, DataValidation::class)) {
68
+            if (!class_exists($rules) || !is_subclass_of($rules, DataValidation::class)) {
69 69
                 throw new InvalidArgumentException();
70 70
             }
71 71
 
Please login to merge, or discard this patch.
src/Http/ServerRequest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $this->cookies = $config['cookies'];
233 233
 
234 234
         if (isset($config['uri'])) {
235
-            if (! $config['uri'] instanceof UriInterface) {
235
+            if (!$config['uri'] instanceof UriInterface) {
236 236
                 throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class);
237 237
             }
238 238
             $uri = $config['uri'];
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $this->stream = $stream;
266 266
 
267 267
         $post = $config['post'];
268
-        if (! (is_array($post) || is_object($post) || $post === null)) {
268
+        if (!(is_array($post) || is_object($post) || $post === null)) {
269 269
             throw new InvalidArgumentException(sprintf(
270 270
                 'La clé `post` doit être un tableau, un objet ou null. On a obtenu `%s` à la place.',
271 271
                 get_debug_type($post)
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
         }
449 449
 
450 450
         $type = strtolower($type);
451
-        if (! isset(static::$_detectors[$type])) {
451
+        if (!isset(static::$_detectors[$type])) {
452 452
             return false;
453 453
         }
454 454
         if ($args !== []) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
     public function isAll(array $types): bool
601 601
     {
602 602
         foreach ($types as $type) {
603
-            if (! $this->is($type)) {
603
+            if (!$this->is($type)) {
604 604
                 return false;
605 605
             }
606 606
         }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
     protected function normalizeHeaderName(string $name): string
705 705
     {
706 706
         $name = str_replace('-', '_', strtoupper($name));
707
-        if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
707
+        if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
708 708
             $name = 'HTTP_' . $name;
709 709
         }
710 710
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
     {
891 891
         $new = clone $this;
892 892
 
893
-        if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
893
+        if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
894 894
             throw new InvalidArgumentException(sprintf(
895 895
                 'Méthode HTTP non prise en charge "%s" fournie',
896 896
                 $method
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
                 }
1151 1151
             }
1152 1152
 
1153
-            if (! isset($accept[$prefValue])) {
1153
+            if (!isset($accept[$prefValue])) {
1154 1154
                 $accept[$prefValue] = [];
1155 1155
             }
1156 1156
             if ($prefValue) {
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
         if ($name === null) {
1229 1229
             return $this->data;
1230 1230
         }
1231
-        if (! is_array($this->data)) {
1231
+        if (!is_array($this->data)) {
1232 1232
             return $default;
1233 1233
         }
1234 1234
 
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
      */
1369 1369
     public function withProtocolVersion(string $version): static
1370 1370
     {
1371
-        if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1371
+        if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1372 1372
             throw new InvalidArgumentException(sprintf('Version de protocole `%s` non prise en charge fournie.', $version));
1373 1373
         }
1374 1374
         $new           = clone $this;
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
     public function getEnv(string $key, ?string $default = null): ?string
1391 1391
     {
1392 1392
         $key = strtoupper($key);
1393
-        if (! array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) {
1393
+        if (!array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) {
1394 1394
             $this->_environment[$key] = env($key, $default);
1395 1395
         }
1396 1396
 
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
         $file = Arr::get($this->uploadedFiles, $path);
1608 1608
         if (is_array($file)) {
1609 1609
             foreach ($file as $f) {
1610
-                if (! ($f instanceof UploadedFile)) {
1610
+                if (!($f instanceof UploadedFile)) {
1611 1611
                     return null;
1612 1612
                 }
1613 1613
             }
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
             return $file;
1616 1616
         }
1617 1617
 
1618
-        if (! ($file instanceof UploadedFileInterface)) {
1618
+        if (!($file instanceof UploadedFileInterface)) {
1619 1619
             return null;
1620 1620
         }
1621 1621
 
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
                 continue;
1664 1664
             }
1665 1665
 
1666
-            if (! $file instanceof UploadedFileInterface) {
1666
+            if (!$file instanceof UploadedFileInterface) {
1667 1667
                 throw new InvalidArgumentException("Fichier invalide à `{$path}{$key}`");
1668 1668
             }
1669 1669
         }
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
         if (empty($host = $uri->getHost())) {
1717 1717
             return $new;
1718 1718
         }
1719
-        if (! empty($port = $uri->getPort())) {
1719
+        if (!empty($port = $uri->getPort())) {
1720 1720
             $host .= ':' . $port;
1721 1721
         }
1722 1722
         $new->_environment['HTTP_HOST'] = $host;
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
         $validLocales = config('app.supported_locales');
1813 1813
         // S'il ne s'agit pas d'un paramètre régional valide, définissez-le
1814 1814
         // aux paramètres régionaux par défaut du site.
1815
-        if (! in_array($locale, $validLocales, true)) {
1815
+        if (!in_array($locale, $validLocales, true)) {
1816 1816
             $locale = config('app.language');
1817 1817
         }
1818 1818
 
Please login to merge, or discard this patch.
src/View/Adapters/AbstractAdapter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         helper('assets');
80 80
 
81
-        if (! empty($viewPathLocator)) {
81
+        if (!empty($viewPathLocator)) {
82 82
             if (is_string($viewPathLocator)) {
83 83
                 $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS;
84 84
             } elseif ($viewPathLocator instanceof LocatorInterface) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             }
87 87
         }
88 88
 
89
-        if (! $this->locator instanceof LocatorInterface && ! is_dir($this->viewPath)) {
89
+        if (!$this->locator instanceof LocatorInterface && !is_dir($this->viewPath)) {
90 90
             $this->viewPath = '';
91 91
             $this->locator  = Services::locator();
92 92
         }
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
         $ext ??= $this->ext;
262 262
 
263 263
         $viewPath = $options['viewPath'] ?? $this->viewPath;
264
-        $file     = ! empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view;
264
+        $file     = !empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view;
265 265
 
266 266
         $file = Helpers::ensureExt($file, $ext);
267 267
 
268
-        if (! is_file($file) && $this->locator instanceof LocatorInterface) {
268
+        if (!is_file($file) && $this->locator instanceof LocatorInterface) {
269 269
             $file = $this->locator->locateFile($view, 'Views', $ext);
270 270
         }
271 271
 
272 272
         $file = realpath($file);
273 273
 
274 274
         // locateFile renverra une chaîne vide si le fichier est introuvable.
275
-        if (! is_file($file)) {
275
+        if (!is_file($file)) {
276 276
             throw ViewException::invalidFile($view);
277 277
         }
278 278
 
Please login to merge, or discard this patch.
src/View/Adapters/NativeAdapter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         // Enregistrer les variables actuelles
122 122
         $renderVars = $this->renderVars;
123 123
 
124
-        $output = (function (): string {
124
+        $output = (function(): string {
125 125
             extract($this->tempData);
126 126
             ob_start();
127 127
             include $this->renderVars['file'];
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
         $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']);
144 144
 
145
-        if ($this->debug && (! isset($options['debug']) || $options['debug'] === true) && in_array(ViewsCollector::class, config('toolbar.collectors'), true)) {
145
+        if ($this->debug && (!isset($options['debug']) || $options['debug'] === true) && in_array(ViewsCollector::class, config('toolbar.collectors'), true)) {
146 146
             // Nettoyer nos noms de chemins pour les rendre un peu plus propres
147 147
             $this->renderVars['file'] = clean_path($this->renderVars['file']);
148 148
             $this->renderVars['file'] = ++$this->viewsCount . ' ' . $this->renderVars['file'];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $saveData ??= $this->saveData;
176 176
         $this->prepareTemplateData($saveData);
177 177
 
178
-        $output = (function (string $view): string {
178
+        $output = (function(string $view): string {
179 179
             extract($this->tempData);
180 180
             ob_start();
181 181
             eval('?>' . $view);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         $section = array_pop($this->sectionStack);
319 319
 
320 320
         // Assurez-vous qu'un tableau existe afin que nous puissions stocker plusieurs entrées pour cela.
321
-        if (! array_key_exists($section, $this->sections)) {
321
+        if (!array_key_exists($section, $this->sections)) {
322 322
             $this->sections[$section] = [];
323 323
         }
324 324
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     public function show(string $sectionName, bool $preserve = false)
356 356
     {
357
-        if (! isset($this->sections[$sectionName])) {
357
+        if (!isset($this->sections[$sectionName])) {
358 358
             echo '';
359 359
 
360 360
             return;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      *
398 398
      * @alias self::insert()
399 399
      */
400
-    public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null): string
400
+    public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null) : string
401 401
     {
402 402
         return $this->insert($view, $data, $options, $saveData);
403 403
     }
Please login to merge, or discard this patch.
src/View/Components/ComponentLoader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $instance->initialize(Services::request(), Services::response(), Services::logger());
80 80
         }
81 81
 
82
-        if (! method_exists($instance, $method)) {
82
+        if (!method_exists($instance, $method)) {
83 83
             throw ViewException::invalidComponentMethod($class, $method);
84 84
         }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function prepareParams($params): array
106 106
     {
107
-        if ($params === null || $params === '' || $params === [] || (! is_string($params) && ! is_array($params))) {
107
+        if ($params === null || $params === '' || $params === [] || (!is_string($params) && !is_array($params))) {
108 108
             return [];
109 109
         }
110 110
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $library = str_replace('::', ':', $library);
148 148
 
149 149
         //  Les composants contrôlées peuvent être appelées avec le seul nom de la classe, c'est pourquoi il faut ajouter une méthode par défaut
150
-        if (! str_contains($library, ':')) {
150
+        if (!str_contains($library, ':')) {
151 151
             $library .= ':render';
152 152
         }
153 153
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             }
178 178
         }
179 179
 
180
-        if (! is_object($object)) {
180
+        if (!is_object($object)) {
181 181
             throw ViewException::invalidComponentClass($class);
182 182
         }
183 183
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
             $output = $instance->{$method}();
274 274
         } elseif (($paramCount === 1)
275
-            && ((! array_key_exists($refParams[0]->name, $params))
275
+            && ((!array_key_exists($refParams[0]->name, $params))
276 276
             || (array_key_exists($refParams[0]->name, $params)
277 277
             && count($params) !== 1))
278 278
         ) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             }
290 290
 
291 291
             foreach (array_keys($params) as $key) {
292
-                if (! isset($methodParams[$key])) {
292
+                if (!isset($methodParams[$key])) {
293 293
                     throw ViewException::invalidComponentParameter($key);
294 294
                 }
295 295
             }
Please login to merge, or discard this patch.
src/View/Parser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $file = $this->viewPath . $view;
99 99
 
100
-        if (! is_file($file)) {
100
+        if (!is_file($file)) {
101 101
             $fileOrig = $file;
102 102
             $file     = ($this->locator ?: Services::locator())->locateFile($view, 'Views');
103 103
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         foreach ($matches as $match) {
282 282
             // Loop over each piece of $data, replacing
283 283
             // its contents so that we know what to replace in parse()
284
-            $str = '';  // holds the new contents for this tag pair.
284
+            $str = ''; // holds the new contents for this tag pair.
285 285
 
286 286
             foreach ($data as $row) {
287 287
                 // Objects that have a `toArray()` method should be
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
                 // Now replace our placeholders with the new content.
325 325
                 foreach ($temp as $pattern => $content) {
326
-                    $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern]));
326
+                    $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern]));
327 327
                 }
328 328
 
329 329
                 $str .= $out;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     protected function replaceSingle(array|string $pattern, string $content, string $template, bool $escape = false): string
482 482
     {
483 483
         // Replace the content in the template
484
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
484
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape) {
485 485
             // Check for {! !} syntax to not escape this one.
486 486
             if (
487 487
                 str_starts_with($matches[0], $this->leftDelimiter . '!')
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
         // Our regex earlier will leave all chained values on a single line
505 505
         // so we need to break them apart so we can apply them all.
506
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
506
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
507 507
 
508 508
         if ($escape && $filters === [] && ($context = $this->shouldAddEscaping($orig))) {
509 509
             $filters[] = "esc({$context})";
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             }
532 532
         }
533 533
         // No pipes, then we know we need to escape
534
-        elseif (! str_contains($key, '|')) {
534
+        elseif (!str_contains($key, '|')) {
535 535
             $escape = 'html';
536 536
         }
537 537
         // If there's a `noescape` then we're definitely false.
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             $escape = false;
540 540
         }
541 541
         // If no `esc` filter is found, then we'll need to add one.
542
-        elseif (! preg_match('/\s+esc/u', $key)) {
542
+        elseif (!preg_match('/\s+esc/u', $key)) {
543 543
             $escape = 'html';
544 544
         }
545 545
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
             preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/u', $filter, $param);
559 559
 
560 560
             // Remove the () and spaces to we have just the parameter left
561
-            $param = ! empty($param) ? trim($param[0], '() ') : null;
561
+            $param = !empty($param) ? trim($param[0], '() ') : null;
562 562
 
563 563
             // Params can be separated by commas to allow multiple parameters for the filter
564 564
             if ($param !== null && $param !== '' && $param !== '0') {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
             $filter = $param !== [] ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
577 577
 
578 578
             $this->config['filters'] ??= [];
579
-            if (! array_key_exists($filter, $this->config['filters'])) {
579
+            if (!array_key_exists($filter, $this->config['filters'])) {
580 580
                 continue;
581 581
             }
582 582
 
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
              *   $matches[1] = all parameters string in opening tag
614 614
              *   $matches[2] = content between the tags to send to the plugin.
615 615
              */
616
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
616
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
617 617
                 continue;
618 618
             }
619 619
 
Please login to merge, or discard this patch.