Skip to content

Parameter type hint ignored #81

@donquixote

Description

@donquixote
class C {
  function foo(MyArgInterface $x) {
  }
}

Here it seems that phpDocumentor does not detect the "MyArgInterface" argument type.
nikic's php-parser does correctly detect the type, but then here in \phpDocumentor\Reflection\Php\Factory\Argument::create():

    return new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic);

This should be changed to

    $argDescriptor = new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic);
    if (!empty($object->type)) {
        $argDescriptor->addType((string)$object->type);
    }
    return $argDescriptor;

So it adds the type.

Not sure what other consequences this would have, so I am just proposing this for discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions