Skip to content

Emulate the way php-ast searches for doc comments for compatibility #11

Open
@TysonAndre

Description

@TysonAndre

Only decls should have doc comments bound to them.

One way to emulate this would be to walk the tree post-order before processing, checking the comments attribute of each node, tracking the most recent doc comment.

  • If a function/method/node/const/property is seen, and doesn't have a doc comment, then add the doc comment. Clear the list of comments tracked so far, and continue traversing.
/** @param int $a */
$x = $y;
$a = function($a) {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions