SOAP specification support scalar types that aren't supported or written differently by PHP
@param string $type
@return string
556051
public function toPhpSupportedScalar(string $type): string
    {
        if ($this->isPhpScalarType($type)) {
            return $type;
        }

        if ($type === 'short') {
            return 'float';
        }
        if ($type === 'double') {
            return 'float';
        }
        if ($type === 'boolean') {
            return 'bool';
        }

        return $type;
    }
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;
    }
1187983
public function type($type)
    {
        if (is_string($type)) {
            $map = array(
                'double' => 1,
                'string' => 2,
                'object' => 3,
                'array' => 4,
                'binary' => 5,
                'undefined' => 6,
                'objectid' => 7,
                'boolean' => 8,
                'date' => 9,
                'null' => 10,
                'regex' => 11,
                'jscode' => 13,
                'symbol' => 14,
                'jscodewithscope' => 15,
                'integer32' => 16,
                'timestamp' => 17,
                'integer64' => 18,
                'maxkey' => 127,
                'minkey' => 255,
            );

            $type = isset($map[$type]) ? $map[$type] : $type;
        }

        return $this->operator('$type', $type);
    }
664522
public function getType(string $type): Type
    {
        if (isset($this->types[$type])) {
            return $this->types[$type];
        }

        $instance = $this->createType($type);
        $this->addType($instance);
        $this->types[$type] = $instance;

        return $instance;
    }
1104654
protected function typeToSystemType($type)
    {
        /*
        'emergency' => 7,
        'alert'     => 6,
        'critical'  => 5,
        'error'     => 4,
        'warning'   => 3,
        'notice'    => 2,
        'info'      => 1,
        'debug'     => 0,
         */
        switch ($type) {
            case 'emergency':
                $type = LOG_EMERG;
                break;
            case 'alert':
                $type = LOG_ALERT;
                break;
            case 'critical':
                $type = LOG_CRIT;
                break;
            case 'error':
                $type = LOG_ERR;
                break;
            case 'warning':
                $type = LOG_WARNING;
                break;
            case 'notice':
                $type = LOG_NOTICE;
                break;
            case 'info':
                $type = LOG_INFO;
                break;
            default:
            case 'debug':
                $type = LOG_DEBUG;
                break;
        }

        return $type;
    }
729386
protected function _getInheritanceTypeString($type)
    {
        switch ($type) {
            case ClassMetadataInfo::INHERITANCE_TYPE_NONE:
                return 'NONE';

            case ClassMetadataInfo::INHERITANCE_TYPE_JOINED:
                return 'JOINED';

            case ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE:
                return 'SINGLE_TABLE';

            case ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS:
                return 'PER_CLASS';
        }
    }
1321784
public function getType($type)
    {
        if (!$this->hasType($type)) {
            $this->metaTypeList[$type] = new $type();
        }

        return $this->metaTypeList[$type];
    }
179654
public function getServiceNamesByType($type)
    {
        if (!$this->hasServices()) {
            return [];
        }
        $types = [];
        $services = $this->getServices();

        foreach ($services as $name => $service) {
            if ($service['type'] !== $type) {
                continue;
            }
            $types[] = $name;
        }

         return $types;
    }
806502
private function converType($type) {
        switch (strtolower($type)) {
            case 'd':
                $typeSum = 'day';
                break;
            case 'm':
                $typeSum = 'month';
                break;
            case 'y':
                $typeSum = 'year';
                break;
            case 'h':
                $typeSum = 'hour';
                break;
            case 'i':
                $typeSum = 'minute';
                break;
            case 's':
                $typeSum = 'second';
                break;
        }
        return $typeSum;
    }
390571
protected function type($type)
    {
        $type = strtolower($type);
        switch ($type) {
                case 'success':
                    $type = 'success';
                    break;
                case 'error':
                    $type = 'danger';
                    break;
                case 'information':
                    $type = 'info';
                    break;
                case 'warning':
                    $type = 'warning';
                    break;
                case 'primary':
                    $type = 'primary';
                    break;
                case 'secondary':
                    $type = 'secondary';
                    break;
                case 'dark':
                    $type = 'Dark';
                    break;
                default:
                    $type = 'light';
                    break;
            }
        $this->type = $type;
    }
1318802
private function getTypeXml($type)
    {
        if (!isset($this->styles[$type])) {
            return "<{$type}/>";
        }

        return sprintf(StyleXml::BORDER_TYPE_XML,
            $type, $this->styles[$type], $this->colors[$type], $type);
    }
100205
private static function getClassByType($type)
    {
        if (!isset(self::$types[$type])) {
            throw new UnknownMessageException(
                'Unable to parse message because type ('.$type.')'
                .' is not mapped.'
            );
        }

        return self::$types[$type];
    }
250544
protected function normalizeType(string $type) : string
    {
        $type = ltrim($type, '\\');
        foreach (self::module()->namespaces as $name => $namespace) {
            if (strpos($type, $namespace->getClassNamespace()) !== false) {
                return $name . substr($type, strlen($namespace->getClassNamespace()) + 1);
            }
        }

        return null;
    }
463385
protected function formatType($type)
    {
        if (preg_match('/^(?:(.*)\.)?_(.*)$/', $type, $matches)) {
            if ($matches[1] !== '') {
                return sprintf("%s.%s[]", $matches[1], $matches[2]);
            } else {
                return $matches[2].'[]';
            }
        } else {
            return $type;
        }
    }
711835
protected function getTypeForString($type)
    {
        switch ($type) {
            case 'string':
                return DataTypes::STRING_TYPE;
            case 'number':
                return DataTypes::NUMBER_TYPE;
            case 'date':
            case 'datetime':
                return DataTypes::DATETIME_TYPE;
            case 'boolean':
                return DataTypes::BOOLEAN_TYPE;
            case 'tags':
                return DataTypes::TAGS_TYPE;
            case 'auto-complete':
                return DataTypes::AUTO_COMPLETE_TYPE;
            default:
                return DataTypes::UNDEFINED_TYPE;
        }
    }
1164853
protected function getCasting($type)
    {
        if ($type instanceof \Doctrine\DBAL\Types\DecimalType or $type instanceof
            \Doctrine\DBAL\Types\FloatType
        ) {
            return 'double';
        } else {
            if ($type instanceof \Doctrine\DBAL\Types\IntegerType or $type instanceof \Doctrine\DBAL\Types\BigIntType or $type instanceof
                \Doctrine\DBAL\Types\SmallIntType
            ) {
                return 'int';
            }
        }
    }
382494
private static function validateMiddlewareType(string $type) : string
  {
    if (!in_array($type, self::MIDDLEWARE_TYPES)) {
      throw new \InvalidArgumentException(sprintf(
        'Provided middleware type does not exist. Use one of %s instead.',
        implode(', ', self::MIDDLEWARE_TYPES)
      ));
    }

    return $type;
  }