문제

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!

도움이 되었습니까?

해결책

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 */
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top