Skip to content

DocBlocks for filters inside a conditional expression are not imported #185

Open
@keesiemeijer

Description

@keesiemeijer

DocBlocks outside a conditional are not imported if there are other filters (with DocBlocks) within the conditional.

Example 1

In this example DocBlock 2 is not imported for the filter in_conditional_expression

/**
 * DocBlock 1
 */
function test_docblocks() {
	/**
	 * DocBlock 2
	 */
	if ( apply_filters( 'in_conditional_expression', true ) ) {
		/**
		 * DocBlock 3
		 */
		$value = apply_filters( 'in_conditional', true );
	}
}

Example 2

In this example the (wrong) DocBlock 2 is imported for the filter 'in_conditional`.

/**
 * DocBlock 1
 */
function test_docblocks() {
	/**
	 * DocBlock 2
	 */
	if ( apply_filters( 'in_conditional_expression', true ) ) {

		$value = apply_filters( 'in_conditional', true );
	}
}

The wp_save_post_revision_check_for_changes filter doesn't get its DocBlock imported because of this bug.

See this filter in trac

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions