protected function checkDisallow($entity, $schema, $entityName)
    {
        if (isset($schema->disallow) && $schema->disallow) {
            $thisSchema = clone $schema;
            $thisSchema->type = $schema->disallow;
            unset($thisSchema->disallow);

            // We are expecting an exception - if one is not thrown,
            // then we have a matching disallowed type
            try {
                $valid = false;
                $this->validateType($entity, $thisSchema, $entityName);
            } catch (ValidationException $e) {
                $valid = true;
            }
            if (!$valid) {
                $disallowedTypes = array_map(function($item){
                    return is_object($item) ? 'object (schema)' : $item;
                }, is_array($schema->disallow) ? $schema->disallow : array($schema->disallow));
                throw new ValidationException(sprintf('Invalid value for [%s], disallowed types are [%s]',
                    $entityName, implode(', ', $disallowedTypes)));
            }
        }

        return $this;
    }
protected function checkDisallow($entity, $schema, $entityName)
    {
        if (isset($schema->disallow) && $schema->disallow) {
            $thisSchema = clone $schema;
            $thisSchema->type = $schema->disallow;
            unset($thisSchema->disallow);

            // We are expecting an exception - if one is not thrown,
            // then we have a matching disallowed type
            try {
                $valid = false;
                $this->validateType($entity, $thisSchema, $entityName);
            } catch (ValidationException $e) {
                $valid = true;
            }
            if (!$valid) {
                $disallowedTypes = array_map(function($item){
                    return is_object($item) ? 'object (schema)' : $item;
                }, is_array($schema->disallow) ? $schema->disallow : array($schema->disallow));
                throw new ValidationException(sprintf('Invalid value for [%s], disallowed types are [%s]',
                    $entityName, implode(', ', $disallowedTypes)));
            }
        }

        return $this;
    }
protected function checkDisallow ( $ entity , $ schema , $ entityName ) { if ( isset ( $ schema -> disallow ) && $ schema -> disallow ) { $ thisSchema = clone $ schema ; $ thisSchema -> type = $ schema -> disallow ; unset ( $ thisSchema -> disallow ) ; // We are expecting an exception - if one is not thrown, // then we have a matching disallowed type try { $ valid = false ; $ this -> validateType ( $ entity , $ thisSchema , $ entityName ) ; } catch ( ValidationException $ e ) { $ valid = true ; } if ( ! $ valid ) { $ disallowedTypes = array_map ( function ( $ item ) { return is_object ( $ item ) ? 'object (schema)' : $ item ; } , is_array ( $ schema -> disallow ) ? $ schema -> disallow : array ( $ schema -> disallow ) ) ; throw new ValidationException ( sprintf ( 'Invalid value for [%s], disallowed types are [%s]' , $ entityName , implode ( ', ' , $ disallowedTypes ) ) ) ; } } return $ this ; }
Check disallowed entity type

@param mixed $entity
@param object $schema
@param string $entityName

@return Validator
Check disallowed entity type