public function asNonVariadic()
{
if (!$this->isVariadic()) {
return $this;
}
// TODO: Is it possible to cache this while maintaining correctness? PostOrderAnalysisVisitor clones the value to avoid it being reused.
//
// Also, figure out if the cloning still working correctly after this PR for fixing variadic args.
// create a single Parameter instance for analyzing callers
// of the corresponding method/function.
// e.g. $this->getUnionType() is of type T[]
// $this->non_variadic->getUnionType() is of type T
return new Parameter($this->getContext(), $this->getName(), $this->getVariadicElementUnionType(), Flags::bitVectorWithState($this->getFlags(), \ast\flags\PARAM_VARIADIC, false));
}