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

Match always true #5161

Closed
bless-rng opened this issue Jun 11, 2021 · 2 comments
Closed

Match always true #5161

bless-rng opened this issue Jun 11, 2021 · 2 comments
Labels

Comments

@bless-rng
Copy link

bless-rng commented Jun 11, 2021

Match arm comparison between true and true is always true.

https://phpstan.org/r/18f9ed29-3ec0-437d-93d0-e74ea51e45a7

if i add to each line with compare type cast, is fix problem, but this must work without my hack

$this->a = match (true) {
	(bool)($i >= 30) => 30,
	(bool)($i >= 20) => 20,
	(bool)($i >= 10) => 10,
	default => 0,
};

this code have no errors

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@7acf7ca

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants