function barfoo(): int { /* ... */ } if (!is_int(barfoo())) { throw new Exception("Not an integer."); // this will also never happen }