public function getType(string $name) : BaseNode { if (isset($this->types[$name])) { $type = new $this->types[$name](); $type->setTypeHandler($this); return $type; } if ($this->isScalarCollectionType($name)) { $type = new ScalarCollectionNode(); $type->setType($this->getCollectionType($name)); $type->setTypeHandler($this); return $type; } if ($this->isClassType($name)) { $type = new ObjectNode(); $type->setType($name); $type->setTypeHandler($this); $type->setInstantiator($this->defaultInstantiator); return $type; } if ($this->isCollectionType($name)) { $type = new CollectionNode(); $type->setType($this->getCollectionType($name)); $type->setTypeHandler($this); $type->setInstantiator($this->defaultInstantiator); return $type; } throw new \InvalidArgumentException('Unknown type name: ' . $name); }