Skip to content

Commit 19bff1e

Browse files
committed
remove seemingly unnecessary cycles of object checks
1 parent 3c2e380 commit 19bff1e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/JsonSchema/Constraints/ObjectConstraint.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ public function validateElement($element, $matches, $objectDefinition = null, $p
103103
$this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires');
104104
}
105105

106-
if (!$definition) {
106+
//if (!$definition) {
107107
// normal property verification
108-
$this->checkUndefined($value, new \stdClass(), $path, $i);
109-
}
108+
//$this->checkUndefined($value, new \stdClass(), $path, $i);
109+
//}
110110

111111
$property = $this->getProperty($element, $i, new UndefinedConstraint());
112112
if (is_object($property)) {
@@ -127,7 +127,11 @@ public function validateDefinition($element, $objectDefinition = null, $path = n
127127
foreach ($objectDefinition as $i => $value) {
128128
$property = $this->getProperty($element, $i, new UndefinedConstraint());
129129
$definition = $this->getProperty($objectDefinition, $i);
130-
$this->checkUndefined($property, $definition, $path, $i);
130+
131+
if (is_object($definition)) {
132+
// Undefined constraint will check for is_object() and quit if is not - so why pass it?
133+
$this->checkUndefined($property, $definition, $path, $i);
134+
}
131135
}
132136
}
133137

0 commit comments

Comments
 (0)