Skip to content

Commit

Permalink
remove seemingly unnecessary cycles of object checks
Browse files Browse the repository at this point in the history
  • Loading branch information
narcoticfresh committed Jul 8, 2016
1 parent 3c2e380 commit 19bff1e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/JsonSchema/Constraints/ObjectConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public function validateElement($element, $matches, $objectDefinition = null, $p
$this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires');
}

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

$property = $this->getProperty($element, $i, new UndefinedConstraint());
if (is_object($property)) {
Expand All @@ -127,7 +127,11 @@ public function validateDefinition($element, $objectDefinition = null, $path = n
foreach ($objectDefinition as $i => $value) {
$property = $this->getProperty($element, $i, new UndefinedConstraint());
$definition = $this->getProperty($objectDefinition, $i);
$this->checkUndefined($property, $definition, $path, $i);

if (is_object($definition)) {
// Undefined constraint will check for is_object() and quit if is not - so why pass it?
$this->checkUndefined($property, $definition, $path, $i);
}
}
}

Expand Down

0 comments on commit 19bff1e

Please sign in to comment.