Test Failed
Push — main ( e1affe...2e6d72 )
by Dimitri
14:06
created
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 (empty($this->locator) && ! is_dir($this->viewPath)) {
89
+        if (empty($this->locator) && !is_dir($this->viewPath)) {
90 90
             $this->viewPath = '';
91 91
             $this->locator  = Services::locator();
92 92
         }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $ext ??= $this->ext;
262 262
 
263 263
         $viewPath = $options['viewPath'] ?? $this->viewPath;
264
-        if (! empty($viewPath)) {
264
+        if (!empty($viewPath)) {
265 265
             $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\'));
266 266
         } else {
267 267
             $file = $view;
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
 
270 270
         $file = Helpers::ensureExt($file, $ext);
271 271
 
272
-        if (! is_file($file) && $this->locator instanceof LocatorInterface) {
272
+        if (!is_file($file) && $this->locator instanceof LocatorInterface) {
273 273
             $file = $this->locator->locateFile($view, 'Views', $ext);
274 274
         }
275 275
 
276 276
         $file = realpath($file);
277 277
 
278 278
         // locateFile renverra une chaîne vide si le fichier est introuvable.
279
-        if (! is_file($file)) {
279
+        if (!is_file($file)) {
280 280
             throw ViewException::invalidFile($view);
281 281
         }
282 282
 
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
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
         $this->renderVars['file'] = $this->getRenderedFile($options, $this->renderVars['view'], $this->ext);
67 67
 
68
-        if (! empty($layout = $this->layout)) {
68
+        if (!empty($layout = $this->layout)) {
69 69
             if (empty(pathinfo($layout, PATHINFO_EXTENSION))) {
70 70
                 $layout .= '.' . $this->ext;
71 71
             }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $this->engine->assign($this->data);
76 76
 
77 77
         // Doit-on mettre en cache?
78
-        if (! empty($this->renderVars['options']['cache_name']) || ! empty($this->renderVars['options']['cache'])) {
78
+        if (!empty($this->renderVars['options']['cache_name']) || !empty($this->renderVars['options']['cache'])) {
79 79
             $this->enableCache();
80 80
             $this->engine->setCacheLifetime(60 * ($this->renderVars['options']['cache'] ?? 60));
81 81
             $this->engine->setCompileId($this->renderVars['options']['cache_name'] ?? null);
Please login to merge, or discard this patch.
src/View/Parser.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function setData(array $data = [], ?string $context = null): static
173 173
     {
174
-        if (! empty($context)) {
174
+        if (!empty($context)) {
175 175
             foreach ($data as $key => &$value) {
176 176
                 if (is_array($value)) {
177 177
                     foreach ($value as &$obj) {
@@ -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
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                     if (is_array($val)) {
304 304
                         $pair = $this->parsePair($key, $val, $match[1]);
305 305
 
306
-                        if (! empty($pair)) {
306
+                        if (!empty($pair)) {
307 307
                             $pairs[array_keys($pair)[0]] = true;
308 308
 
309 309
                             $temp = array_merge($temp, $pair);
@@ -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;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $content = (string) $content;
494 494
 
495 495
         // Replace the content in the template
496
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
496
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape) {
497 497
             // Check for {! !} syntax to not escape this one.
498 498
             if (
499 499
                 str_starts_with($matches[0], $this->leftDelimiter . '!')
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
         // Our regex earlier will leave all chained values on a single line
517 517
         // so we need to break them apart so we can apply them all.
518
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
518
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
519 519
 
520 520
         if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) {
521 521
             $filters[] = "esc({$context})";
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             }
544 544
         }
545 545
         // No pipes, then we know we need to escape
546
-        elseif (! str_contains($key, '|')) {
546
+        elseif (!str_contains($key, '|')) {
547 547
             $escape = 'html';
548 548
         }
549 549
         // If there's a `noescape` then we're definitely false.
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             $escape = false;
552 552
         }
553 553
         // If no `esc` filter is found, then we'll need to add one.
554
-        elseif (! preg_match('/\s+esc/u', $key)) {
554
+        elseif (!preg_match('/\s+esc/u', $key)) {
555 555
             $escape = 'html';
556 556
         }
557 557
 
@@ -570,10 +570,10 @@  discard block
 block discarded – undo
570 570
             preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/u', $filter, $param);
571 571
 
572 572
             // Remove the () and spaces to we have just the parameter left
573
-            $param = ! empty($param) ? trim($param[0], '() ') : null;
573
+            $param = !empty($param) ? trim($param[0], '() ') : null;
574 574
 
575 575
             // Params can be separated by commas to allow multiple parameters for the filter
576
-            if (! empty($param)) {
576
+            if (!empty($param)) {
577 577
                 $param = explode(',', $param);
578 578
 
579 579
                 // Clean it up
@@ -585,10 +585,10 @@  discard block
 block discarded – undo
585 585
             }
586 586
 
587 587
             // Get our filter name
588
-            $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
588
+            $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
589 589
 
590 590
             $this->config['filters'] ??= [];
591
-            if (! array_key_exists($filter, $this->config['filters'])) {
591
+            if (!array_key_exists($filter, $this->config['filters'])) {
592 592
                 continue;
593 593
             }
594 594
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
              *   $matches[1] = all parameters string in opening tag
628 628
              *   $matches[2] = content between the tags to send to the plugin.
629 629
              */
630
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
630
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
631 631
                 continue;
632 632
             }
633 633
 
Please login to merge, or discard this patch.
src/View/ViewDecoratorTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     protected function decorate(string $output): string
22 22
     {
23 23
         foreach (config('view.decorators') as $decorator) {
24
-            if (! is_subclass_of($decorator, ViewDecoratorInterface::class, true)) {
24
+            if (!is_subclass_of($decorator, ViewDecoratorInterface::class, true)) {
25 25
                 throw ViewException::invalidDecorator($decorator);
26 26
             }
27 27
 
Please login to merge, or discard this patch.
src/View/View.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         $data = array_merge(self::$shared, $data);
217 217
 
218
-        if (! on_test() && ! isset($data['errors'])) {
218
+        if (!on_test() && !isset($data['errors'])) {
219 219
             $data['errors'] = $this->setValidationErrors();
220 220
         }
221 221
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         if (is_string($errors)) {
247 247
             $errors = ['default' => $errors];
248 248
         }
249
-        if (! ($errors instanceof ErrorBag)) {
249
+        if (!($errors instanceof ErrorBag)) {
250 250
             $errors = new ErrorBag($errors);
251 251
         }
252 252
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
         $data = array_merge(self::$shared, $data);
286 286
 
287
-        if (! on_test() && ! isset($data['errors'])) {
287
+        if (!on_test() && !isset($data['errors'])) {
288 288
             $data['errors'] = $this->setValidationErrors();
289 289
         }
290 290
 
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
      */
343 343
     public function setAdapter(string $adapter, array $config = []): static
344 344
     {
345
-        if (! array_key_exists($adapter, self::$validAdapters)) {
345
+        if (!array_key_exists($adapter, self::$validAdapters)) {
346 346
             $adapter = 'native';
347 347
         }
348
-        if (empty($this->config['adapters']) || ! is_array($this->config['adapters'])) {
348
+        if (empty($this->config['adapters']) || !is_array($this->config['adapters'])) {
349 349
             $this->config['adapters'] = [];
350 350
         }
351 351
 
Please login to merge, or discard this patch.