WordPress / WordPress/phpdoc-parser
DocBlocks for filters inside a conditional expression are not imported
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 239
- Forks
- 81
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 8
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two PHP examples and tracing how apply_filters calls inside conditional expressions are associated with DocBlocks. Compare the parser's result for both examples with the expected filter documentation, including wp_save_post_revision_check_for_changes. Done means DocBlock 2 is assigned to in_conditional_expression and the correct DocBlock is assigned to in_conditional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100