public function testGetFullyQualifiedClassNameIfAvailable() { $class = new \ReflectionClass('\\Box\\TestScribe\\_fixture\\_input\\CalculatorUtil'); $method = $class->getMethod('calc'); $service = new MethodArgumentService(); $className = $service->getFullyQualifiedClassNameIfAvailable($method, 'calculator'); $this->assertSame('\\Box\\TestScribe\\_fixture\\_input\\Calculator', $className); }
/** * Get the type string for the given parameter name. * * @param $name * * @return \Box\TestScribe\PHPDoc\PHPDocType */ public function getParamTypeString($name) { // @TODO (ryang 5/31/14) : handle parameters with multiple types and array type. $argumentService = new MethodArgumentService(); // @TODO (ryang 12/5/14) : optimization: scan all parameters in one pass. // Check if the parameter is a class and has type information using type hinting $paramClassName = $argumentService->getFullyQualifiedClassNameIfAvailable($this->reflectionMethod, $name); if ($paramClassName) { $type = PHPDoc\PHPDocType::lookup($paramClassName); } else { // Fall back to PHPDoc $type = $this->getParamInfo($name); } return $type; }