Skip to content

Commit

Permalink
Bail early
Browse files Browse the repository at this point in the history
Also, use whitespace to make `return` statements more visible.
  • Loading branch information
ravage84 authored Dec 5, 2024
1 parent f209d07 commit 8d41a04
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/MigrationsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,28 @@ public function console(CommandCollection $commands): CommandCollection
$commands->addMany($found);

return $commands;
} else {
if (class_exists(SimpleBakeCommand::class)) {
$found = $commands->discoverPlugin($this->getName());

return $commands->addMany($found);
}
$found = [];
// Convert to a method and use config to toggle command names.
foreach ($this->migrationCommandsList as $class) {
$name = $class::defaultName();
// If the short name has been used, use the full name.
// This allows app commands to have name preference.
// and app commands to overwrite migration commands.
if (!$commands->has($name)) {
$found[$name] = $class;
}
// full name
$found['migrations.' . $name] = $class;
}
}

Check failure on line 134 in src/MigrationsPlugin.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Whitespace found at end of line
if (class_exists(SimpleBakeCommand::class)) {
$found = $commands->discoverPlugin($this->getName());

return $commands->addMany($found);
}

$found = [];
// Convert to a method and use config to toggle command names.
foreach ($this->migrationCommandsList as $class) {
$name = $class::defaultName();
// If the short name has been used, use the full name.
// This allows app commands to have name preference.
// and app commands to overwrite migration commands.
if (!$commands->has($name)) {
$found[$name] = $class;
}
// full name
$found['migrations.' . $name] = $class;
}

return $commands->addMany($found);
}
}

0 comments on commit 8d41a04

Please sign in to comment.