public function getUnionType() : UnionType { return $this->variable->getUnionType(); }
/** * If this parameter is variadic (e.g. `DateTime ...$args`), * then this returns the corresponding array type(s) of $args. (e.g. `DateTime[]`) * NOTE: For variadic arguments, this is a temporary variable. * Modifying this won't result in persistent changes. * (TODO(Issue #376) : We will probably want to be able to modify the underlying variable, * e.g. by creating `class UnionTypeGenericArrayView extends UnionType`. * Otherwise, type inference of `...$args` based on the function source * will be less effective without phpdoc types.) * * @override * TODO: Should the return value be set up in the constructor instead? */ public function getUnionType() : UnionType { return $this->isVariadic() ? parent::getUnionType()->asGenericArrayTypes() : parent::getUnionType(); }