-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix name context on no namespace #1067
base: master
Are you sure you want to change the base?
Conversation
Ready to merge 👍 |
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.
I don't think this change is correct. Outside a namespace we should still fully resolve to full qualified names. Unqualified names should only be left if resolution is impossible (due to global fallback) or because of special class names.
the verification of fully qualified already checked before check on line 114, so I think that's safe |
@@ -117,8 +117,8 @@ public function testResolveNames(): void { | |||
new \Hallo\Bar(); | |||
new \Bar(); | |||
new \Bar(); | |||
\bar(); | |||
\hi(); | |||
bar(); |
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.
This is what I mean. This should resolve to a fully qualified name. The fact that it is equivalent to the unqualified name doesn't matter, we should always resolve fully if it is possible.
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.
if i understand correctly, the test is removing namespace, which no longer has namespace, means it doesn't have \\
prefix, next line to it, it have \bar
which not changed as already fully qualified on the first place, which expexted.
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.
see line 124 which kept to have \\
prefix as it previously already fully qualified.
Ref https://getrector.com/ast/d50f4d493f7061f3c419397a744a49e92409c3ce?nodeId=1
which
\true
should betrue
on no namespace.