Returns whether the expressions are all of the supplied type.

@param Expression[] $expressions
@param string       $type
@param boolean      $allowNull

@return boolean
179858
final public static function allOfType(array $expressions, $type, $allowNull = false)
    {
        foreach ($expressions as $expression) {
            if ($expression instanceof $type || $expression === null && $allowNull) {
                continue;
            }

            return false;
        }

        return true;
    }
1083972
private function hasHandlers(string $type): bool
    {
        return isset($this->handlers[$type]) && count($this->handlers[$type]) > 0;
    }
834218
public function validateProperty(string $property, $allowed): bool
    {
        if (is_string($allowed)) {
            $allowed = explode('|', $allowed);
        }

        if (!is_array($allowed)) {
            throw new InvalidTypeException('$allowed must be a string or array');
        }

        $valid = false;
        $optional = in_array('optional', $allowed);

        if ($optional && (!isset($this->{$property}) || $this->{$property} === null)) {
            return true;
        }

        foreach ($allowed as $index => $type) {
            if ($type === 'optional') {
                continue;
            }

            if ($valid = $this->validatePropertyType($property, $type)) {
                break;
            }
        }

        if (!$valid) {
            $this->throwInvalidTypeException($property, $allowed, $optional);
        }

        return true;
    }
270719
protected function buildExpression($collection, $type = AndX::class)
    {
        $expressions = [];

        /** @var Expression $expression */
        foreach ($collection as $expression) {
            if (!$expression instanceof Expression) {
                throw new \Exception(sprintf('Expressions must be of type %s', Expression::class));
            }

            if (count($expression->getChildren())) {
                $expressions[] = $this->buildExpression($expression->getChildren(), $expression->getConstraint());
            } else {
                $expressions[] = $this->transform($expression);
            }
        }

        return new $type($expressions);
    }
895353
public function isEnabled($type, $plugin = null)
	{
		$result = $this->byType($type, $plugin);

		return (!empty($result));
	}
1239418
protected function createConjunctionExpression(array $expressions, $conjunction)
    {
        // create the appropriate expression
        if (ListBuilderInterface::CONJUNCTION_AND === strtoupper($conjunction)) {
            return $this->listBuilder->createAndExpression($expressions);
        }

        return $this->listBuilder->createOrExpression($expressions);
    }
990660
public function allow($type)
    {
        if (!is_array($type)) {
            $type = func_get_args();
        }
        $this->allowedTypes = implode(',', $type);

        return $this;
    }
118481
public function isPassableTo(TypeConstraint $constraints, $ignoreNullAllowed = false) {
		if ($constraints->isEmpty()) return true;
		 
		if (!(TypeUtils::isTypeA($this->getTypeName(), $constraints->getTypeName()) 
				&& ($ignoreNullAllowed || $constraints->allowsNull() || !$this->allowsNull()))) return false;
				
		$arrayFieldConstraints = $constraints->getArrayFieldTypeConstraint();
		if ($arrayFieldConstraints === null) return true;
		if ($this->arrayFieldTypeConstraint === null) return true;
		
		return $this->arrayFieldTypeConstraint->isPassableTo($arrayFieldConstraints, $ignoreNullAllowed);
	}
683747
public function hasImages($type = null)
    {
        if ($type) {
            if ($this->relationLoaded('images')) {
                return $this->images->contains('image_type', $type);
            } else {
                return $this->images()->where('image_type', '=', $type)->exists();
            }
        }

        return (bool) count($this->images);
    }
21667
public function cast($type, AbstractBuilder $expression)
    {
        return $this->raw([
            'type' => BinaryOperator::OPERATOR_CAST,
            'left' => $type,
            'right' => $expression,
        ]);
    }
485282
private function isFixableReturnType(string $type): bool
    {
        // $type === null is not valid in our slevomat helper.
        return TypeHintHelper::isSimpleTypeHint($type) || $type === 'null' || $this->isCustomArrayType($type);
    }
603112
public function disallow($type)
    {
        if (!is_array($type)) {
            $type = func_get_args();
        }
        $this->disallowedTypes = implode(',', $type);

        return $this;
    }
849296
public function has_type_handler($module, $type) {
        if (!$this->is_known_type($type)) {
            throw new coding_exception("Checking for handler for unknown type $type");
        }
        foreach ($this->types[$type]->handlers as $handler) {
            if ($handler->module == $module) {
                return true;
            }
        }
        return false;
    }
880424
public function findFirstInSubTree($type)
    {
        foreach ($this->getSubTree() as $expression) {
            if ($expression->getType() === $type) {
                return $expression;
            }
        }

        return null;
    }
662511
public function select( $expressions /* expressions ... */ ) {
		$expressions = is_array( $expressions ) ? $expressions : func_get_args();

		$this->setQueryForm( 'SELECT' );
		$this->addExpressions( $expressions );

		return $this;
	}
890490
public function selectKey($type, $algorithm = null, array $restrictions = [])
    {
        Assertion::inArray($type, ['enc', 'sig']);
        Assertion::nullOrString($algorithm);

        $result = [];
        $keys = $this->getKeys();
        foreach ($keys as $key) {
            $ind = 0;

            // Check usage
            $can_use = $this->canKeyBeUsedFor($type, $key);
            if (false === $can_use) {
                continue;
            }
            $ind += $can_use;

            // Check algorithm
            $alg = $this->canKeyBeUsedWithAlgorithm($algorithm, $key);
            if (false === $alg) {
                continue;
            }
            $ind += $alg;

            // Validate restrictions
            if (false === $this->doesKeySatisfyRestrictions($restrictions, $key)) {
                continue;
            }

            // Add to the list with trust indicator
            $result[] = ['key' => $key, 'ind' => $ind];
        }

        //Return null if no key
        if (empty($result)) {
            return;
        }

        //Sort by trust indicator
        usort($result, [$this, 'sortKeys']);
        //Return the highest trust indicator (first key)
        return $result[0]['key'];
    }
432301
public static function validate($type, $data, $mayBeNull = false, $mayBeEmpty = false, $exceptions = true)
    {
        $validator = new Validator();
        return $validator->validate($type, $data, $mayBeNull, $mayBeEmpty, $exceptions);
    }