lib/Assertion.php
function exist(): self {
    if ($this->hasFlag('directory')) $constraint = directoryExists();
    else if ($this->hasFlag('file')) $constraint = fileExists();
    else throw new \BadMethodCallException('This assertion is not a file or directory one.');

    return $this->expect($this->target, $constraint);
  }
function exist(): self {
    if ($this->hasFlag('directory')) $constraint = directoryExists();
    else if ($this->hasFlag('file')) $constraint = fileExists();
    else throw new \BadMethodCallException('This assertion is not a file or directory one.');

    return $this->expect($this->target, $constraint);
  }
Reports an error if the file or directory specified by the target does not exist.
@return self This instance.
@throws \BadMethodCallException This assertion is not a file or directory one.