From f4fce1b021a476cc5fa991cd6c33037784ceb633 Mon Sep 17 00:00:00 2001 From: Emmanuel Guiton Date: Thu, 22 Jul 2021 08:46:23 +0200 Subject: [PATCH] Fixed method convertJsonPointerIntoPropertyPath() that was not in the right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes #654 (#655) Co-authored-by: Emmanuel GUITON Co-authored-by: Jordi Boggiano --- 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 63968213..eb50761b 100644 --- a/src/JsonSchema/Constraints/BaseConstraint.php +++ b/src/JsonSchema/Constraints/BaseConstraint.php @@ -145,4 +145,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 9e9af710..70ecacfc 100644 --- a/src/JsonSchema/Constraints/Constraint.php +++ b/src/JsonSchema/Constraints/Constraint.php @@ -200,21 +200,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), '.'); - } }