-
Notifications
You must be signed in to change notification settings - Fork 661
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
Callable should only allow public methods if used as arg in a non-$this/self context #10823
Labels
Comments
I found these snippets: https://psalm.dev/r/7a6d5d9849<?php
/**
* @param callable $arg
* @return void
*/
function foo($arg) {
call_user_func($arg);
}
class A {
public function __construct() {
foo(array($this, 'run')); // this should be an error, since it's a fatal
$this->bar(array($this, 'run')); // this is fine
}
private function run() : void {
echo "done";
}
/**
* @param callable $arg
* @return void
*/
protected function bar($arg) {
call_user_func($arg);
}
}
$a = new A();
|
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Mar 19, 2024
…urrent context Fix vimeo#10823 Fix vimeo#8509
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Mar 19, 2024
…urrent context Fix vimeo#10823 Fix vimeo#8509
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Mar 19, 2024
…urrent context Fix vimeo#10823 Fix vimeo#8509
weirdan
pushed a commit
to kkmuffme/psalm
that referenced
this issue
Mar 20, 2024
…urrent context Fix vimeo#10823 Fix vimeo#8509
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/7a6d5d9849
The text was updated successfully, but these errors were encountered: