public function assertNotContains()

in src/Assert.hack [454:490]


  public function assertNotContains(
    mixed $needle,
    mixed $haystack,
    string $message = '',
    bool $ignoreCase = false,
  ): void {
    if ($haystack is Traversable<_>) {
      if (!(new Constraint\TraversableContains($needle))->matches($haystack)) {
        return;
      }
    } else if (($haystack is string)) {
      if (!($needle is string)) {
        throw new InvalidArgumentException(
          'If haystack is string, needle must be string',
        );
      }
      if ($ignoreCase) {
        if (!Str\contains_ci($haystack, $needle)) {
          return;
        }
      } else if (!Str\contains($haystack, $needle)) {
        return;
      }
    } else {
      throw new InvalidArgumentException(
        'Haystack must be an array, traversable or string',
      );
    }
    throw new ExpectationFailedException(
      Str\format(
        "%s\nFailed asserting that %s does not contain %s",
        $message,
        \var_export($haystack, true),
        \var_export($needle, true),
      ),
    );
  }