Skip to content

DocBlock for hooks not parsed correctly in some cases #217

@pbiron

Description

@pbiron

While parsing the source for a plugin, I came across a case where the DocBlock for a hook isn't parsed correctly.

The code contains the following:

/**
 * Filters the filename to be required.
 *
 * @since 1.2.3
 *
 * @param string $filename The filename to require.
 */
require apply_filters( 'my-filter', 'some filename' );

The hook gets imported (including the description), but for some reason the @since tag is not. Instead, @since tags from the file-level DocBlock are associated with the hook.

Changing the code to the equivalent:

/**
 * Filters the filename to be required.
 *
 * @since 1.2.3
 *
 * @param string $filename The filename to require.
 */
$filename = apply_filters( 'my-filter', 'some filename' );
require $filename;

works just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions