Allow providing manual signature hint to commands

This commit is contained in:
2025-01-18 21:58:51 +01:00
parent 0bca797e8d
commit 6671ec3eac
2 changed files with 11 additions and 3 deletions

View File

@ -19,10 +19,13 @@ class Command
/** @var callable $handler The handler */
private $handler;
public function __construct(string $name, callable $handler)
private ?array $signature;
public function __construct(string $name, callable $handler, ?array $signature = null)
{
$this->name = $name;
$this->handler = $handler;
$this->signature = $signature;
}
public function getName(): string
@ -66,5 +69,10 @@ class Command
return $args;
}
public function getSignature(): array
{
return $this->signature ?? $this->parameters();
}
}