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

Ignores second member of union of Closures #1462

weirdan opened this issue Mar 13, 2019 · 1 comment


None yet
2 participants
Copy link

commented Mar 13, 2019

  class C {
    /** @param (Closure(int,string):bool)|(Closure(int):bool) $p */
    public function filter(Closure $p): void {}
    /** @param (Closure(int):bool)|(Closure(int,string):bool) $p */
    public function filter2(Closure $p): void {}
  (new C)->filter(function (int $_k): bool { return true; });
  (new C)->filter2(function (int $_k): bool { return true; });

Expected: no issues, both calls are fine as methods accept closures with single argument

Psalm output (using commit 71a9980): 

INFO: MixedTypeCoercion - 10:19 - Argument 1 of C::filter expects Closure(int, string):bool, parent type Closure(int):true provided

weirdan added a commit to weirdan/doctrine-psalm-plugin that referenced this issue Mar 13, 2019

Fixed wrong Collection::exists() signature
Found while reviewing doctrine/collections#177

- Limited key type to array-key
- Added future tests, pending psalm implementation (see vimeo/psalm#1462)

@muglug muglug added the bug label Mar 15, 2019


This comment has been minimized.

Copy link

commented Mar 15, 2019

It should merge both to Closure(int,string=):bool

@muglug muglug closed this in 3b4a2f2 Mar 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.