@@ -114,35 +114,35 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer
114114 if ($ this ->factory ->getConfig (self ::CHECK_MODE_APPLY_DEFAULTS )) {
115115 if ($ this ->getTypeCheck ()->isObject ($ value ) && isset ($ schema ->properties )) {
116116 // $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 )) {
119119 if (is_object ($ propertyDefinition ->default )) {
120- $ this ->getTypeCheck ()->propertySet ($ value , $ i , clone $ propertyDefinition ->default );
120+ $ this ->getTypeCheck ()->propertySet ($ value , $ currentProperty , clone $ propertyDefinition ->default );
121121 } else {
122- $ this ->getTypeCheck ()->propertySet ($ value , $ i , $ propertyDefinition ->default );
122+ $ this ->getTypeCheck ()->propertySet ($ value , $ currentProperty , $ propertyDefinition ->default );
123123 }
124124 }
125125 }
126126 } elseif ($ this ->getTypeCheck ()->isArray ($ value )) {
127127 if (isset ($ schema ->properties )) {
128128 // $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 )) {
131131 if (is_object ($ propertyDefinition ->default )) {
132- $ value [$ i ] = clone $ propertyDefinition ->default ;
132+ $ value [$ currentProperty ] = clone $ propertyDefinition ->default ;
133133 } else {
134- $ value [$ i ] = $ propertyDefinition ->default ;
134+ $ value [$ currentProperty ] = $ propertyDefinition ->default ;
135135 }
136136 }
137137 }
138138 } elseif (isset ($ schema ->items )) {
139139 // $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 )) {
142142 if (is_object ($ itemDefinition ->default )) {
143- $ value [$ i ] = clone $ itemDefinition ->default ;
143+ $ value [$ currentProperty ] = clone $ itemDefinition ->default ;
144144 } else {
145- $ value [$ i ] = $ itemDefinition ->default ;
145+ $ value [$ currentProperty ] = $ itemDefinition ->default ;
146146 }
147147 }
148148 }
0 commit comments