make() protected static method

protected static make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : Type
$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
return Type A single canonical instance of the given type.
Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
Archivo: Type.php Proyecto: etsy/phan
 /**
  * @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;
 }