Fix resolving of __DIR__, __NAMESPACE__ in traits#2043
Fix resolving of __DIR__, __NAMESPACE__ in traits#2043ondrejmirtes merged 5 commits intophpstan:1.9.xfrom
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
There was a problem hiding this comment.
I am wondering that we don't get a class-string here
There was a problem hiding this comment.
My guess it's not checked because a duplicate trait with the same name exists.
There was a problem hiding this comment.
Duplicate namespaces/duplicate classes
There was a problem hiding this comment.
Just use a single file used in both RuleTestCase and NodeScopeResolverTest.
There was a problem hiding this comment.
ahh good catch.
when I have some time I will work on the rule to detect duplicate namespaces :)
There was a problem hiding this comment.
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 :) |
There was a problem hiding this comment.
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
There were 2 failures: 1) PHPStan\Analyser\NodeScopeResolverTest::testFileAsserts with data set "/Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/data/bug-3019.php:11" ('type', '/Users/staabm/workspace/phpst...19.php', PHPStan\Type\Constant\ConstantStringType Object (...), PHPStan\Type\Constant\ConstantStringType Object (...), 11) Expected type string, got type 'Bug3019\\Bar' in /Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/data/bug-3019.php on line 11. Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -'string' +''Bug3019\\Bar'' /Users/staabm/workspace/phpstan-src/src/Testing/TypeInferenceTestCase.php:96 /Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/NodeScopeResolverTest.php:1150 2) PHPStan\Analyser\NodeScopeResolverTest::testFileAsserts with data set "/Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/data/bug-3019.php:12" ('type', '/Users/staabm/workspace/phpst...19.php', PHPStan\Type\Constant\ConstantStringType Object (...), PHPStan\Type\Constant\ConstantStringType Object (...), 12) Expected type string, got type 'Bug3019' in /Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/data/bug-3019.php on line 12. Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -'string' +''Bug3019'' 3) PHPStan\Rules\Comparison\UnreachableTernaryElseBranchRuleTest::testBug3019 Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -' +'09: Else branch is unreachable because ternary operator condition is always true. '