HH\Pair::toSet
Returns a Set with the values of the current Pair
public function toSet(): Set<arraykey, mixed>;
Returns
Set<arraykey,mixed>- aSetwith the current values of the currentPair.
Examples
This example shows that converting a Pair to a Set also removes duplicate values:
// This Pair contains 'foo' twice
$p = Pair {'foo', 'foo'};
$s = $p->toSet();
\var_dump($s);
This example shows that converting a Pair to a Set will throw a fatal error if the Pair contains a value that's not a string or an int:
$p = Pair {'foo', -1.5};
/* HH_FIXME[4323] Fatal error will be thrown here */
$s = $p->toSet();
\var_dump($s);