Skip to content

Commit 720b52b

Browse files
committed
feature #190 Add support for phpclass reference with namespace (alamirault)
This PR was merged into the main branch. Discussion ---------- Add support for phpclass reference with namespace PHP have now classes with namespaces but it is not supported by `:phpclass:` reference yet https://www.php.net/manual/en/class.bcmath-number.php Commits ------- 9a75cd7 Add support for phpclass reference with namespace
2 parents 4cac105 + 9a75cd7 commit 720b52b

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/Reference/PhpClassReference.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ public function getName(): string
2929

3030
public function resolve(Environment $environment, string $data): ResolvedReference
3131
{
32+
$classnamePath = str_replace('\\', '-', strtolower($data));
3233
return new ResolvedReference(
3334
$environment->getCurrentFileName(),
3435
$data,
35-
sprintf('%s/class.%s.php', $this->phpDocUrl, strtolower($data)),
36+
sprintf('%s/class.%s.php', $this->phpDocUrl, $classnamePath),
3637
[],
3738
[
3839
'title' => $data,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
<p><a href="https://secure.php.net/manual/en/class.arrayaccess.php" class="reference external" title="ArrayAccess" rel="external noopener noreferrer" target="_blank">ArrayAccess</a></p>
2+
<p><a href="https://secure.php.net/manual/en/class.bcmath-number.php" class="reference external" title="BcMath\Number" rel="external noopener noreferrer" target="_blank">BcMath\Number</a></p>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11

22
:phpclass:`ArrayAccess`
3+
4+
:phpclass:`BcMath\Number`

0 commit comments

Comments
 (0)