Add Command->parameters() method to introspect arguments
This commit is contained in:
@ -26,4 +26,14 @@ class CommandTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals(true, $hit);
|
||||
}
|
||||
|
||||
}
|
||||
public function testCommandReflection()
|
||||
{
|
||||
$command = new Command("test", function (string $a, ?int $b, bool $c = false) { });
|
||||
$expect = [
|
||||
'a' => 'string',
|
||||
'b' => 'int',
|
||||
'c' => '?bool'
|
||||
];
|
||||
$this->assertEquals($expect, $command->parameters());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user