-
-
Notifications
You must be signed in to change notification settings - Fork 640
Description
Follow up on #4012
Expected behavior
That a "name" type which is annotated in their fully qualified form in a docblock, stays in that form when presented in the documentation.
Actual behavior
namespace Foo;
class Bar {
/**
* @param string|\Stringable $s
*/
function baz($s) {}
}... results in an argument list entry of:
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$s</span>
: <span class="phpdocumentor-argument-list__argument__type">string|<abbr title="\Foo\Stringable">Stringable</abbr></span>
</dt>Take note of the fully qualified \Stringable from the docblock becoming \Foo\Stringable in the <abbr> tag.
Steps to reproduce the problem
Given the following code:
namespace WpOrg\Requests;
use WpOrg\Requests\Exception\InvalidArgument;
use WpOrg\Requests\Utility\InputValidator;
final class Ipv6 {
/**
* Uncompresses an IPv6 address
*
* @param string|\Stringable $ip An IPv6 address
* @return string The uncompressed IPv6 address
*
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object.
*/
public static function uncompress($ip) {
// Do something.
}
}And generating the docs like so:
phpDocumentor
... with the following quite plain config: https://github.com/WordPress/Requests/blob/develop/phpdoc.dist.xml
With phpDocumentor 3.9.1, the output looks like so:
Relevant example lines in committed generated docs:
- https://github.com/WordPress/Requests/blob/07b5ef970b07c921a406da6ba3d205f5fafe8af6/api-2.x/classes/WpOrg-Requests-Ipv6.html#L388
- https://github.com/WordPress/Requests/blob/07b5ef970b07c921a406da6ba3d205f5fafe8af6/api-2.x/classes/WpOrg-Requests-Ipv6.html#L404
I've tried to trace this back to a specific phpDocumentor version, but haven't been able to. Looks like this has been happening since we switched to phpDocumentor (3.x) four years ago.
Your environment
- Version used: 3.9.1
- Install method: in GitHub Actions via setup-php
- PHP version: 8.1
- Operating system and version: Ubuntu 24.04 (GHA)
- Link to your project: https://github.com/WordPress/Requests