Skip to content

Any plans for an official API to convert from Microsoft\PHPParser\Node to \ast\Node (nikic/php-ast) and/or \PhpParser\Node (nikic/php-parser)? #113

Closed
@TysonAndre

Description

@TysonAndre

Related to #47 and #36 , didn't see anything mentioning this when searching issues.

A lot of existing tooling uses one of these two parsers, and there are potential use cases for being able to parse syntactically invalid files.

Examples of potential use cases:

  • print code style issues in addition to syntax errors, without a developer having to fix the file and run a check again. (e.g. phpcs?)
  • other static analysis tools being able to check for issues such as undefined methods, calling functions with invalid param types, etc. in other parts of syntactically invalid files
  • other code for autocompletion based on nikic/php-parser

Or, do you recommend creating a separate project depending on tolerant-php-parser?


Aside: if existing tooling needs to know something about any incomplete expressions/statements, adding a property such as $node->tolerantAST to the derived data structures may help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions