-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
Description
This code passes (if $a is an array<mixed> and Foo::bar() is a method)
if ($a['b'] instanceof Foo) {
$a['b']->bar();
}but this code (assuming $b is defined) emits a MixedMethodCall issue:
if ($a[$b] instanceof Foo) {
$a[$b]->bar();
}It currently fails because Psalm does not allow array fetches with variable-key-offsets to be considered scoped variables. But we should adapt Psalm to allow variable-key array offsets, and then remove those variables from Context::$vars_in_scope when either the array is modified or the key variable is modified.
Related (slightly) to #11
Reactions are currently unavailable