From 189877c173c203afe7b599046fa5486ed64cb048 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Tue, 4 Jul 2017 16:19:16 +0700 Subject: [PATCH] Allow passing custom TypeInfo to validate --- src/Validator/DocumentValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Validator/DocumentValidator.php b/src/Validator/DocumentValidator.php index 4537ab3..61d68b6 100644 --- a/src/Validator/DocumentValidator.php +++ b/src/Validator/DocumentValidator.php @@ -122,9 +122,9 @@ class DocumentValidator self::$rules[$name] = $rule; } - public static function validate(Schema $schema, DocumentNode $ast, array $rules = null) + public static function validate(Schema $schema, DocumentNode $ast, array $rules = null, TypeInfo $typeInfo = null) { - $typeInfo = new TypeInfo($schema); + $typeInfo = $typeInfo ?: new TypeInfo($schema); $errors = static::visitUsingRules($schema, $typeInfo, $ast, $rules ?: static::allRules()); return $errors; }