public function assertType()

in src/Assert.hack [367:388]


  public function assertType(
    string $expected,
    mixed $actual,
    string $message = '',
  ): void {
    if (is_type($expected)) {
      if ((new Constraint\IsType($expected))->matches($actual)) {
        return;
      }
      throw new ExpectationFailedException(
        Str\format(
          "%s\nFailed asserting that %s is type %s",
          $message,
          \var_export($actual, true),
          $expected,
        ),
      );
    } else if (\class_exists($expected) || \interface_exists($expected)) {
      $this->assertInstanceOf($expected, $actual, $message);
    }
    throw new InvalidArgumentException('Invalid type');
  }