HH\Lib\C\firstx

This API is part of the Hack Standard Library, not HHVM itself.

Returns the first element of the given Traversable, or throws if the Traversable is empty

namespace HH\Lib\C;

function firstx<T>(
    Traversable<T> $traversable,
): T;
  • For possibly empty Traversables, see C\first.
  • For possibly null Traversables, see C\nfirst.
  • For single-element Traversables, see C\onlyx.
  • For Awaitables that yield Traversables, see C\firstx_async.

Parameters