From bb766f5be440412118253476360bdb70f38fa8a1 Mon Sep 17 00:00:00 2001 From: Emmanuel GUITON Date: Thu, 11 Feb 2021 14:31:35 +0100 Subject: [PATCH] Fixed method convertJsonPointerIntoPropertyPath() that was not in the right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes #654 --- src/JsonSchema/Constraints/BaseConstraint.php | 17 +++++++++++++++++ src/JsonSchema/Constraints/Constraint.php | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/JsonSchema/Constraints/BaseConstraint.php b/src/JsonSchema/Constraints/BaseConstraint.php index a0d1d8b8..8d9f11cf 100644 --- a/src/JsonSchema/Constraints/BaseConstraint.php +++ b/src/JsonSchema/Constraints/BaseConstraint.php @@ -153,4 +153,21 @@ public static function arrayToObjectRecursive($array) return (object) json_decode($json); } + + /** + * @param JsonPointer $pointer + * + * @return string property path + */ + protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer) + { + $result = array_map( + function ($path) { + return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path); + }, + $pointer->getPropertyPaths() + ); + + return trim(implode('', $result), '.'); + } } diff --git a/src/JsonSchema/Constraints/Constraint.php b/src/JsonSchema/Constraints/Constraint.php index 389e0f53..9260709b 100644 --- a/src/JsonSchema/Constraints/Constraint.php +++ b/src/JsonSchema/Constraints/Constraint.php @@ -210,21 +210,4 @@ protected function getTypeCheck() { return $this->factory->getTypeCheck(); } - - /** - * @param JsonPointer $pointer - * - * @return string property path - */ - protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer) - { - $result = array_map( - function ($path) { - return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path); - }, - $pointer->getPropertyPaths() - ); - - return trim(implode('', $result), '.'); - } }