Returns the corresponding PHP type declaration of a MySQL column type.

@param string $phpTypeHint The PHP type hinting.

@return string
421820
public static function phpTypeHintingToPhpTypeDeclaration(string $phpTypeHint): string
  {
    $phpType = '';

    switch ($phpTypeHint)
    {
      case 'array':
      case 'array[]':
      case 'bool':
      case 'float':
      case 'int':
      case 'string':
      case 'void':
        $phpType = $phpTypeHint;
        break;

      default:
        $parts = explode('|', $phpTypeHint);
        $key   = array_search('null', $parts);
        if (count($parts)==2 && $key!==false)
        {
          unset($parts[$key]);

          $tmp = static::phpTypeHintingToPhpTypeDeclaration(implode('|', $parts));
          if ($tmp!=='')
          {
            $phpType = '?'.$tmp;
          }
        }
    }

    return $phpType;
  }
924106
public function getTypeVal() {
        if (!$this->type)
            trigger_error(sprintf('Cannot build a column query for `%s`: no column type set',$this->name),E_USER_ERROR);
        if ($this->passThrough)
            $this->type_val = $this->type;
        else {
            $this->type_val = $this->findQuery($this->schema->dataTypes[strtoupper($this->type)]);
            if (!$this->type_val) {
                if (Schema::$strict) {
                    trigger_error(sprintf(self::TEXT_NoDataType, strtoupper($this->type),
                        $this->db->driver()),E_USER_ERROR);
                    return FALSE;
                } else {
                    // auto pass-through if not found
                    $this->type_val = $this->type;
                }
            }
        }
        return $this->type_val;
    }
1173829
protected function _typeDescriptorString(): string
    {
        if ($this->typeClass() == Identifier::CLASS_UNIVERSAL) {
            return self::tagToName($this->_typeTag);
        }
        return sprintf("%s TAG %d", Identifier::classToName($this->typeClass()),
            $this->_typeTag);
    }
629136
public function getClobTypeDeclarationSQL(array $field)
    {
        if (! empty($field['length']) && is_numeric($field['length'])) {
            $length = $field['length'];

            if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
                return 'TINYTEXT';
            }

            if ($length <= static::LENGTH_LIMIT_TEXT) {
                return 'TEXT';
            }

            if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) {
                return 'MEDIUMTEXT';
            }
        }

        return 'LONGTEXT';
    }
1135753
public function getXMLDBFieldType($type) {

        $result = XMLDB_TYPE_INCORRECT;

        switch (strtolower($type)) {
            case 'int':
                $result = XMLDB_TYPE_INTEGER;
                break;
            case 'number':
                $result = XMLDB_TYPE_NUMBER;
                break;
            case 'float':
                $result = XMLDB_TYPE_FLOAT;
                break;
            case 'char':
                $result = XMLDB_TYPE_CHAR;
                break;
            case 'text':
                $result = XMLDB_TYPE_TEXT;
                break;
            case 'binary':
                $result = XMLDB_TYPE_BINARY;
                break;
            case 'datetime':
                $result = XMLDB_TYPE_DATETIME;
                break;
        }
        // Return the normalized XMLDB_TYPE
        return $result;
    }
323745
public function getPDOParamType($phpType)
    {
        switch ($phpType) {
            case 'boolean':
                return PDO::PARAM_BOOL;
            case 'NULL':
                return PDO::PARAM_NULL;
            case 'integer':
                return PDO::PARAM_INT;
            case 'object': // Allowed if the object or resource has a __toString method
            case 'resource':
            case 'float': // Not actually returnable from get_type
            case 'double':
            case 'string':
                return PDO::PARAM_STR;
            case 'blob':
                return PDO::PARAM_LOB;
            case 'array':
            case 'unknown type':
            default:
                throw new InvalidArgumentException("Cannot bind parameter as it is an unsupported type ($phpType)");
        }
    }
66733
private function getTypeHint(string $type, bool $allowNull = null): string
    {
        if (strpos($type, '[]') !== false) {
            $type = 'array';
        }

        if ($allowNull === true) {
            $type = '?' . $type;
        }

        return $type;
    }
142748
public function getPhpType()
    {
        if (isset(self::$_phpTypesByProtobufType[$this->getType()])) {
            return self::$_phpTypesByProtobufType[$this->getType()];
        } else {
            return null;
        }
    }
645667
public function typeDesc()
    {
        // Cast SimpleXMLObject to string
        $type = (string)$this->type;
        return array_key_exists($type, self::$types) ? self::$types[$type] : '';
    }
1353444
public function getFieldBindType($type)
    {
        if (0 === strpos($type, 'set') || 0 === strpos($type, 'enum')) {
            $bind = PDO::PARAM_STR;
        } elseif (preg_match('/(double|float|decimal|real|numeric)/is', $type)) {
            $bind = self::PARAM_FLOAT;
        } elseif (preg_match('/(int|serial|bit)/is', $type)) {
            $bind = PDO::PARAM_INT;
        } elseif (preg_match('/bool/is', $type)) {
            $bind = PDO::PARAM_BOOL;
        } else {
            $bind = PDO::PARAM_STR;
        }

        return $bind;
    }
28416
public function getEntityListColumnType($columnTypeClass)
    {
        if (isset($this->columnTypes[$columnTypeClass])) {
            return $this->columnTypes[$columnTypeClass];
        }
        elseif (class_exists($columnTypeClass)) {
            return new $columnTypeClass();
        }
    }
1086303
private function sqlsrvtype2moodletype($sqlsrv_type) {
        $type = null;

        switch (strtoupper($sqlsrv_type)) {
          case 'BIT':
           $type = 'L';
           break;

          case 'INT':
          case 'SMALLINT':
          case 'INTEGER':
          case 'BIGINT':
           $type = 'I';
           break;

          case 'DECIMAL':
          case 'REAL':
          case 'FLOAT':
           $type = 'N';
           break;

          case 'VARCHAR':
          case 'NVARCHAR':
           $type = 'C';
           break;

          case 'TEXT':
          case 'NTEXT':
          case 'VARCHAR(MAX)':
          case 'NVARCHAR(MAX)':
           $type = 'X';
           break;

          case 'IMAGE':
          case 'VARBINARY':
          case 'VARBINARY(MAX)':
           $type = 'B';
           break;

          case 'DATETIME':
           $type = 'D';
           break;
         }

        if (!$type) {
            throw new dml_exception('invalidsqlsrvnativetype', $sqlsrv_type);
        }
        return $type;
    }
178123
function GetSqliteType()
	{
		$rt = $this->Type;
		switch ($this->Type)
		{
			case "int":
				$rt = "integer";
				break;
			case "smallint":
				$rt = "integer";
				break;
			case "tinyint":
				$rt = "integer";
				break;
			case "varchar":
				$rt = "text";
				break;
			case "text":
				$rt = "text";
				break;
			case "tinytext":
				$rt = "text";
				break;
			case "date":
				$rt = "datetime";
				break;
			case "datetime":
				$rt = "datetime";
				break;
			case "mediumint":
				$rt = "integer";
				break;
			case "bigint":
				$rt = "integer";
				break;
			case "decimal":
				$rt = "real";
				break;
			case "float":
				$rt = "real";
				break;
			default;
				break;
		}

		return $rt;
	}
331464
static function getArrayType($type){
        self::isArray($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not array"));
        if($type == 'array') {
            return 'mixed';
        }else{
            return substr($type,0,-2);
        }
    }
135632
public function getFldTypeForPhp()
    {
        $type = 'mixed';
        switch ($this->getFldType()) {
            case FFCST::TYPE_INTEGER:
            case FFCST::TYPE_BIGINT:
                $type = 'int';
                break;
            case FFCST::TYPE_DATETIME:
            case FFCST::TYPE_MD5:
            case FFCST::TYPE_STRING:
                $type = 'string';
                break;
            case FFCST::TYPE_BOOLEAN:
                $type = 'bool';
                break;
        }
        return $type;
    }
312346
public function getDataType(string $dataTypeHandle)
    {
        if (!isset($this->dataTypes[$dataTypeHandle])) {
            Schematic::error('DataType '.$dataTypeHandle.' is not registered');

            return null;
        }

        $dataTypeClass = $this->dataTypes[$dataTypeHandle];
        if (!class_exists($dataTypeClass)) {
            Schematic::error('Class '.$dataTypeClass.' does not exist');

            return null;
        }

        $dataType = new $dataTypeClass();
        if (!$dataType instanceof DataTypeInterface) {
            Schematic::error($dataTypeClass.' does not implement DataTypeInterface');

            return null;
        }

        return $dataType;
    }
752681
static function fetchIDListContainingDatatype( $dataTypeString )
    {
        $db = eZDB::instance();

        $version = self::VERSION_STATUS_DEFINED;
        $escapedDataTypeString = $db->escapeString( $dataTypeString );

        $sql = "SELECT DISTINCT contentclass_id
                FROM ezcontentclass_attribute
                WHERE version=$version
                AND data_type_string='$escapedDataTypeString'";

        $classIDArray = $db->arrayQuery( $sql, array( 'column' => 'contentclass_id' ) );
        return $classIDArray;
    }