WordPress / WordPress/phpdoc-parser
Wrong docblock parsed
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 239
- Forks
- 81
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 8
Description
public function cancel_action( $action_id ) {
/** @var \wpdb $wpdb */
global $wpdb;
$updated = $wpdb->update(
$wpdb->actionscheduler_actions,
array( 'status' => self::STATUS_CANCELED ),
array( 'action_id' => $action_id ),
array( '%s' ),
array( '%d' )
);
if ( empty( $updated ) ) {
/* translators: %s: action ID */
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'woocommerce' ), $action_id ) );
}
do_action( 'action_scheduler_canceled_action', $action_id );
}
it assigns the /** @var \wpdb $wpdb */ docblock to the do_action( 'action_scheduler_canceled_action', $action_id ); which is completely wrong.
If type is not FuncCall/Return_/Variable/Echo_ it must reset the last_doc to null to fix this issue.
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 parser behavior with the cancel_action snippet and trace how the /** @var \wpdb $wpdb */ docblock is retained across subsequent node types. Done means the docblock is not assigned to the do_action() call, while valid assignments to supported node types remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100