forked from phpmetrics/PhpMetrics
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use class_alias to load php5 or php7 code
Fixes phpmetrics#360
Showing
3 changed files
with
58 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace Hal\Component\Ast; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\NodeTraverser as Mother; | ||
|
||
class Php5NodeTraverser extends Mother | ||
{ | ||
/** @var Traverser */ | ||
private $traverser; | ||
|
||
public function __construct($cloneNodes = false, $stopCondition = null) | ||
{ | ||
parent::__construct(); | ||
$this->traverser = new Traverser($this, $stopCondition); | ||
} | ||
|
||
public function traverseNode(Node $node) | ||
{ | ||
return parent::traverseNode($node); | ||
} | ||
|
||
protected function traverseArray(array $nodes) | ||
{ | ||
return $this->traverser->traverseArray($nodes, $this->visitors); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace Hal\Component\Ast; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\NodeTraverser as Mother; | ||
|
||
class Php7NodeTraverser extends Mother | ||
{ | ||
/** @var Traverser */ | ||
private $traverser; | ||
|
||
public function __construct($cloneNodes = false, $stopCondition = null) | ||
{ | ||
parent::__construct(); | ||
$this->traverser = new Traverser($this, $stopCondition); | ||
} | ||
|
||
public function traverseNode(Node $node): Node | ||
{ | ||
return parent::traverseNode($node); | ||
} | ||
|
||
protected function traverseArray(array $nodes): array | ||
{ | ||
return $this->traverser->traverseArray($nodes, $this->visitors); | ||
} | ||
} |