/** * @param ReflectionParameter $parameter * @return Type */ function __internal_getParameterType(ReflectionParameter $parameter) { if (!isset($this->parameterTypeCache[$parameter->name])) { if (!$this->initialized) { $this->initialize(); } if (isset($this->parseResult->parameter[$parameter->getName()])) { $typeStr = $this->parseResult->parameter[$parameter->getName()]->type; $type = Type::of($typeStr, $this->resolver); } else { $typeHintedClass = $parameter->getClass(); if ($typeHintedClass !== null) { $type = Type::byReflectionClass($typeHintedClass); } else { $type = Type::ofMixed(); } if ($parameter->allowsNull()) { $type = Type::ofNullable($type); } } $this->parameterTypeCache[$parameter->name] = $type; } return $this->parameterTypeCache[$parameter->name]; }
/** * @param ReflectionMethod $method * @return MethodInfo */ public static function create(ReflectionMethod $method) { $declaringType = Type::byReflectionClass($method->getDeclaringClass()); return new MethodInfo($declaringType, $method); }