Search code examples
phpphpdoc

How to use different/multiple @param


I have a method in a helper class to do some repetitive tasks. I have to pass to it different classes.

Something like

@param Entity $entity || Entity2 $entity etc..

I tried it like this but it sees only first of classes. Others, above in use statment section are unused?

How to do that?


Solution

  • You can use a pipe in the docblock like this:

    /**
     * @param Entity|Entity2 $entity
     */