src/StringType.php
protected function check($value)
    {
        if ($value === false || $value === 0 || $value === 0.0 || $value === '0') {
            return '0';
        }

        if ($value === true || $value === 1 || $value === 1.0 || $value === '1') {
            return '1';
        }

        if ($value instanceof StringType) {
            return $value->value($this->encoding);
        }

        if ($value instanceof Type) {
            $value = $value->value();
        } else {
            if (is_array($value)) {
                throw new InvalidArgumentException('Invalid string, array given');
            }

            if (is_resource($value)) {
                throw new InvalidArgumentException('Invalid string, resource given');
            }

            if (is_object($value)) {
                throw new InvalidArgumentException('Invalid string, object given');
            }
        }

        if (is_array($value) || is_object($value) || is_resource($value)) {
            throw new InvalidArgumentException('Invalid string: ' . $value);
        }

        return mb_convert_encoding($value, 'UTF-8', $this->encoding);
    }
protected function check($value)
    {
        if ($value === false || $value === 0 || $value === 0.0 || $value === '0') {
            return '0';
        }

        if ($value === true || $value === 1 || $value === 1.0 || $value === '1') {
            return '1';
        }

        if ($value instanceof StringType) {
            return $value->value($this->encoding);
        }

        if ($value instanceof Type) {
            $value = $value->value();
        } else {
            if (is_array($value)) {
                throw new InvalidArgumentException('Invalid string, array given');
            }

            if (is_resource($value)) {
                throw new InvalidArgumentException('Invalid string, resource given');
            }

            if (is_object($value)) {
                throw new InvalidArgumentException('Invalid string, object given');
            }
        }

        if (is_array($value) || is_object($value) || is_resource($value)) {
            throw new InvalidArgumentException('Invalid string: ' . $value);
        }

        return mb_convert_encoding($value, 'UTF-8', $this->encoding);
    }
Check the value

@param  mixed  $value
@return string