Zitat von Tyson Andre <tysona...@gmail.com>:
For the sake of unambiguousity I'd prefer the latter, i.e. forcing to use brackets. This would also solve the first question.
@param string|array|\DateTime|null $arg
/**
* @param ?string[] $strings
*/
function nullOrArrayOfString(?array $strings) {
}
/**
* @param WHAT SHOULD I WRITE HERE ? $stringsOrNulls
*/
function arrayOfStringOrNull(array $stringsOrNulls) {
}
nullOrArrayOfString(null);
nullOrArrayOfString(['foo', 'bar']);
nullOrArrayOfString(['foo', null]); // Invalid call !
arrayOfStringOrNull(null); // Invalid call !
arrayOfStringOrNull(['foo', 'bar']);
arrayOfStringOrNull(['foo', null]);
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/c0ba7fdf-5c45-493c-8f66-ff9bccbd7a14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.