-
Notifications
You must be signed in to change notification settings - Fork 544
infer non-empty-list/array after isset($arr[$i])
#4441
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
Conversation
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.
hmm interessting.. for some reason this operation makes array loose their template type.
3) PHPStan\Rules\Methods\ReturnTypeRuleTest::testBug7511
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'
+'48: Method Bug7511\HelloWorld::computeForFrontByPosition() should return array<T of Bug7511\PositionEntityInterface&Bug7511\TgEntityInterface> but returns array<Bug7511\PositionEntityInterface&Bug7511\TgEntityInterface>.
'
/Users/m.staab/dvl/phpstan-src/src/Testing/RuleTestCase.php:179
/Users/m.staab/dvl/phpstan-src/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php:759
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 think the root cause of this errors is, that setExistingOffset on a array<TemplateIntersectionType> leads to a array<IntersectionType> in
analog #4440 but for
isset($arr[$i])closes phpstan/phpstan#13674