Skip to content
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

UndefinedMethod not reported when "parent" used in callable #10836

Closed
kkmuffme opened this issue Mar 16, 2024 · 1 comment · Fixed by #10838
Closed

UndefinedMethod not reported when "parent" used in callable #10836

kkmuffme opened this issue Mar 16, 2024 · 1 comment · Fixed by #10838

Comments

@kkmuffme
Copy link
Contributor

kkmuffme commented Mar 16, 2024

https://psalm.dev/r/579ba0cca7

Copy link

psalm-github-bot bot commented Mar 16, 2024

I found these snippets:

https://psalm.dev/r/579ba0cca7
<?php
class A {
 	public function __construct() {
     	$this->run( 'parent::hello' ); // should be an error
        $this->run( ['parent', 'hello'] ); // should be an error
        $this->run( 'self::hello' );
        $this->run( ['self', 'hello'] );
    }
    
    /**
     * @param callable $callable
     * @return void
     */
    public function run($callable) {
        call_user_func($callable);
    }
}

new A();
Psalm output (using commit ef3b018):

ERROR: UndefinedMethod - 6:21 - Method A::hello does not exist

ERROR: UndefinedMethod - 7:21 - Method A::hello does not exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant