public static function sum(...$values) : BigNumber
    {
        /** @var BigNumber|null $sum */
        $sum = null;

        foreach ($values as $value) {
            $value = static::of($value);

            if ($sum === null) {
                $sum = $value;
            } else {
                $sum = self::add($sum, $value);
            }
        }

        if ($sum === null) {
            throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.');
        }

        return $sum;
    }
public static function sum(...$values) : BigNumber
    {
        /** @var BigNumber|null $sum */
        $sum = null;

        foreach ($values as $value) {
            $value = static::of($value);

            if ($sum === null) {
                $sum = $value;
            } else {
                $sum = self::add($sum, $value);
            }
        }

        if ($sum === null) {
            throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.');
        }

        return $sum;
    }
public static function sum ( ... $ values ) : BigNumber { /** @var BigNumber|null $sum */ $ sum = null ; foreach ( $ values as $ value ) { $ value = static :: of ( $ value ) ; if ( $ sum === null ) { $ sum = $ value ; } else { $ sum = self :: add ( $ sum , $ value ) ; } } if ( $ sum === null ) { throw new \ InvalidArgumentException ( __METHOD__ . '() expects at least one value.' ) ; } return $ sum ; }
Returns the sum of the given values.

@param BigNumber|number|string ...$values The numbers to add. All the numbers need to be convertible
to an instance of the class this method is called on.

@return static The sum.

@throws \InvalidArgumentException If no values are given.
@throws MathException             If an argument is not valid.
Returns the sum of the given values .