TysonAndre / php-parser-to-php-ast

Abandoned. Supports only PHPParser 3. convert PHPParser\Node to \ast\Node. See https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/ for better error tolerance.
MIT License
1 stars 2 forks source link

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

Open TysonAndre opened 7 years ago

TysonAndre commented 7 years ago

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.

/** @param int $a */
$x = $y;
$a = function($a) {
}