protected function validateArgs(): void
    {
        if (! $this->rules) {
            return;
        }

        $validator = validator(
            $this->args,
            $this->rules,
            $this->messages,
            [
                'root' => $this->root,
                'context' => $this->context,
                // This makes it so that we get an instance of our own Validator class
                'resolveInfo' => $this->resolveInfo,
            ]
        );

        if ($validator->fails()) {
            foreach ($validator->errors()->getMessages() as $key => $errorMessages) {
                foreach ($errorMessages as $errorMessage) {
                    $this->validationErrorBuffer->push($errorMessage, $key);
                }
            }
        }

        $path = implode(
            '.',
            $this->resolveInfo()->path
        );
        $this->validationErrorBuffer->flush(
            "Validation failed for the field [$path]."
        );

        // reset rules and messages
        $this->rules = [];
        $this->messages = [];
    }