-
Notifications
You must be signed in to change notification settings - Fork 462
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
allow $isOffsetAccessible->maybe()
for isUndefinedExpressionAllowed and isSpecified expression
#1312
Conversation
…or isSpecified expression
…(even they are valid)
This reverts commit 7770a18.
!$isOffsetAccessible->yes()
for isUndefinedExpressionAllowed …$isOffsetAccessible->maybe()
for isUndefinedExpressionAllowed and isSpecified expression
I think I understood it. |
@@ -55,7 +55,7 @@ public function doBaz($a, $b): void | |||
*/ | |||
public function iterableOffset($iterable): void | |||
{ | |||
unset($iterable['foo']); | |||
var_dump($iterable['foo']); |
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.
Leftover Debug output?
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.
No, I just wanted to change this line to some kind of function call that doesn’t cause isUndefinedExpressionAllowed === true
(that means something except isset, unset, empty
)
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.
Please add new code instead of changing existing tests :) Thanks.
@ondrejmirtes This change can make this code not report, and I believe this shouldn't be reported because this is a valid PHP code.
Although, I remembered now this issue phpstan/phpstan#7073 and noticed that I have to be careful for array access on object type (because it is a fatal error) and this PR needs some modification anyway. |
All of that is totally fine, I just want both unset and var_dump tested in that file. It's OK if the error for unset() changes/disappears. |
I see, thanks. |
https://3v4l.org/HrulF |
@ondrejmirtes I will implement a more strict behavior for memo |
Thank you! |
fixes phpstan/phpstan#7229