Skip to content

Commit bc9438a

Browse files
committed
fix immediate return condition in Undefined constraint
1 parent 2366f30 commit bc9438a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/JsonSchema/Constraints/Undefined.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace JsonSchema\Constraints;
1111

12+
use JsonSchema\Exception\InvalidArgumentException;
1213
use JsonSchema\Uri\UriResolver;
1314

1415
/**
@@ -24,10 +25,14 @@ class Undefined extends Constraint
2425
*/
2526
public function check($value, $schema = null, $path = null, $i = null)
2627
{
27-
if (!is_object($schema)) {
28+
if( is_null($schema)) {
2829
return;
2930
}
3031

32+
if (!is_object($schema)) {
33+
throw new InvalidArgumentException('Given schema must be an object.');
34+
}
35+
3136
$i = is_null($i) ? "" : $i;
3237
$path = $this->incrementPath($path, $i);
3338

0 commit comments

Comments
 (0)