public function testGetParameterDescription() { $class = new ClassReflection("\\Magento\\Framework\\Reflection\\Test\\Unit\\DataObject"); $methodReflection = $class->getMethod('setName'); $paramsReflection = $methodReflection->getParameters(); $this->assertEquals('Name of the attribute', $this->_typeProcessor->getParamDescription($paramsReflection[0])); }
/** * Retrieve method interface and documentation description. * * @param \Zend\Code\Reflection\MethodReflection $method * @return array * @throws \InvalidArgumentException */ public function extractMethodData(\Zend\Code\Reflection\MethodReflection $method) { $methodData = ['documentation' => $this->extractMethodDescription($method), 'interface' => []]; /** @var \Zend\Code\Reflection\ParameterReflection $parameter */ foreach ($method->getParameters() as $parameter) { $parameterData = ['type' => $this->_typeProcessor->register($this->_typeProcessor->getParamType($parameter)), 'required' => !$parameter->isOptional(), 'documentation' => $this->_typeProcessor->getParamDescription($parameter)]; if ($parameter->isOptional()) { $parameterData['default'] = $parameter->getDefaultValue(); } $methodData['interface']['in']['parameters'][$parameter->getName()] = $parameterData; } $returnType = $this->_typeProcessor->getGetterReturnType($method); if ($returnType != 'void' && $returnType != 'null') { $methodData['interface']['out']['parameters']['result'] = ['type' => $this->_typeProcessor->register($returnType['type']), 'documentation' => $returnType['description'], 'required' => true]; } return $methodData; }