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

== doesn't imply type equivalency #2158

Closed
iluuu1994 opened this issue Sep 21, 2019 · 1 comment

Comments

@iluuu1994
Copy link
Contributor

commented Sep 21, 2019

https://psalm.dev/r/ba46dad6c1

/** @var mixed */
$int = 0;
$string = '0';

function takes_string(string $string) {}
function takes_int(int $int) {}

if ($int == $string) {
  takes_string($int);
  takes_int($int);
}

ERROR: InvalidScalarArgument - 12:13 - Argument 1 of takes_int expects int, string(0) provided

This is a minor issue for us as we use strict equivalency almost exclusively but still interesting nonetheless.

@muglug muglug added the bug label Sep 21, 2019
@muglug muglug closed this in 3205d1b Sep 22, 2019
@iluuu1994

This comment has been minimized.

Copy link
Contributor Author

commented Sep 22, 2019

Thanks @muglug!

2e3s added a commit to 2e3s/psalm that referenced this issue Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.