Phan\Language\Element\Parameter::asNonVariadic PHP Method

asNonVariadic() public method

If this parameter is variadic (e.g. DateTime ...$args), then this would return a parameter with the type of the elements (e.g. DateTime) If this parameter is not variadic, returns $this.
public asNonVariadic ( ) : static
return static (usually $this)
    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));
    }