*/ public array $path = []; public bool $isKey = false; /** @var list */ public array $errors = []; /** @var list */ public array $warnings = []; /** @var list}> */ public array $dynamics = []; /** @param array $variables */ public function addError(string $message, string $code, array $variables = []): Message { $variables['isKey'] = $this->isKey; return $this->errors[] = new Message($message, $code, $this->path, $variables); } /** @param array $variables */ public function addWarning(string $message, string $code, array $variables = []): Message { return $this->warnings[] = new Message($message, $code, $this->path, $variables); } /** @return \Closure(): bool */ public function createChecker(): \Closure { $count = count($this->errors); return fn(): bool => $count === count($this->errors); } }