https://github.com/tpunt/php-ast-reverter
Reverts the php-ast AST back into (somewhat) PSR-compliant code
https://github.com/tpunt/php-ast-reverter
ast php-ast pretty-printer
Last synced: 6 months ago
JSON representation
Reverts the php-ast AST back into (somewhat) PSR-compliant code
- Host: GitHub
- URL: https://github.com/tpunt/php-ast-reverter
- Owner: tpunt
- License: mit
- Created: 2015-08-26T22:12:02.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T08:46:06.000Z (almost 7 years ago)
- Last Synced: 2025-03-28T15:51:49.521Z (6 months ago)
- Topics: ast, php-ast, pretty-printer
- Language: PHP
- Homepage:
- Size: 64.5 KB
- Stars: 52
- Watchers: 5
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-ast-reverter
A tool that reverts an abstract syntax tree (AST) produced by the
[php-ast](https://github.com/nikic/php-ast) extension back into (somewhat)
PSR-compliant code. This enables for code preprocessing to be done.Requirements:
- PHP 7.*
- [php-ast](https://github.com/nikic/php-ast) extension (compatible with
versions 30, 35, 40, 45, and 50)## Installation
### Composer
```
composer require tpunt/php-ast-reverter
```## Example
Running the following code snippet:
```php
prop = $arg;
}
}
end;$ast = ast\parse_code($code, $version=40);
echo (new AstReverter\AstReverter)->getCode($ast);
```Will output:
```php
prop = $arg;
}
}```