Using PHP-Parser, when I am traversing the nodes in a program, how do I find the type of an object? For example, in the program below, when I encounter the node $a->some_method(); how do I find that $a's type is 'TestClass' ?
$a = new TestClass();
$a->some_method();
Now, I know that I can keep track internally that the object $a is of the type TestClass and that works fine for programs in a single file, but I'm not sure how to keep track of the type of an object in programs that span multiple files and I'm particularly confused about how to maintain the type of a variable when it is returned from a function or method. Am I going about it all wrong? Is there a simpler way using PHP-Parser to find out the type of an object?