-
-
Notifications
You must be signed in to change notification settings - Fork 942
Open
Labels
Description
Feature request
https://phpstan.org/r/5fe67304-fc83-41c3-84d1-0c019eb8b90a
$c = new class {
public function abc(): void {}
};
$s = rand(0, 1) ? 'abc' : 'not_abc';
$c->{$s}();
call_user_func([$c, $s]);
[$c, $s]();As far as I know, there are 3 ways to dynamically build a method name and invoke it. The (2) and (3) in the code example above are reported by PHPstan, whereas all three are reported in strict mode. As I think there is no semantical difference between them (I can be wrong here), I think it makes sense if PHPstan reports all of them the same way.
cc @dkarlovi
Reactions are currently unavailable