Skip to content

Commit 1e2dfe6

Browse files
committed
fix PHP 7.2 compatibility
* the `phpdocumentor/type-resolver` package was not PHP 7.2 compatible before release 0.2.1 (see see phpDocumentor/TypeResolver@e224fb2) * the validator must not call `get_class()` if no object but a class name was passed to the `validatePropertyValue()` method
1 parent 66f997c commit 1e2dfe6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Validator/RecursiveContextualValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,13 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr
261261

262262
if (is_object($objectOrClass)) {
263263
$object = $objectOrClass;
264+
$class = get_class($object);
264265
$cacheKey = spl_object_hash($objectOrClass);
265266
$propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName);
266267
} else {
267268
// $objectOrClass contains a class name
268269
$object = null;
270+
$class = $objectOrClass;
269271
$cacheKey = null;
270272
$propertyPath = $this->defaultPropertyPath;
271273
}
@@ -280,7 +282,7 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr
280282
$this->validateGenericNode(
281283
$value,
282284
$object,
283-
$cacheKey.':'.get_class($object).':'.$propertyName,
285+
$cacheKey.':'.$class.':'.$propertyName,
284286
$propertyMetadata,
285287
$propertyPath,
286288
$groups,

0 commit comments

Comments
 (0)