Skip to content

Commit

Permalink
Add support for latest v20 php-ast updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tpunt committed Sep 17, 2015
1 parent b3e34c9 commit 714b72e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/AstReverter/AstReverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,15 @@ private function cast(Node $node) : string

private function catch(Node $node) : string
{
$code = ' catch (' . $this->revertAST($node->children[0]) . ' $' . $node->children[1] . ') {' . PHP_EOL;
$code = ' catch (' . $this->revertAST($node->children[0]) . ' ';

if ($node->children[1] instanceof Node) {
$code .= $this->revertAST($node->children[1]);
} else {
$code .= '$' . $node->children[1]; // php-ast version 10 compatibility
}

$code .= ') {' . PHP_EOL;

++$this->indentationLevel;

Expand Down Expand Up @@ -1635,7 +1643,13 @@ private function sanitiseString(string $string) : string

private function static(Node $node) : string
{
$code = 'static $' . $node->children[0];
$code = 'static ';

if ($node->children[0] instanceof Node) {
$code .= $this->revertAST($node->children[0]);
} else {
$code .= '$' . $node->children[0]; // php-ast version 10 compatibility
}

if ($node->children[1] !== null) {
$code .= ' = ' . $this->revertAST($node->children[1]);
Expand Down

0 comments on commit 714b72e

Please sign in to comment.