fromTypeString() public static method

public static fromTypeString ( string $type ) : TypeGenerator
$type string
return TypeGenerator
 /**
  * @param  string $type
  * @return ParameterGenerator
  */
 public function setType($type)
 {
     $this->type = TypeGenerator::fromTypeString($type);
     return $this;
 }
Example #2
0
 /**
  * @param  mixed $type
  * @throws Exception\InvalidArgumentException
  * @return ParameterGenerator
  */
 public function setType($type)
 {
     if (is_array($type) && !isset($type['name'])) {
         throw new Exception\InvalidArgumentException('Type generator requires that a name is provided for this object');
     }
     if (is_array($type)) {
         $this->type = TypeGenerator::fromTypeString($type['name'], true);
         return $this;
     }
     if (is_string($type)) {
         $this->type = TypeGenerator::fromTypeString($type);
         return $this;
     }
     throw new Exception\InvalidArgumentException('Unknown parameter type passed in');
 }
 /**
  * @param string|null
  *
  * @return MethodGenerator
  */
 public function setReturnType($returnType = null)
 {
     $this->returnType = null === $returnType ? null : TypeGenerator::fromTypeString($returnType);
     return $this;
 }
 /**
  * @param $implementedInterface
  * @return self
  */
 public function removeImplementedInterface($implementedInterface)
 {
     $implementedInterface = (string) TypeGenerator::fromTypeString($implementedInterface);
     unset($this->implementedInterfaces[array_search($implementedInterface, $this->implementedInterfaces)]);
     return $this;
 }