Skip to content

Instantly share code, notes, and snippets.

@rvanvelzen
Created February 13, 2014 11:15
Show Gist options
  • Save rvanvelzen/8973388 to your computer and use it in GitHub Desktop.
Save rvanvelzen/8973388 to your computer and use it in GitHub Desktop.
diff --git a/ClassFinderVisitor.php b/ClassFinderVisitor.php
index 82a4792..29e85e2 100644
--- a/ClassFinderVisitor.php
+++ b/ClassFinderVisitor.php
@@ -55,22 +55,22 @@ class ClassFinderVisitor extends \PHPParser_NodeVisitorAbstract
|| $node instanceof \PHPParser_Node_Stmt_Interface
|| $node instanceof \PHPParser_Node_Stmt_Trait
) {
- $className = (string)$node->name;
+ $className = (string)$node->namespacedName;
$this->classes[$className] = array();
$this->currentContext = $className;
}
+ }
+ public function leaveNode(\PHPParser_Node $node)
+ {
if ($node instanceof \PHPParser_Node_Stmt_ClassMethod) {
$methodName = strtolower((string)$node->name);
if ($methodName === '__construct' || $methodName === strtolower($this->currentContext)) {
$this->retrieveConstructorDependencies($node);
}
}
- }
-
- public function leaveNode(\PHPParser_Node $node)
- {
+
if ($node instanceof \PHPParser_Node_Stmt_Class
|| $node instanceof \PHPParser_Node_Stmt_Interface
|| $node instanceof \PHPParser_Node_Stmt_Trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment