Skip to content

Commit b470961

Browse files
committed
Update comments
1 parent b46359b commit b470961

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/JsonSchema/Constraints/UndefinedConstraint.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer
113113
// Apply default values from schema
114114
if ($this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
115115
if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
116+
// $value is an object or assoc array, and properties are defined - treat as an object
116117
foreach ($schema->properties as $currentProperty => $propertyDefinition) {
117118
if (!LooseTypeCheck::propertyExists($value, $currentProperty) && isset($propertyDefinition->default)) {
118119
if (is_object($propertyDefinition->default)) {
@@ -123,7 +124,7 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer
123124
}
124125
}
125126
} elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
126-
// $value is an array, and default items are defined - treat as plain array
127+
// $value is an array, and items are defined - treat as plain array
127128
foreach ($schema->items as $currentProperty => $itemDefinition) {
128129
if (!isset($value[$currentProperty]) && isset($itemDefinition->default)) {
129130
if (is_object($itemDefinition->default)) {

0 commit comments

Comments
 (0)