Skip to content

Fully qualified non-imported classname gets presented with current namespace for mouse over #4027

@jrfnl

Description

@jrfnl

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.
	}
}

Source: https://github.com/WordPress/Requests/blob/88e570f7381a4b580f1bf8a74b490ab0d25bb429/src/Ipv6.php#L40-L45

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:

Image

Live web link: https://requests.ryanmccue.info/api-2.x/classes/WpOrg-Requests-Ipv6.html#method_uncompress

Relevant example lines in committed generated docs:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions