Frage

Quoting http://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_tags.var.pkg.html:

The datatype should be a valid PHP type (int, string, bool, etc), a class name for the type of object, or simply "mixed". phpDocumentor will display the optional description unmodified, and defaults to "mixed" if the datatype is not present

So if the variable was supposed to be a Crypt_RSA object you'd have @var Crypt_RSA, per that, but what if it could be either a Crypt_RSA object or a Crypt_DSA object? At that point should you say @var mixed? It seems like at that point it's a bit misleading because mixed, to me, implies that it supports primitives even when it might not.

Any ideas?

Thanks!

War es hilfreich?

Lösung

You can indicate different possible return types by delimiting them with pipes:

/** @var Crypt_RSA|Crypt_DSA a Crypt_* object, of either RSA or DSA subtype */
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top