function cast_for_arithmetic()

in src/legacy_fixme/coercions.php [64:72]


function cast_for_arithmetic(mixed $value)[]: dynamic {
  if ($value is null) {
    return 0;
  }
  if ($value is bool || $value is resource) {
    return (int)$value;
  }
  return $value is string ? \HH\str_to_numeric($value) ?? 0 : $value;
}