Currently PHP namespaces are parsed in two different ways, depending on the syntax used. For example, consider the following example:
<?php namespace A; class B {} namespace A\B\C { class D {} } namespace { class A {} }
This is currently parsed by XHPAST as follows (see https://secure.phabricator.com/xhpast/view/915/):
This generally makes it difficult to determine the namespace in which a class is declared (unless the namespace is defined using the namespace { ... } syntax, which is somewhat rare). Instead, always parse namespaces as if they were of the namespace { ... } form.