protected function createInstance(Connection $connection, string $type): ConstraintInterface
    {
        $driver = $connection->driver();

        if (!isset($this->registry[$driver][$type])) {
            throw new \InvalidArgumentException(sprintf("'%s' constraint is not supported by '%s' driver"));
        }

        $className = $this->registry[$driver][$type];

        // Consider that if the user did not register an instance, then he is
        // using the ConstraintTrait and its constructor, I do hope anyway.
        // @todo provide other means of registration
        if (!class_exists($className)) {
            throw new \InvalidArgumentException(sprintf("'%s' class does not exist", $className));
        }

        return new $className($connection, $type);
    }
protected function createInstance(Connection $connection, string $type): ConstraintInterface
    {
        $driver = $connection->driver();

        if (!isset($this->registry[$driver][$type])) {
            throw new \InvalidArgumentException(sprintf("'%s' constraint is not supported by '%s' driver"));
        }

        $className = $this->registry[$driver][$type];

        // Consider that if the user did not register an instance, then he is
        // using the ConstraintTrait and its constructor, I do hope anyway.
        // @todo provide other means of registration
        if (!class_exists($className)) {
            throw new \InvalidArgumentException(sprintf("'%s' class does not exist", $className));
        }

        return new $className($connection, $type);
    }
protected function createInstance ( Connection $ connection , string $ type ) : ConstraintInterface { $ driver = $ connection -> driver ( ) ; if ( ! isset ( $ this -> registry [ $ driver ] [ $ type ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "'%s' constraint is not supported by '%s' driver" ) ) ; } $ className = $ this -> registry [ $ driver ] [ $ type ] ; // Consider that if the user did not register an instance, then he is // using the ConstraintTrait and its constructor, I do hope anyway. // @todo provide other means of registration if ( ! class_exists ( $ className ) ) { throw new \ InvalidArgumentException ( sprintf ( "'%s' class does not exist" , $ className ) ) ; } return new $ className ( $ connection , $ type ) ; }
Create instance for the given connection
Create instance for the given connection