-
Notifications
You must be signed in to change notification settings - Fork 677
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
Getting a PossiblyInvalidMethodCall error complaining about a method call on a possibly other variable #8669
Comments
That's weird indeed, did you try reproducing on psalm.dev? Is it a new issue since Psalm 5 or did you already had this on Psalm 4? |
Will try and recreate now @orklah.
No, I actually had 0 errors on 4, and now I'm down to 95 XD |
Here you go, recreated https://psalm.dev/r/937ba0306a |
I found these snippets: https://psalm.dev/r/937ba0306a<?php
interface Supplier {
public function get(): iterable;
}
class SomeClass {
protected Supplier|iterable $prop;
public function __construct(Supplier|iterable $value) {
$this->prop = $value;
}
public function do(): void {
$var = $this->prop;
if ($var instanceof Supplier) {
$var->get();
}
}
}
|
Thanks all, will give you a break for a bit 🤣 |
😄 Thanks for those reports , really! Everything that can be fixed before release is a lot of pain we won't have to go through the day after ! If you have more, please post them! |
I have a value storing the following property
Then later on I have the following method.
The
$elements = $elements->get()
line is causing the following error, even though it's wrapped in aninstanceof
check.The text was updated successfully, but these errors were encountered: