-
Notifications
You must be signed in to change notification settings - Fork 659
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
First Class Callable: Catch UndefinedMethod #10170
Labels
Comments
I found these snippets: https://psalm.dev/r/b6bb608bf8<?php
class FuncLib {
public static function MyFunc(): void {
echo "MyFunc";
}
}
class A {
/** @var Closure */
public $callbackWillWork;
/** @var Closure */
public $callbackBroken;
public function __construct() {
$this->callbackWillWork = FuncLib::MyFunc(...);
$this->callbackBroken = FuncLib::DOES_NOT_EXIST(...);
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/b6bb608bf8
This syntax under the hood uses Closure::fromCallable, which will bind to the current scope. It seems like we should be able to statically answer if a method/class would be undefined.
The text was updated successfully, but these errors were encountered: