src/Set.php
public function union(Set $set): Set
    {
        $union = new self();

        foreach ($this as $value) {
            $union->add($value);
        }

        foreach ($set as $value) {
            $union->add($value);
        }

        return $union;
    }
public function union(Set $set): Set
    {
        $union = new self();

        foreach ($this as $value) {
            $union->add($value);
        }

        foreach ($set as $value) {
            $union->add($value);
        }

        return $union;
    }
public function union ( Set $ set ) : Set { $ union = new self ( ) ; foreach ( $ this as $ value ) { $ union -> add ( $ value ) ; } foreach ( $ set as $ value ) { $ union -> add ( $ value ) ; } return $ union ; }
Creates a new set that contains the values of this set as well as the
values of another set.

Formally: A ∪ B = {x: x ∈ A ∨ x ∈ B}

@param Set $set

@return Set
Creates a new set that contains the values of this set as well as the values of another set .