nikic/php-ast

Unnecessarily setting `'uses' => null` for AST_METHOD and AST_FUNC_DECL

Closed this issue · 1 comments

In php 7.0-php 7.2, there isn't a function namedfunction() use($value) {}.

If I understand correctly, these are always null; they're just part of the C data structure because code is shared for methods/global functions/closures, and AST_CLOSURE does have non-null 'uses'. The fact that they are present causes some confusion.

AST_FUNC_DECL: params, uses, stmts, returnType

Desired: Document that 'uses' is always null for AST_FUNC_DECL and AST_METHOD in known php versions. Remove the property in the next ast version (55/60).

nikic commented

Sounds good to me.