Dependency updates and update version number

This commit is contained in:
Kode
2018-06-13 19:35:28 +01:00
parent 18ec208381
commit e3ec7de23a
1261 changed files with 45582 additions and 29687 deletions

View File

@@ -26,9 +26,9 @@ if (empty($files)) {
showHelp("Must specify at least one file.");
}
$lexer = new PhpParser\Lexer\Emulative(array('usedAttributes' => array(
$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => [
'startLine', 'endLine', 'startFilePos', 'endFilePos', 'comments'
)));
]]);
$parser = (new PhpParser\ParserFactory)->create(
PhpParser\ParserFactory::PREFER_PHP7,
$lexer
@@ -38,7 +38,6 @@ $dumper = new PhpParser\NodeDumper([
'dumpPositions' => $attributes['with-positions'],
]);
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
$serializer = new PhpParser\Serializer\XML;
$traverser = new PhpParser\NodeTraverser();
$traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver);
@@ -82,9 +81,9 @@ foreach ($files as $file) {
} elseif ('pretty-print' === $operation) {
echo "==> Pretty print:\n";
echo $prettyPrinter->prettyPrintFile($stmts), "\n";
} elseif ('serialize-xml' === $operation) {
echo "==> Serialized XML:\n";
echo $serializer->serialize($stmts), "\n";
} elseif ('json-dump' === $operation) {
echo "==> JSON dump:\n";
echo json_encode($stmts, JSON_PRETTY_PRINT), "\n";
} elseif ('var-dump' === $operation) {
echo "==> var_dump():\n";
var_dump($stmts);
@@ -116,7 +115,7 @@ Operations is a list of the following options (--dump by default):
-d, --dump Dump nodes using NodeDumper
-p, --pretty-print Pretty print file using PrettyPrinter\Standard
--serialize-xml Serialize nodes using Serializer\XML
-j, --json-dump Print json_encode() result
--var-dump var_dump() nodes (for exact structure)
-N, --resolve-names Resolve names using NodeVisitor\NameResolver
-c, --with-column-info Show column-numbers for errors (if available)
@@ -135,13 +134,13 @@ OUTPUT
}
function parseArgs($args) {
$operations = array();
$files = array();
$attributes = array(
$operations = [];
$files = [];
$attributes = [
'with-column-info' => false,
'with-positions' => false,
'with-recovery' => false,
);
];
array_shift($args);
$parseOptions = true;
@@ -160,8 +159,9 @@ function parseArgs($args) {
case '-p':
$operations[] = 'pretty-print';
break;
case '--serialize-xml':
$operations[] = 'serialize-xml';
case '--json-dump':
case '-j':
$operations[] = 'json-dump';
break;
case '--var-dump':
$operations[] = 'var-dump';
@@ -198,5 +198,5 @@ function parseArgs($args) {
}
}
return array($operations, $files, $attributes);
return [$operations, $files, $attributes];
}