承接 tysonandre/tolerant-php-parser-to-php-ast 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tysonandre/tolerant-php-parser-to-php-ast

Composer 安装命令:

composer require tysonandre/tolerant-php-parser-to-php-ast

包简介

A pure PHP substitute for nikic/php-ast, using Microsoft/tolerant-php-parser. Can also be used to generate php-ast trees, even for files with some types of syntax errors.

README 文档

README

Build Status Latest Stable Version License

This project uses Microsoft/tolerant-php-parser to generate a tree with error tolerance, then converts from that tree to ast\Node from php-ast

This release supports AST version 70.

Usage

Using it as a slow substitute for php-ast

Using it as an error-tolerant substitute for php-ast (e.g. for use in IDEs)

  • There are currently two modes: omitting errors and adding placeholders (e.g. __INCOMPLETE_VARIABLE__).
  • Omitting errors only handles some common cases that come up while editing a file.
  • Placeholders may change in the future.
  • tests/ASTConverter/ErrorTolerantConversionTest.php
  • Phan's Language Server uses this code to do that.

Running unit tests

To run unit tests, you must install nikic/php-ast 1.0.1+ (for the expected results to be created). You must also run composer install if you haven't already done so.

  • For php 7.4, php-ast 1.0.3+ must be installed.
  • For php 8.0, php-ast 1.0.10+ must be installed.
  • Then run vendor/bin/phpunit

Possible Future Enhancements

  • Adding a mode to never accept invalid PHP (for completeness)

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固