Skip to content

Commit 65d4a0b

Browse files
committed
separate 'type' from 'required' validation, fixing failing unit tests
1 parent e89b755 commit 65d4a0b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/JsonSchema/Constraints/Undefined.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,11 @@ protected function validateCommonProperties($value, $schema = null, $path = null
121121
if ( $schema->required && $value instanceof Undefined) {
122122
$this->addError($path, "is missing and it is required");
123123
}
124-
} else if ($value instanceof Undefined) {
125-
// don't check type of Undefined value
126-
} else {
127-
$this->checkType($value, $schema, $path);
128124
}
129-
} else {
125+
}
126+
127+
// Verify type
128+
if( ($value instanceof Undefined) === false) {
130129
$this->checkType($value, $schema, $path);
131130
}
132131

0 commit comments

Comments
 (0)