Improve parsing of namespaces
Summary:
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/):
{F973991, size=full}
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.
Test Plan:
Added unit tests. Also inspected the AST after this change:
{F973992, size=full}
Reviewers: jim_reed, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: JolanYacht, Korvin
Differential Revision: https://secure.phabricator.com/D14498