HH\Lib\Legacy_FIXME\int_cast_for_switch

The rules for coercion when doing a comparison where the RHS is an int are complicated and it's not sufficient to just do straight casts on $value

namespace HH\Lib\Legacy_FIXME;

function int_cast_for_switch(
  mixed $value,
  ?arraykey $first_truthy = NULL,
): int;

Instead, we need to do some data tracking to convert the input to specifics values to match specific cases under different circumstances.

arraykey instead of int second arg courtesy of non-transparent enums

Parameters

  • mixed $value
  • ?arraykey $first_truthy = NULL

Returns

  • int