src/Validators/ObjectValidators/AdditionalPropertiesValidator.php
public function validate($subject): bool
    {
        // Validation with "additionalProperties" applies only to the child values of instance names that do
        // not match any names in "properties", and do not match any regular expression in "patternProperties".
        $subject = $this->removePropertiesFromSubject($subject, $this->schema);
        $subject = $this->removePatternPropertiesFromSubject($subject, $this->schema);
        // The value of "additionalProperties" MUST be a valid JSON Schema (including boolean false)
        if (\is_bool($this->schema['additionalProperties']) && $this->schema['additionalProperties'] === false) {
            if (count($subject) > 0) {
                return false;
            }
        } elseif (\is_array($this->schema['additionalProperties'])) {
            foreach ($subject as $propertyValue) {
                $nodeValidator = new NodeValidator($this->schema['additionalProperties'], $this->rootSchema);
                if (!$nodeValidator->validate($propertyValue)) {
                    return false;
                }
            }
        }
        return true;
    }
public function validate($subject): bool
    {
        // Validation with "additionalProperties" applies only to the child values of instance names that do
        // not match any names in "properties", and do not match any regular expression in "patternProperties".
        $subject = $this->removePropertiesFromSubject($subject, $this->schema);
        $subject = $this->removePatternPropertiesFromSubject($subject, $this->schema);
        // The value of "additionalProperties" MUST be a valid JSON Schema (including boolean false)
        if (\is_bool($this->schema['additionalProperties']) && $this->schema['additionalProperties'] === false) {
            if (count($subject) > 0) {
                return false;
            }
        } elseif (\is_array($this->schema['additionalProperties'])) {
            foreach ($subject as $propertyValue) {
                $nodeValidator = new NodeValidator($this->schema['additionalProperties'], $this->rootSchema);
                if (!$nodeValidator->validate($propertyValue)) {
                    return false;
                }
            }
        }
        return true;
    }
public function validate ( $ subject ) : bool { // Validation with "additionalProperties" applies only to the child values of instance names that do // not match any names in "properties", and do not match any regular expression in "patternProperties". $ subject = $ this -> removePropertiesFromSubject ( $ subject , $ this -> schema ) ; $ subject = $ this -> removePatternPropertiesFromSubject ( $ subject , $ this -> schema ) ; // The value of "additionalProperties" MUST be a valid JSON Schema (including boolean false) if ( \ is_bool ( $ this -> schema [ 'additionalProperties' ] ) && $ this -> schema [ 'additionalProperties' ] === false ) { if ( count ( $ subject ) > 0 ) { return false ; } } elseif ( \ is_array ( $ this -> schema [ 'additionalProperties' ] ) ) { foreach ( $ subject as $ propertyValue ) { $ nodeValidator = new NodeValidator ( $ this -> schema [ 'additionalProperties' ] , $ this -> rootSchema ) ; if ( ! $ nodeValidator -> validate ( $ propertyValue ) ) { return false ; } } } return true ; }
Validates subject against additionalProperties

@param array $subject
@return bool
Validates subject against additionalProperties