Closed Flyingmana closed 13 years ago
The declaration is wrong. While obviously PHP does not complain about that syntax when doing a lint, the leading \ is bogus and not valid php code. I'm not convinced that is something phpab should handle. I could of course add an exception to bail out but since the file doesn't load, it's not going to work either way on production.
what is about throwing an error for a "malformed" namespace?
I could add that of course but I actually consider that a PHP Parser bug for that definition doesn't make any sense and should fail at parse time. If you try to run code that has that type of definition, you get a fatal error for an undefined constant. This is beyond phpab's job to validate - let alone fix. But I'll consider opening a PHP bug on it.
As broken as it may be, the syntax is valid - though not to define a namespace: http://docs.php.net/manual/en/language.namespaces.nsconstants.php
I'll check whether or not I have to deal with this in any way within phpab.
thx for your effort about this
Commit 112339f0c48be96b8d14 fixes the issues triggered by the inline use of the namespace keyword. Again, using namespace \a\b; does not define a namespace a\b but accesses a constant a\b within the current namespace.
phpab will be able to parse this properly coming the next release.
phpap cant handle namespaces which are declared the following way
namespace \test\me;