An open API service indexing awesome lists of open source software.

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

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;
}
}

```