-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixes #39, better names in messages and output * Uses correct name in json otput
- Loading branch information
1 parent
ee37a81
commit c0262fb
Showing
5 changed files
with
64 additions
and
16 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
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,31 @@ | ||
<?php | ||
|
||
namespace NdB\PhpDocCheck\NodeVisitors; | ||
|
||
class ParentConnector extends \PhpParser\NodeVisitorAbstract | ||
{ | ||
private $stack; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function beforeTraverse(array $nodes) | ||
{ | ||
$this->stack = []; | ||
} | ||
public function enterNode(\PhpParser\Node $node) | ||
{ | ||
if (!empty($this->stack)) { | ||
$node->setAttribute('parent', $this->stack[count($this->stack)-1]); | ||
} | ||
$this->stack[] = $node; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function leaveNode(\PhpParser\Node $node) | ||
{ | ||
array_pop($this->stack); | ||
} | ||
} |
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