This is what are you looking for ?
interface CommandInterface
{
}
class Dummy
{
public function execute(
CommandInterface $command,
$when = 'now',
$delayed = true,
$append = null
) {
//
}
}
$reflector = new \ReflectionClass('Dummy');
foreach($reflector->getMethod('execute')->getParameters() as $param)
{
$type = ($param->getClass()) ?
$param->getClass()->name :
gettype($param->getDefaultValue());
echo sprintf('Parameter "%s" of type "%s"'.PHP_EOL, $param->getName(), $type);
}
Output:
Parameter "command" of type "CommandInterface"
Parameter "when" of type "string"
Parameter "delayed" of type "boolean"
Parameter "append" of type "NULL"