1
0
mirror of https://github.com/nikic/PHP-Parser.git synced 2025-07-17 20:31:28 +02:00

Add php-parse as composer bin

Renaming from php-parse.php to just php-parse to follow the usual
conventions.

Not tested.
This commit is contained in:
Nikita Popov
2015-09-21 14:39:19 +08:00
parent b2961915a6
commit c8898df3dd
2 changed files with 10 additions and 4 deletions

13
bin/php-parse.php → bin/php-parse Executable file → Normal file

@@ -1,7 +1,12 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
require __DIR__ . '/../lib/bootstrap.php'; foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
if (file_exists($file)) {
require $file;
break;
}
}
ini_set('xdebug.max_nesting_level', 3000); ini_set('xdebug.max_nesting_level', 3000);
@@ -84,8 +89,8 @@ foreach ($files as $file) {
function showHelp($error) { function showHelp($error) {
die($error . "\n\n" . die($error . "\n\n" .
<<<OUTPUT <<<OUTPUT
Usage: php php-parse.php [operations] file1.php [file2.php ...] Usage: php-parse [operations] file1.php [file2.php ...]
or: php php-parse.php [operations] "<?php code" or: php-parse [operations] "<?php code"
Turn PHP source code into an abstract syntax tree. Turn PHP source code into an abstract syntax tree.
Operations is a list of the following options (--dump by default): Operations is a list of the following options (--dump by default):
@@ -98,7 +103,7 @@ Operations is a list of the following options (--dump by default):
-c, --with-column-info Show column-numbers for errors (if available) -c, --with-column-info Show column-numbers for errors (if available)
Example: Example:
php php-parse.php -d -p -N -d file.php php-parse -d -p -N -d file.php
Dumps nodes, pretty prints them, then resolves names and dumps them again. Dumps nodes, pretty prints them, then resolves names and dumps them again.

@@ -21,6 +21,7 @@
"PhpParser\\": "lib/PhpParser" "PhpParser\\": "lib/PhpParser"
} }
}, },
"bin": ["bin/php-parse"],
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0-dev" "dev-master": "2.0-dev"