We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The switch uses loose comparsions (==) but the match uses Identical comparisons (===)
switch
match
<?php function test(string $code): int { switch($code) { case 777: return 1; case 88: return 2; default: return 4; }; }
https://getrector.com/demo/4f488776-3a2b-4df6-bf87-088fdc73a5e6 https://3v4l.org/6Vpuf#v8.3.12 - error
Leave as is or try cast?
<?php function test(string $code): int { return match ((int) $code) { 777 => 1, 88 => 2, default => 4, }; }
https://3v4l.org/6ikFd#v8.3.12 - with cast
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Report
The
switch
uses loose comparsions (==) but thematch
uses Identical comparisons (===)https://getrector.com/demo/4f488776-3a2b-4df6-bf87-088fdc73a5e6
https://3v4l.org/6Vpuf#v8.3.12 - error
Expected Behaviour
Leave as is or try cast?
https://3v4l.org/6ikFd#v8.3.12 - with cast
The text was updated successfully, but these errors were encountered: