1
0
mirror of https://github.com/danog/phpdoc.git synced 2024-11-29 20:19:03 +01:00

Add more features

This commit is contained in:
Daniil Gentili 2023-06-13 21:18:41 +02:00
parent 6130ea30c5
commit 15526bf1eb
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 17 additions and 7 deletions

View File

@ -172,6 +172,18 @@ class PhpDoc
return $this; return $this;
} }
/**
* Resolve type aliases.
*
* @return void
*/
public function resolveAliases(): void
{
$classList = ClassFinder::getClassesInNamespace($this->namespace, $this->mode);
foreach ($classList as $class) {
$this->addTypeAliases($class);
}
}
/** /**
* Run documentor. * Run documentor.
* *
@ -179,10 +191,8 @@ class PhpDoc
*/ */
public function run(): self public function run(): self
{ {
$this->resolveAliases();
$classList = ClassFinder::getClassesInNamespace($this->namespace, $this->mode); $classList = ClassFinder::getClassesInNamespace($this->namespace, $this->mode);
foreach ($classList as $class) {
$this->addTypeAliases($class);
}
$namespaces = []; $namespaces = [];
foreach ($this->useMap as $orig => $aliases) { foreach ($this->useMap as $orig => $aliases) {
$class = \str_replace('\\', '/', $orig); $class = \str_replace('\\', '/', $orig);

View File

@ -135,10 +135,10 @@ class MethodDoc extends GenericDoc
public function getSignatureAnchor(): string public function getSignatureAnchor(): string
{ {
$sig = $this->getSignature(); $sig = $this->getSignature();
$sigLink = strtolower($sig); $sigLink = \strtolower($sig);
$sigLink = preg_replace('/[^\w ]+/', ' ', $sigLink); $sigLink = \preg_replace('/[^\w ]+/', ' ', $sigLink);
$sigLink = preg_replace('/ +/', ' ', $sigLink); $sigLink = \preg_replace('/ +/', ' ', $sigLink);
$sigLink = str_replace(' ', '-', $sigLink); $sigLink = \str_replace(' ', '-', $sigLink);
return $sigLink; return $sigLink;
} }
/** /**