Test Failed
Pull Request — main (#59)
by Dimitri
06:14
created
src/Loader/DotEnv.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         foreach ($data as $key => $value) {
64 64
             $replacementKey = "\n{$key} = {$value}";
65
-            if (! str_contains($oldFileContents, $key)) {
65
+            if (!str_contains($oldFileContents, $key)) {
66 66
                 if (file_put_contents($this->path, $replacementKey, FILE_APPEND) === false) {
67 67
                     return false;
68 68
                 }
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
     public function parse(): ?array
130 130
     {
131 131
         // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs.
132
-        if (! is_file($this->path)) {
132
+        if (!is_file($this->path)) {
133 133
             return null;
134 134
         }
135 135
 
136 136
         // Assurez-vous que le fichier est lisible
137
-        if (! is_readable($this->path)) {
137
+        if (!is_readable($this->path)) {
138 138
             throw new InvalidArgumentException("Le fichier `.env` est n'est pas lisible: {$this->path}");
139 139
         }
140 140
 
141 141
         $vars = [];
142 142
 
143
-        $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
143
+        $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
144 144
 
145 145
         foreach ($lines as $line) {
146 146
             // C'est un commentaire?
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     protected function setVariable(string $name, string $value = '')
168 168
     {
169
-        if (! getenv($name, true)) {
169
+        if (!getenv($name, true)) {
170 170
             putenv("{$name}={$value}");
171 171
         }
172 172
         if (empty($_ENV[$name])) {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         if (str_contains($value, '$')) {
268 268
             $value = preg_replace_callback(
269 269
                 '/\${([a-zA-Z0-9_\.]+)}/',
270
-                function ($matchedPatterns) {
270
+                function($matchedPatterns) {
271 271
                     $nestedVariable = $this->getVariable($matchedPatterns[1]);
272 272
 
273 273
                     if ($nestedVariable === null) {
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
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     public static function locator(bool $shared = true): LocatorInterface
303 303
     {
304 304
         if ($shared) {
305
-            if (! isset(static::$instances[Locator::class])) {
305
+            if (!isset(static::$instances[Locator::class])) {
306 306
                 $locator = new Locator(static::autoloader());
307 307
                 if (true === config('optimize.locator_cache_enabled', false)) {
308 308
                     static::$instances[Locator::class] = new LocatorCached($locator, new FileVarExportHandler(FRAMEWORK_STORAGE_PATH . 'cache'));
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 
632 632
     protected static function cacheServices(): void
633 633
     {
634
-        if (! static::$discovered) {
634
+        if (!static::$discovered) {
635 635
             $locator = static::locator();
636 636
             $files   = $locator->search('Config/Services');
637 637
 
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
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function register(): void
58 58
     {
59
-        if (! $this->debugger) {
59
+        if (!$this->debugger) {
60 60
             return;
61 61
         }
62 62
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function registerHttpErrorsHandler(): self
100 100
     {
101
-        $this->debugger->pushHandler(function (Throwable $exception, InspectorInterface $inspector, RunInterface $run): int {
101
+        $this->debugger->pushHandler(function(Throwable $exception, InspectorInterface $inspector, RunInterface $run): int {
102 102
             $exception      = $this->prepareException($exception);
103 103
             $exception_code = $exception->getCode();
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 $run->sendHttpCode($exception_code);
107 107
             }
108 108
 
109
-            if (true === $this->config->log && ! in_array($exception_code, $this->config->ignore_codes, true)) {
109
+            if (true === $this->config->log && !in_array($exception_code, $this->config->ignore_codes, true)) {
110 110
                 service('logger')->error($exception);
111 111
             }
112 112
 
Please login to merge, or discard this patch.
src/Security/Hashing/Hasher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
             throw HashingException::noDriverRequested();
115 115
         }
116 116
 
117
-        if (! in_array($this->driver, $this->drivers, true)) {
117
+        if (!in_array($this->driver, $this->drivers, true)) {
118 118
             throw HashingException::unKnownHandler($this->driver);
119 119
         }
120 120
 
Please login to merge, or discard this patch.
src/Security/Hashing/Handlers/Argon2IdHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
             return false;
32 32
         }
33 33
 
34
-        if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) {
34
+        if ($this->verifyAlgorithm && !$this->isUsingCorrectAlgorithm($hashedValue)) {
35 35
             throw new RuntimeException("Ce mot de passe n'utilise pas l'algorithme Argon2id.");
36 36
         }
37 37
 
Please login to merge, or discard this patch.
src/Security/Hashing/Handlers/ArgonHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             return false;
93 93
         }
94 94
 
95
-        if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) {
95
+        if ($this->verifyAlgorithm && !$this->isUsingCorrectAlgorithm($hashedValue)) {
96 96
             throw new RuntimeException("Ce mot de passe n'utilise pas l'algorithme Argon2i.");
97 97
         }
98 98
 
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
         ['options' => $options] = $this->info($hashedValue);
138 138
 
139 139
         if (
140
-            ! is_int($options['memory_cost'] ?? null)
141
-            || ! is_int($options['time_cost'] ?? null)
142
-            || ! is_int($options['threads'] ?? null)
140
+            !is_int($options['memory_cost'] ?? null)
141
+            || !is_int($options['time_cost'] ?? null)
142
+            || !is_int($options['threads'] ?? null)
143 143
         ) {
144 144
             return false;
145 145
         }
146 146
 
147
-        return ! (
147
+        return !(
148 148
             $options['memory_cost'] > $this->memory
149 149
             || $options['time_cost'] > $this->time
150 150
             || $options['threads'] > $this->threads
Please login to merge, or discard this patch.
src/Security/Hashing/Handlers/BcryptHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             return false;
71 71
         }
72 72
 
73
-        if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) {
73
+        if ($this->verifyAlgorithm && !$this->isUsingCorrectAlgorithm($hashedValue)) {
74 74
             throw new RuntimeException("Ce mot de passe n'utilise pas l'algorithme Bcrypt.");
75 75
         }
76 76
 
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
     {
113 113
         ['options' => $options] = $this->info($hashedValue);
114 114
 
115
-        if (! is_int($options['cost'] ?? null)) {
115
+        if (!is_int($options['cost'] ?? null)) {
116 116
             return false;
117 117
         }
118 118
 
119
-        return ! ($options['cost'] > $this->rounds);
119
+        return !($options['cost'] > $this->rounds);
120 120
     }
121 121
 
122 122
     /**
Please login to merge, or discard this patch.
src/Security/Encryption/Encryption.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'Sodium' => extension_loaded('sodium') && version_compare(SODIUM_LIBRARY_VERSION, '1.0.14', '>='),
83 83
         ];
84 84
 
85
-        if (! in_array($this->driver, $this->drivers, true) || (array_key_exists($this->driver, $this->handlers) && ! $this->handlers[$this->driver])) {
85
+        if (!in_array($this->driver, $this->drivers, true) || (array_key_exists($this->driver, $this->handlers) && !$this->handlers[$this->driver])) {
86 86
             throw EncryptionException::noHandlerAvailable($this->driver);
87 87
         }
88 88
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function decrypt(string $data, array|string|null $params = null): string
102 102
     {
103 103
         if (function_exists('mb_check_encoding')) {
104
-            $data = ! mb_check_encoding($data, 'UTF-8') ? $data : base64_decode($data, true);
104
+            $data = !mb_check_encoding($data, 'UTF-8') ? $data : base64_decode($data, true);
105 105
         }
106 106
 
107 107
         return $this->encrypter()->decrypt($data, $params);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             throw EncryptionException::noDriverRequested();
133 133
         }
134 134
 
135
-        if (! in_array($this->driver, $this->drivers, true)) {
135
+        if (!in_array($this->driver, $this->drivers, true)) {
136 136
             throw EncryptionException::unKnownHandler($this->driver);
137 137
         }
138 138
 
Please login to merge, or discard this patch.
src/View/Parser.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $file = $this->viewPath . $view;
98 98
 
99
-        if (! is_file($file)) {
99
+        if (!is_file($file)) {
100 100
             $fileOrig = $file;
101 101
             $file     = $this->locator->locateFile($view, 'Views');
102 102
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         foreach ($matches as $match) {
300 300
             // Loop over each piece of $data, replacing
301 301
             // its contents so that we know what to replace in parse()
302
-            $str = '';  // holds the new contents for this tag pair.
302
+            $str = ''; // holds the new contents for this tag pair.
303 303
 
304 304
             foreach ($data as $row) {
305 305
                 // Objects that have a `toArray()` method should be
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
                 // Now replace our placeholders with the new content.
343 343
                 foreach ($temp as $pattern => $content) {
344
-                    $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern]));
344
+                    $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern]));
345 345
                 }
346 346
 
347 347
                 $str .= $out;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
     protected function replaceSingle(array|string $pattern, string $content, string $template, bool $escape = false): string
500 500
     {
501 501
         // Replace the content in the template
502
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape): string {
502
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape): string {
503 503
             // Check for {! !} syntax to not escape this one.
504 504
             if (
505 505
                 str_starts_with($matches[0], $this->leftDelimiter . '!')
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
         // Our regex earlier will leave all chained values on a single line
523 523
         // so we need to break them apart so we can apply them all.
524
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
524
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
525 525
 
526 526
         if ($escape && $filters === [] && ($context = $this->shouldAddEscaping($orig))) {
527 527
             $filters[] = "esc({$context})";
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             }
550 550
         }
551 551
         // No pipes, then we know we need to escape
552
-        elseif (! str_contains($key, '|')) {
552
+        elseif (!str_contains($key, '|')) {
553 553
             $escape = 'html';
554 554
         }
555 555
         // If there's a `noescape` then we're definitely false.
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             $escape = false;
558 558
         }
559 559
         // If no `esc` filter is found, then we'll need to add one.
560
-        elseif (! preg_match('/\s+esc/u', $key)) {
560
+        elseif (!preg_match('/\s+esc/u', $key)) {
561 561
             $escape = 'html';
562 562
         }
563 563
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             $filter = $param !== [] ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
595 595
 
596 596
             $this->config['filters'] ??= [];
597
-            if (! array_key_exists($filter, $this->config['filters'])) {
597
+            if (!array_key_exists($filter, $this->config['filters'])) {
598 598
                 continue;
599 599
             }
600 600
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
              *   $matches[1] = all parameters string in opening tag
632 632
              *   $matches[2] = content between the tags to send to the plugin.
633 633
              */
634
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
634
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
635 635
                 continue;
636 636
             }
637 637
 
Please login to merge, or discard this patch.