这不是我首选的解决方案,但我设法快速修补 ApiGen 来为我解决问题:
--- apigen/apigen/src/Templating/Filters/Helpers/ElementLinkFactory.php.orig Do Aug 13 14:51:13 2015
+++ apigen/apigen/src/Templating/Filters/Helpers/ElementLinkFactory.php Do Aug 13 14:51:33 2015
@@ -39,6 +39,7 @@ class ElementLinkFactory
$this->linkBuilder = $linkBuilder;
}
+ private $FULLY_QUALIFIED_NAMES=false;
/**
* @return string
@@ -75,7 +76,7 @@ class ElementLinkFactory
{
return $this->linkBuilder->build(
$this->elementUrlFactory->createForClass($reflectionClass),
- $reflectionClass->getName(),
+ $this->FULLY_QUALIFIED_NAMES ? $reflectionClass->getName() : $reflectionClass->getShortName(),
TRUE,
$classes
);
@@ -89,7 +90,7 @@ class ElementLinkFactory
{
return $this->linkBuilder->build(
$this->elementUrlFactory->createForMethod($reflectionMethod),
- $reflectionMethod->getDeclaringClassName() . '::' . $reflectionMethod->getName() . '()',
+ ( $this->FULLY_QUALIFIED_NAMES ? $reflectionMethod->getDeclaringClass()->getName() : $reflectionMethod->getDeclaringClass()->getShortName() ) . '::' . ( $this->FULLY_QUALIFIED_NAMES ? $reflectionMethod->getName() : $reflectionMethod->getShortName()) . '()',
FALSE,
$classes
);
该补丁使其使用getShortName()
而不是getName()
在已解析的类上使用。