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 resolving of __DIR__, __NAMESPACE__ in traits #2043
Conversation
This pull request has been marked as ready for review. |
bd007ad
to
cc8c0ca
Compare
eda5b21
to
fe1e5ab
Compare
d724ad9
to
dac2fd9
Compare
0a4f077
to
c3b1032
Compare
fcbf700
to
8032644
Compare
{ | ||
public function doFoo(): void | ||
{ | ||
assertType('string', __CLASS__); |
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 am wondering that we don't get a class-string here
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.
My guess it's not checked because a duplicate trait with the same name exists.
@@ -0,0 +1,21 @@ | |||
<?php | |||
|
|||
namespace Bug3019; |
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.
Duplicate namespaces/duplicate classes
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.
Just use a single file used in both RuleTestCase and NodeScopeResolverTest.
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.
ahh good catch.
when I have some time I will work on the rule to detect duplicate namespaces :)
{ | ||
public function doFoo(): void | ||
{ | ||
assertType('string', __CLASS__); |
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.
My guess it's not checked because a duplicate trait with the same name exists.
should this be re-targeted for 1.10.x or will we still have 1.9.x releases before 1.10 is out? |
Yeah, sure, that's the point of these branches :) |
@@ -0,0 +1,35 @@ | |||
<?php | |||
|
|||
namespace Bug3019; |
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 verified this code still fails without the patch for both Test-cases
Nice, thank you! |
closes phpstan/phpstan#3019
the test fails without the fix like