Passed
Push — main ( 7d6b92...fe1e39 )
by Dimitri
03:54
created
src/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $this->_streamMode   = $options['streamMode'] ?? $this->_streamMode;
460 460
 
461 461
         if (isset($options['stream'])) {
462
-            if (! $options['stream'] instanceof StreamInterface) {
462
+            if (!$options['stream'] instanceof StreamInterface) {
463 463
                 throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface');
464 464
             }
465 465
             $this->stream = $options['stream'];
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             $this->_setStatus($options['status']);
476 476
         }
477 477
 
478
-        if (! isset($options['charset'])) {
478
+        if (!isset($options['charset'])) {
479 479
             $options['charset'] = config('app.charset');
480 480
         }
481 481
         $this->_charset = $options['charset'];
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $charset = true;
524 524
         }
525 525
 
526
-        if ($charset && ! str_contains($type, ';')) {
526
+        if ($charset && !str_contains($type, ';')) {
527 527
             $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}");
528 528
         } else {
529 529
             $this->_setHeader('Content-Type', $type);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     protected function _clearHeader(string $header): void
604 604
     {
605 605
         $normalized = strtolower($header);
606
-        if (! isset($this->headerNames[$normalized])) {
606
+        if (!isset($this->headerNames[$normalized])) {
607 607
             return;
608 608
         }
609 609
         $original = $this->headerNames[$normalized];
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             throw HttpException::invalidStatusCode($code);
671 671
         }
672 672
 
673
-        if (! array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
673
+        if (!array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
674 674
             throw HttPException::unkownStatusCode($code);
675 675
         }
676 676
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
         if ($mapped) {
764 764
             return is_array($mapped) ? current($mapped) : $mapped;
765 765
         }
766
-        if (! str_contains($contentType, '/')) {
766
+        if (!str_contains($contentType, '/')) {
767 767
             throw new InvalidArgumentException(sprintf('`%s` est un content type invalide.', $contentType));
768 768
         }
769 769
 
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
      */
847 847
     public function withCache($since, $time = '+1 day'): static
848 848
     {
849
-        if (! is_int($time)) {
849
+        if (!is_int($time)) {
850 850
             $time = strtotime($time);
851 851
             if ($time === false) {
852 852
                 throw new InvalidArgumentException(
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
      */
1315 1315
     public function getCookie(string $name): ?array
1316 1316
     {
1317
-        if (! $this->hasCookie($name)) {
1317
+        if (!$this->hasCookie($name)) {
1318 1318
             return null;
1319 1319
         }
1320 1320
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
      */
1327 1327
     public function hasCookie(string $name, ?string $value = null): bool
1328 1328
     {
1329
-        if (! $this->_cookies->has($name)) {
1329
+        if (!$this->_cookies->has($name)) {
1330 1330
             return false;
1331 1331
         }
1332 1332
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
         $extension = strtolower($file->getExtension());
1405 1405
         $mapped    = $this->getMimeType($extension);
1406
-        if ((! $extension || ! $mapped) && $options['download'] === null) {
1406
+        if ((!$extension || !$mapped) && $options['download'] === null) {
1407 1407
             $options['download'] = true;
1408 1408
         }
1409 1409
 
@@ -1465,12 +1465,12 @@  discard block
 block discarded – undo
1465 1465
         if (str_contains($path, '../') || str_contains($path, '..\\')) {
1466 1466
             throw new LoadException('The requested file contains `..` and will not be read.');
1467 1467
         }
1468
-        if (! is_file($path)) {
1468
+        if (!is_file($path)) {
1469 1469
             $path = APP_PATH . $path;
1470 1470
         }
1471 1471
 
1472 1472
         $file = new SplFileInfo($path);
1473
-        if (! $file->isFile() || ! $file->isReadable()) {
1473
+        if (!$file->isFile() || !$file->isReadable()) {
1474 1474
             if (on_dev()) {
1475 1475
                 throw new LoadException(sprintf('The requested file %s was not found or not readable', $path));
1476 1476
             }
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 array[]|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 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/Http/Concerns/InteractsWithInput.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $input = $this->all();
88 88
 
89 89
         foreach ($keys as $value) {
90
-            if (! Arr::has($input, $value)) {
90
+            if (!Arr::has($input, $value)) {
91 91
                 return false;
92 92
             }
93 93
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $keys = is_array($key) ? $key : func_get_args();
150 150
 
151 151
         foreach ($keys as $value) {
152
-            if (! $this->isEmptyString($value)) {
152
+            if (!$this->isEmptyString($value)) {
153 153
                 return false;
154 154
             }
155 155
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     {
199 199
         $keys = is_array($key) ? $key : func_get_args();
200 200
 
201
-        return ! $this->has($keys);
201
+        return !$this->has($keys);
202 202
     }
203 203
 
204 204
     /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $value = $this->input($key);
228 228
 
229
-        return ! is_bool($value) && ! is_array($value) && trim((string) $value) === '';
229
+        return !is_bool($value) && !is_array($value) && trim((string) $value) === '';
230 230
     }
231 231
 
232 232
     /**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $input = array_replace_recursive($this->input(), $this->allFiles());
248 248
 
249
-        if (! $keys) {
249
+        if (!$keys) {
250 250
             return $input;
251 251
         }
252 252
 
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
     public function enum(string $key, $enumClass)
342 342
     {
343 343
         if ($this->isNotFilled($key)
344
-            || ! function_exists('enum_exists')
345
-            || ! enum_exists($enumClass)
346
-            || ! method_exists($enumClass, 'tryFrom')) {
344
+            || !function_exists('enum_exists')
345
+            || !enum_exists($enumClass)
346
+            || !method_exists($enumClass, 'tryFrom')) {
347 347
             return null;
348 348
         }
349 349
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
      */
458 458
     public function hasFile(string $key): bool
459 459
     {
460
-        if (! is_array($files = $this->file($key))) {
460
+        if (!is_array($files = $this->file($key))) {
461 461
             $files = [$files];
462 462
         }
463 463
 
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
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $this->cookies = $config['cookies'];
232 232
 
233 233
         if (isset($config['uri'])) {
234
-            if (! $config['uri'] instanceof UriInterface) {
234
+            if (!$config['uri'] instanceof UriInterface) {
235 235
                 throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class);
236 236
             }
237 237
             $uri = $config['uri'];
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $this->stream = $stream;
267 267
 
268 268
         $post = $config['post'];
269
-        if (! (is_array($post) || is_object($post) || $post === null)) {
269
+        if (!(is_array($post) || is_object($post) || $post === null)) {
270 270
             throw new InvalidArgumentException(sprintf(
271 271
                 'La clé `post` doit être un tableau, un objet ou null. On a obtenu `%s` à la place.',
272 272
                 get_debug_type($post)
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
         }
450 450
 
451 451
         $type = strtolower($type);
452
-        if (! isset(static::$_detectors[$type])) {
452
+        if (!isset(static::$_detectors[$type])) {
453 453
             return false;
454 454
         }
455 455
         if ($args) {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
     public function isAll(array $types): bool
602 602
     {
603 603
         foreach ($types as $type) {
604
-            if (! $this->is($type)) {
604
+            if (!$this->is($type)) {
605 605
                 return false;
606 606
             }
607 607
         }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
     protected function normalizeHeaderName(string $name): string
706 706
     {
707 707
         $name = str_replace('-', '_', strtoupper($name));
708
-        if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
708
+        if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
709 709
             $name = 'HTTP_' . $name;
710 710
         }
711 711
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     {
892 892
         $new = clone $this;
893 893
 
894
-        if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
894
+        if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
895 895
             throw new InvalidArgumentException(sprintf(
896 896
                 'Méthode HTTP non prise en charge "%s" fournie',
897 897
                 $method
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
                 }
1154 1154
             }
1155 1155
 
1156
-            if (! isset($accept[$prefValue])) {
1156
+            if (!isset($accept[$prefValue])) {
1157 1157
                 $accept[$prefValue] = [];
1158 1158
             }
1159 1159
             if ($prefValue) {
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
         if ($name === null) {
1232 1232
             return $this->data;
1233 1233
         }
1234
-        if (! is_array($this->data)) {
1234
+        if (!is_array($this->data)) {
1235 1235
             return $default;
1236 1236
         }
1237 1237
 
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
      */
1372 1372
     public function withProtocolVersion(string $version): static
1373 1373
     {
1374
-        if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1374
+        if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1375 1375
             throw new InvalidArgumentException(sprintf('Version de protocole `%s` non prise en charge fournie.', $version));
1376 1376
         }
1377 1377
         $new           = clone $this;
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
     public function getEnv(string $key, ?string $default = null): ?string
1394 1394
     {
1395 1395
         $key = strtoupper($key);
1396
-        if (! array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) {
1396
+        if (!array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) {
1397 1397
             $this->_environment[$key] = env($key, $default);
1398 1398
         }
1399 1399
 
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
         $file = Arr::get($this->uploadedFiles, $path);
1611 1611
         if (is_array($file)) {
1612 1612
             foreach ($file as $f) {
1613
-                if (! ($f instanceof UploadedFile)) {
1613
+                if (!($f instanceof UploadedFile)) {
1614 1614
                     return null;
1615 1615
                 }
1616 1616
             }
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
             return $file;
1619 1619
         }
1620 1620
 
1621
-        if (! ($file instanceof UploadedFileInterface)) {
1621
+        if (!($file instanceof UploadedFileInterface)) {
1622 1622
             return null;
1623 1623
         }
1624 1624
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
                 continue;
1667 1667
             }
1668 1668
 
1669
-            if (! $file instanceof UploadedFileInterface) {
1669
+            if (!$file instanceof UploadedFileInterface) {
1670 1670
                 throw new InvalidArgumentException("Fichier invalide à `{$path}{$key}`");
1671 1671
             }
1672 1672
         }
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
         }
1718 1718
 
1719 1719
         $host = $uri->getHost();
1720
-        if (! $host) {
1720
+        if (!$host) {
1721 1721
             return $new;
1722 1722
         }
1723 1723
         $port = $uri->getPort();
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
         $validLocales = config('app.supported_locales');
1826 1826
         // S'il ne s'agit pas d'un paramètre régional valide, définissez-le
1827 1827
         // aux paramètres régionaux par défaut du site.
1828
-        if (! in_array($locale, $validLocales, true)) {
1828
+        if (!in_array($locale, $validLocales, true)) {
1829 1829
             $locale = config('app.language');
1830 1830
         }
1831 1831
 
Please login to merge, or discard this patch.
src/Http/ServerRequestFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             $override = true;
97 97
         }
98 98
 
99
-        if ($override && ! in_array($request->getMethod(), ['PUT', 'POST', 'DELETE', 'PATCH'], true)) {
99
+        if ($override && !in_array($request->getMethod(), ['PUT', 'POST', 'DELETE', 'PATCH'], true)) {
100 100
             $parsedBody = [];
101 101
         }
102 102
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $request = $request->withUploadedFiles($files);
115 115
 
116 116
         $parsedBody = $request->getParsedBody();
117
-        if (! is_array($parsedBody)) {
117
+        if (!is_array($parsedBody)) {
118 118
             return $request;
119 119
         }
120 120
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         }
169 169
 
170 170
         // Si la valeur HTTP_AUTHORIZATION est déjà définie, ou si le callback n'est pas appelable, nous renvoyons les parameters server sans changements
171
-        if (isset($server['HTTP_AUTHORIZATION']) || ! is_callable($apacheRequestHeaderCallback)) {
171
+        if (isset($server['HTTP_AUTHORIZATION']) || !is_callable($apacheRequestHeaderCallback)) {
172 172
             return $server;
173 173
         }
174 174
 
Please login to merge, or discard this patch.
src/Http/CorsBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function isCorsRequest(ServerRequestInterface $request): bool
59 59
     {
60
-        return $request->hasHeader('Origin') && ! $this->isSameHost($request);
60
+        return $request->hasHeader('Origin') && !$this->isSameHost($request);
61 61
     }
62 62
 
63 63
     public function isPreflightRequest(ServerRequestInterface $request): bool
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return true;
95 95
         }
96 96
 
97
-        if (! $request->hasHeader('Origin')) {
97
+        if (!$request->hasHeader('Origin')) {
98 98
             return false;
99 99
         }
100 100
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function varyHeader(ResponseInterface $response, $header): ResponseInterface
129 129
     {
130
-        if (! $response->hasHeader('Vary')) {
130
+        if (!$response->hasHeader('Vary')) {
131 131
             $response = $response->withHeader('Vary', $header);
132
-        } elseif (! in_array($header, explode(', ', $response->getHeaderLine('Vary')), true)) {
132
+        } elseif (!in_array($header, explode(', ', $response->getHeaderLine('Vary')), true)) {
133 133
             $response = $response->withHeader('Vary', $response->getHeaderLine('Vary') . ', ' . $header);
134 134
         }
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
     protected function configureAllowedOrigin(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
140 140
     {
141
-        if ($this->options['allowedOrigins'] === true && ! $this->options['supportsCredentials']) {
141
+        if ($this->options['allowedOrigins'] === true && !$this->options['supportsCredentials']) {
142 142
             // Sûr+cacheable, tout autoriser
143 143
             $response = $response->withHeader('Access-Control-Allow-Origin', '*');
144 144
         } elseif ($this->isSingleOriginAllowed()) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     protected function isSingleOriginAllowed(): bool
160 160
     {
161
-        if ($this->options['allowedOrigins'] === true || ! empty($this->options['allowedOriginsPatterns'])) {
161
+        if ($this->options['allowedOrigins'] === true || !empty($this->options['allowedOriginsPatterns'])) {
162 162
             return false;
163 163
         }
164 164
 
Please login to merge, or discard this patch.
src/Middlewares/Cors.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
             $response = $this->cors->varyHeader($response, 'Access-Control-Request-Method');
139 139
         }
140 140
 
141
-        if (! $response->hasHeader('Access-Control-Allow-Origin')) {
141
+        if (!$response->hasHeader('Access-Control-Allow-Origin')) {
142 142
             $response = $this->cors->addActualRequestHeaders($request, $response);
143 143
         }
144 144
 
Please login to merge, or discard this patch.
src/Facades/Facade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
             $accessor = service($accessor);
24 24
         }
25 25
 
26
-        if (! is_object($accessor)) {
26
+        if (!is_object($accessor)) {
27 27
             throw new InvalidArgumentException(sprintf('La methode `%s::accessor` doit retourner un object ou le nom d\'un service.', static::class));
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/Mail/Mail.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected function factory(): AbstractAdapter
114 114
     {
115
-        if (! empty($this->adapter)) {
115
+        if (!empty($this->adapter)) {
116 116
             return $this->adapter;
117 117
         }
118 118
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             $handler = static::$validHandlers[$handler];
127 127
         }
128 128
 
129
-        if (! class_exists($handler)) {
129
+        if (!class_exists($handler)) {
130 130
             throw new InvalidArgumentException(lang('Mail.invalidHandler', [$handler]));
131 131
         }
132 132
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $debug = on_dev();
136 136
         }
137 137
 
138
-        if (! is_subclass_of($handler, AbstractAdapter::class)) {
138
+        if (!is_subclass_of($handler, AbstractAdapter::class)) {
139 139
             throw new InvalidArgumentException(lang('Mail.handlerMustExtendClass', [$handler, AbstractAdapter::class]));
140 140
         }
141 141
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
         $path = '';
342 342
 
343 343
         // N'est-il pas namespaced ? on cherche le dossier en fonction du parametre "view_base"
344
-        if (! str_contains($view, '\\')) {
344
+        if (!str_contains($view, '\\')) {
345 345
             $path = $this->config['view_dir'] ?? '';
346
-            if (! empty($path)) {
346
+            if (!empty($path)) {
347 347
                 $path .= '/';
348 348
             }
349 349
         }
350 350
 
351 351
         $view = view($path . $view, $data);
352
-        if (! empty($this->config['template'])) {
352
+        if (!empty($this->config['template'])) {
353 353
             $view->layout($this->config['template']);
354 354
         }
355 355
 
Please login to merge, or discard this patch.