2

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.

1 Answer 1

5

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)

Sign up to request clarification or add additional context in comments.

2 Comments

Perfect, thanks. Ironic that developers that create software used for documenting code don't document their code very well.. :)
Actually, they do: manual.phpdoc.org/HTMLframesConverter/default and click on @param

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.