protected static make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : |
||
$namespace | string | The (optional) namespace of the type such as '\' or '\Phan\Language'. |
$type_name | string | |
$template_parameter_type_list | UnionType[] | A (possibly empty) list of template parameter types |
리턴 | A single canonical instance of the given type. |
/** * @return Type * A variation of this type that is not generic. * i.e. 'int[]' becomes 'int'. */ public function genericArrayElementType() : Type { assert($this->isGenericArray(), "Cannot call genericArrayElementType on non-generic array"); if (($pos = strpos($this->name, '[]')) !== false) { assert($this->name !== '[]' && $this->name !== 'array', "Non-generic type '{$this->name}' requested to be non-generic"); return Type::make($this->getNamespace(), substr($this->name, 0, $pos)); } return $this; }
/** * @return Type * A variation of this type that is not generic. * i.e. 'int[]' becomes 'int'. */ public function genericArrayElementType() : Type { assert($this->isGenericArray(), "Cannot call genericArrayElementType on non-generic array"); if (($pos = strrpos($this->getName(), '[]')) !== false) { assert($this->getName() !== '[]' && $this->getName() !== 'array', "Non-generic type requested to be non-generic"); return Type::make($this->getNamespace(), substr($this->getName(), 0, $pos), $this->template_parameter_type_list); } return $this; }