Skip to content

Clean template fails to show @uses if no description is provided in DocBlock #3943

@NabeelKhanYYC

Description

@NabeelKhanYYC

#When using the clean template @uses references are not displayed unless a description is provided.

Steps to Replicate:

  1. Create function and add a DocBlock with the @uses tag like:
/**
 * Method to show bug with uses tag in phpDocumentor
 * 
 * @access public
 * @uses SomeNamespace\SomeClass::SomeMethod()
 * @return void
 */ 
  1. Generate documentation using the clean template
  2. Navigate to the method in generated documentation and note in the sidebar an empty uses
  3. Update the DocBlock as follows
/**
 * Method to show bug with uses tag in phpDocumentor
 * 
 * @access public
 * @uses SomeNamespace\SomeClass::SomeMethod() Now you can see me!
 * @return void
 */ 
  1. Generate documentation using the clean template.
  2. Navigate to the method in generated documentation and note in the sidebar the uses is populated with "Now you can see me!" and clicking will navigate to SomeNamespace\SomeClass::SomeMethod()
  3. Update the DocBlock to the one in step 1 above.
  4. Generate documentation using the default template
  5. Navigate to the method in generated documentation and note proper reference of @uses

Suggested Fix:
It appears that the issue is due to the template using the @uses description rather than the tag itself when rendering. Fixing the template to use the tag itself should resolve the issue.

I anticipate the code site in question is here:

{# Uses Section #}
{% set uses_tags = property.tags['uses'] %}
{% if uses_tags is not empty %}
<dt>Uses</dt>
{% for tag in uses_tags %}
<dd><a href="{{ tag.reference|route('url') }}"><span class="namespace-wrapper">{{ tag.description ?: tag.reference }}</span></a></dd>
{% endfor %}
{% endif %}

Version: phpDocumentor v3.8.0

Search Tags:

  • phpdocumentor @uses
  • phpdocumentor uses not working
  • phpdocumentor uses not rendering
  • phpdocumentor uses display bug
  • phpdocumentor uses template bug

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