HH\Pair::toMap

Returns an integer-keyed Map based on the elements of the current Pair.

Description

public function toMap(): Map<int,mixed>

Returns an integer-keyed Map based on the elements of the current Pair.

The keys are 0 and 1.

Return Values

Examples

<?hh

namespace Hack\UserDocumentation\API\Examples\Pair\ToMap;

$p = Pair {'foo', -1.5};

$map = $p->toMap();

var_dump($map instanceof \HH\Map);
var_dump($map);
Output
bool(true)
object(HH\Map)#2 (2) {
  [0]=>
  string(3) "foo"
  [1]=>
  float(-1.5)
}