Add Command->parameters() method to introspect arguments

This commit is contained in:
2025-01-17 01:05:58 +01:00
parent bf8e95561e
commit 474ccbb012
2 changed files with 39 additions and 1 deletions

View File

@ -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());
}
}