public static function isHHSpecific()

in src/api-gen/ScannedDefinitionFilters.php [28:77]


  public static function isHHSpecific(ScannedDefinition $def): bool {
    $normalized_name = $def->getName()
      |> Str\lowercase($$)
      |> Regex\replace($$, re"/[^a-z0-9]/", '-');

    if (
      $def is ScannedClassish &&
        !C\contains_key(self::getPHPList('classes'), $normalized_name) ||
      $def is ScannedFunction &&
        !C\contains_key(self::getPHPList('functions'), $normalized_name)
    ) {
      // Function/class does not exist in PHP.
      return true;
    }

    // At this point, we know the function/class exists in PHP, but the HHVM
    // version might be sufficiently different (e.g. uses generics) to warrant
    // inclusion in the HHVM docs anyway.

    if (C\contains_key($def->getAttributes(), '__HipHopSpecific')) {
      return true;
    }

    if ($def is HasScannedGenerics && $def->getGenericTypes()) {
      return true;
    }

    if ($def is ScannedClassish) {
      foreach ($def->getMethods() as $method) {
        if (self::isHHSpecific($method)) {
          return true;
        }
      }
    }

    if (!$def is ScannedFunctionish) {
      return false;
    }

    if ($def->getReturnType()?->getTypeName() === 'Awaitable') {
      return true;
    }

    if (
      $def->getReturnType()?->getTypeName() === 'ExternalThreadEventWaitHandle'
    ) {
      return true;
    }
    return false;
  }