Naatan
Naatan

Reputation: 3444

phpDoc, class instance as @param?

When using phpdoc on a function I have an argument that always contains an instance of a class, is there any way to document this in phpdoc so that the generated phpdoc links to the given class?

Something like @param MyClass() $var.

I can't find any info on it in the documentation, in fact the documentation doesn't even mention objects (stdClass) type params, period.

Upvotes: 2

Views: 2791

Answers (1)

halfdan
halfdan

Reputation: 34204

You need to remove the parenthesis and it should work out of the box:

@param MyClass $var Parameter takes instance of MyClass

The formal syntax for this is:

@param type [$varname] description

Have a look at the documentation http://manual.phpdoc.org/HTMLframesConverter/default/ (you need to click on @param on the left)

Upvotes: 5

Related Questions