protected function parseMethodReturnType(ClassMethod $method) { $return = []; $returnTypes = $method->getReturnTypes(); if ($returnTypes) { foreach ($returnTypes as $type) { if (isset($type['data-type'])) { $return[] = $type['data-type'] == 'variable' ? 'mixed' : $type['data-type']; } } } $returnClassTypes = $method->getReturnClassTypes(); if ($returnClassTypes) { foreach ($returnClassTypes as $key => $returnClassType) { if ($this->aliasManager->isAlias($returnClassType)) { $returnClassTypes[$key] = "\\" . $this->aliasManager->getAlias($returnClassType); } } $return = array_merge($return, $returnClassTypes); } if ($method->hasReturnTypesRaw()) { $returnClassTypes = $method->getReturnTypesRaw(); if (!empty($returnClassTypes['list'])) { foreach ($returnClassTypes['list'] as $returnType) { if (empty($returnType['cast']) || !$returnType['collection']) { continue; } $key = $returnType['cast']['value']; $type = $key; if ($this->aliasManager->isAlias($type)) { $type = "\\" . $this->aliasManager->getAlias($type); } $return[$key] = $type . '[]'; } } } if (!empty($return)) { $this->return = [implode('|', $return), '']; } }
protected function parseMethodReturnType(ClassMethod $method) { $return = array(); $returnTypes = $method->getReturnTypes(); if ($returnTypes) { foreach ($returnTypes as $type) { if (isset($type['data-type'])) { $return[] = $type['data-type'] == 'variable' ? 'mixed' : $type['data-type']; } } } $returnClassTypes = $method->getReturnClassTypes(); if ($returnClassTypes) { foreach ($returnClassTypes as $key => $returnClassType) { if ($this->aliasManager->isAlias($returnClassType)) { $returnClassTypes[$key] = "\\" . $this->aliasManager->getAlias($returnClassType); } } $return = array_merge($return, $returnClassTypes); } if ($return) { $this->return = array(join('|', $return), ''); } }