Skip to content

fix: False match.unhandled on array with multiple booleans #4030

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

Conversation

ping-yee
Copy link

@VincentLanglet
Copy link
Contributor

If you ignore the error for every remaining array, I assume you won't have an error if you miss an "array" case

Like

  • matching array(int) with only some constant-int
  • matching array(bool, bool) with only 3 cases (instead of four)

Can you add tests to prove it works ?

@@ -132,6 +132,7 @@ public function processNode(Node $node, Scope $scope): array
!$remainingType instanceof NeverType
&& !$this->isUnhandledMatchErrorCaught($node)
&& !$this->hasUnhandledMatchErrorThrowsTag($scope)
&& !$remainingType->isArray()->yes()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad bugfix. This shuts up the rule for all arrays.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to find the right way to fix this. Thanks for the review! @ondrejmirtes @VincentLanglet

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

Successfully merging this pull request may close these issues.

False match.unhandled on array with multiple booleans
3 participants