You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor to simplify the public API and make adding features easier (#351)
This commit makes the following changes:
* Split the Constraint class to make Validator independent from it
* Add Validator::validate() as the main entry point
* Turn Validator::coerce() and Validator::check() into aliases
* Add Factory::setConfig(), getConfig(), addConfig() & removeConfig()
* Make type-coercion a checkMode option, don't pass $coerce everywhere
* Add some extra tests
$path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,));
141
127
}
142
128
} else {
143
129
// Should be valid against an empty schema
144
-
$this->checkUndefined($v, new \stdClass(), $path, $k, $coerce);
130
+
$this->checkUndefined($v, new \stdClass(), $path, $k);
145
131
}
146
132
}
147
133
}
134
+
unset($v); // remove dangling reference to prevent any future bugs
135
+
// caused by accidentally using $v elsewhere
148
136
149
137
// Treat when we have more schema definitions than values, not for empty arrays
150
138
if (count($value) > 0) {
151
139
for ($k = count($value); $k < count($schema->items); $k++) {
0 commit comments