@@ -41,7 +41,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -66,7 +66,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -161,7 +161,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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é.' |
@@ -84,14 +84,14 @@ |
||
| 84 | 84 | $command = is_string($command) ? $command : 'command:name'; |
| 85 | 85 | $type = is_string($type) ? $type : 'basic'; |
| 86 | 86 | |
| 87 | - if (! in_array($type, ['basic', 'generator'], true)) { |
|
| 87 | + if (!in_array($type, ['basic', 'generator'], true)) { |
|
| 88 | 88 | // @codeCoverageIgnoreStart |
| 89 | 89 | $type = $this->choice(lang('CLI.generator.commandType'), ['basic', 'generator'], 'basic'); |
| 90 | 90 | $this->eol(); |
| 91 | 91 | // @codeCoverageIgnoreEnd |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! is_string($group)) { |
|
| 94 | + if (!is_string($group)) { |
|
| 95 | 95 | $group = $type === 'generator' ? config('app.name') . ':Generateurs' : config('app.name'); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -158,7 +158,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |