Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 1, 2019
1 parent 3512f78 commit c7a52f3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,17 @@ public function command(string $name, $handler = null, $option = null)
return $this;
}

// allow define aliases in Command class by Command::aliases()
if ($aliases = $handler::aliases()) {
$option['aliases'] = isset($option['aliases']) ? \array_merge($option['aliases'], $aliases) : $aliases;
}
} elseif (!\is_object($handler) || !\method_exists($handler, '__invoke')) {
Helper::throwInvalidArgument(
'The console command handler must is an subclass of %s OR a Closure OR a object have method __invoke()',
Command::class
);
}

// allow define aliases in Command class by Command::aliases()
if ($aliases = $handler::aliases()) {
$option['aliases'] = isset($option['aliases']) ? \array_merge($option['aliases'], $aliases) : $aliases;
}

// is an class name string
$this->commands[$name] = $handler;

Expand Down

0 comments on commit c7a52f3

Please sign in to comment.