Skip to content

Add support for phpclass reference with namespace #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Reference/PhpClassReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ public function getName(): string

public function resolve(Environment $environment, string $data): ResolvedReference
{
$classnamePath = str_replace('\\', '-', strtolower($data));
return new ResolvedReference(
$environment->getCurrentFileName(),
$data,
sprintf('%s/class.%s.php', $this->phpDocUrl, strtolower($data)),
sprintf('%s/class.%s.php', $this->phpDocUrl, $classnamePath),
[],
[
'title' => $data,
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/expected/blocks/references/php-class.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<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>
<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>
2 changes: 2 additions & 0 deletions tests/fixtures/source/blocks/references/php-class.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

:phpclass:`ArrayAccess`

:phpclass:`BcMath\Number`