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

InvalidScalarArgument callable(T of object, T of object) #2508

Closed
vudaltsov opened this issue Dec 24, 2019 · 2 comments
Closed

InvalidScalarArgument callable(T of object, T of object) #2508

vudaltsov opened this issue Dec 24, 2019 · 2 comments
Labels

Comments

@vudaltsov
Copy link
Contributor

vudaltsov commented Dec 24, 2019

https://psalm.dev/r/eddc5cd072

@vudaltsov
Copy link
Contributor Author

@muglug , it seems the problem still occurs in the class.
https://psalm.dev/r/c7bba7e45e

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/c7bba7e45e
<?php
  
class A
{
/**
 * @template T of object
 * @psalm-param array<T> $collection
 * @psalm-param callable(T, T): int $sorter
 * @psalm-return array<T>
 */
public function order(array $collection, callable $sorter): array
{
  usort($collection, $sorter);

  return $collection;
}
}
Psalm output (using commit 508c2e2):

ERROR: InvalidScalarArgument - 13:22 - Argument 2 of usort expects callable(object, object):int, callable(T:fn-a::order as object, T:fn-a::order as object):int provided

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

No branches or pull requests

2 participants