-
Notifications
You must be signed in to change notification settings - Fork 667
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
Invalid static resolution from [class-string, 'method'] callable #5388
Labels
Comments
I found these snippets: https://psalm.dev/r/fb02f07990<?php
abstract class Foo
{
final private function __construct()
{
}
public static function create(): static
{
return new static();
}
}
final class Bar extends Foo {}
/**
* @template T
* @param callable(): T $fn
* @return T
*/
function test(callable $fn)
{
return $fn();
}
// should be Bar
$var = test([Bar::class, 'create']);
/** @psalm-trace $var */
|
Seems unrelated to class-string usage. No syntax is recognized here: |
I found these snippets: https://psalm.dev/r/3fa6de4edb<?php
abstract class Foo
{
final public function __construct()
{
}
public static function create(): static
{
return new static();
}
}
final class Bar extends Foo {}
/**
* @template T
* @param callable(): T $fn
* @return T
*/
function test(callable $fn)
{
return $fn();
}
// should be Bar
$var = test([Bar::class, 'create']);
$var = test([new Bar(), 'create']);
$var = test(['Bar', 'create']);
$var = test('Bar::create');
/** @psalm-trace $var */
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/fb02f07990
The text was updated successfully, but these errors were encountered: