@@ -114,35 +114,35 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer
114
114
if ($ this ->factory ->getConfig (self ::CHECK_MODE_APPLY_DEFAULTS )) {
115
115
if ($ this ->getTypeCheck ()->isObject ($ value ) && isset ($ schema ->properties )) {
116
116
// $value is an object, so apply default properties if defined
117
- foreach ($ schema ->properties as $ i => $ propertyDefinition ) {
118
- if (!$ this ->getTypeCheck ()->propertyExists ($ value , $ i ) && isset ($ propertyDefinition ->default )) {
117
+ foreach ($ schema ->properties as $ currentProperty => $ propertyDefinition ) {
118
+ if (!$ this ->getTypeCheck ()->propertyExists ($ value , $ currentProperty ) && isset ($ propertyDefinition ->default )) {
119
119
if (is_object ($ propertyDefinition ->default )) {
120
- $ this ->getTypeCheck ()->propertySet ($ value , $ i , clone $ propertyDefinition ->default );
120
+ $ this ->getTypeCheck ()->propertySet ($ value , $ currentProperty , clone $ propertyDefinition ->default );
121
121
} else {
122
- $ this ->getTypeCheck ()->propertySet ($ value , $ i , $ propertyDefinition ->default );
122
+ $ this ->getTypeCheck ()->propertySet ($ value , $ currentProperty , $ propertyDefinition ->default );
123
123
}
124
124
}
125
125
}
126
126
} elseif ($ this ->getTypeCheck ()->isArray ($ value )) {
127
127
if (isset ($ schema ->properties )) {
128
128
// $value is an array, but default properties are defined, so treat as assoc
129
- foreach ($ schema ->properties as $ i => $ propertyDefinition ) {
130
- if (!isset ($ value [$ i ]) && isset ($ propertyDefinition ->default )) {
129
+ foreach ($ schema ->properties as $ currentProperty => $ propertyDefinition ) {
130
+ if (!isset ($ value [$ currentProperty ]) && isset ($ propertyDefinition ->default )) {
131
131
if (is_object ($ propertyDefinition ->default )) {
132
- $ value [$ i ] = clone $ propertyDefinition ->default ;
132
+ $ value [$ currentProperty ] = clone $ propertyDefinition ->default ;
133
133
} else {
134
- $ value [$ i ] = $ propertyDefinition ->default ;
134
+ $ value [$ currentProperty ] = $ propertyDefinition ->default ;
135
135
}
136
136
}
137
137
}
138
138
} elseif (isset ($ schema ->items )) {
139
139
// $value is an array, and default items are defined - treat as plain array
140
- foreach ($ schema ->items as $ i => $ itemDefinition ) {
141
- if (!isset ($ value [$ i ]) && isset ($ itemDefinition ->default )) {
140
+ foreach ($ schema ->items as $ currentProperty => $ itemDefinition ) {
141
+ if (!isset ($ value [$ currentProperty ]) && isset ($ itemDefinition ->default )) {
142
142
if (is_object ($ itemDefinition ->default )) {
143
- $ value [$ i ] = clone $ itemDefinition ->default ;
143
+ $ value [$ currentProperty ] = clone $ itemDefinition ->default ;
144
144
} else {
145
- $ value [$ i ] = $ itemDefinition ->default ;
145
+ $ value [$ currentProperty ] = $ itemDefinition ->default ;
146
146
}
147
147
}
148
148
}
0 commit comments