Skip to content

Commit f4fce1b

Browse files
emmanuelGuitonEmmanuel GUITONSeldaek
committed
Fixed method convertJsonPointerIntoPropertyPath() that was not in the right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes jsonrainbow#654 (jsonrainbow#655)
Co-authored-by: Emmanuel GUITON <[email protected]> Co-authored-by: Jordi Boggiano <[email protected]>
1 parent f0b8661 commit f4fce1b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/JsonSchema/Constraints/BaseConstraint.php

+17
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,21 @@ public static function arrayToObjectRecursive($array)
145145

146146
return (object) json_decode($json);
147147
}
148+
149+
/**
150+
* @param JsonPointer $pointer
151+
*
152+
* @return string property path
153+
*/
154+
protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
155+
{
156+
$result = array_map(
157+
function ($path) {
158+
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
159+
},
160+
$pointer->getPropertyPaths()
161+
);
162+
163+
return trim(implode('', $result), '.');
164+
}
148165
}

src/JsonSchema/Constraints/Constraint.php

-17
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,4 @@ protected function getTypeCheck()
200200
{
201201
return $this->factory->getTypeCheck();
202202
}
203-
204-
/**
205-
* @param JsonPointer $pointer
206-
*
207-
* @return string property path
208-
*/
209-
protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
210-
{
211-
$result = array_map(
212-
function ($path) {
213-
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
214-
},
215-
$pointer->getPropertyPaths()
216-
);
217-
218-
return trim(implode('', $result), '.');
219-
}
220203
}

0 commit comments

Comments
 (0)