-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RootNamespaceNormalizer: empty namespace is null, not '' #68
Conversation
Otherwise it prepends leading `\` to class references inside namespace.
Was changed code covered by tests? I wonder why none of tests failed without your change. |
I'm not sure, that top-level namespace should be I like strong typing, so if talk about namespace name, it can be either empty string or |
I think test was wrong, ie. test counts with leading When you parse this by Nikic PHP Parser: namespace { class X {} } It will generate
|
Me too. It is not about empty string vs null but about object vs null. |
Could you please add a broken test? Is it a big issue for you that class name is FQDN with leading slash? Because logically FQDN with leading slash is more correct way to specify a class name. But it can be my personal taste :) |
Leading slash or not is not problem, it can be matter of personal taste, the problem is inconsistency. PhpParser never returns leading slash, but RootNamespaceNormalizer makes inconsistency and when you parse this code <?php
class X extends Y
{} some methods (I think Locator is among them) suddenly receives |
Could you check #67 (merged into the master branch). Looks like it is related to this issue too. |
Unfortunately, there are many checks in the code that verifies that instance of name object is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New version of php-parser declares top-level namespace with null
, so let's proceed with that.
The inspection completed: No new issues |
Otherwise it prepends leading
\
to class references inside namespace.