Skip to content

Commit

Permalink
Fixed method convertJsonPointerIntoPropertyPath() that was not in the…
Browse files Browse the repository at this point in the history
… right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes #654 (#655)

Co-authored-by: Emmanuel GUITON <[email protected]>
Co-authored-by: Jordi Boggiano <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2021
1 parent b1a83e4 commit 4a1f07f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 17 additions & 0 deletions src/JsonSchema/Constraints/BaseConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,21 @@ public static function jsonPatternToPhpRegex($pattern)
{
return '~' . str_replace('~', '\\~', $pattern) . '~u';
}

/**
* @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), '.');
}
}
17 changes: 0 additions & 17 deletions src/JsonSchema/Constraints/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,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), '.');
}
}

0 comments on commit 4a1f07f

Please sign in to comment.