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

Flip operation When matching a conjunctive and a disjunctive constraint #127

Merged
merged 2 commits into from
May 24, 2021

Conversation

naderman
Copy link
Member

We need to iterate over the disjunctive constraint because the result is correct as long as one of the elements matches, iterating over the conjunctive constraint may result in incorrect matching to a disjunctive constraint.

Addresses #126

However will need to look at some more complex scenarios involving multiple levels of nesting of conjunctive and disjunctive multi constraints which I'm not sure about of the top of my head.

Alternatively we'd have to entirely switch to the safer and more correct interval implementation although it may be slower.

We need to iterate over the disjunctive constraint because the result is
correct as long as one of the elements matches, iterating over the
conjunctive constraint may result in incorrect matching to a disjunctive
constraint
@naderman
Copy link
Member Author

phpstan error is unrelated.

@stof
Copy link
Contributor

stof commented May 21, 2021

AFAICT, the version parser cannot produce complex nesting of multi constraints, because it does not support grouping constraint with parenthesis

src/Constraint/MultiConstraint.php Outdated Show resolved Hide resolved
@naderman
Copy link
Member Author

@Seldaek did you look into deeper nesting before merge?

@naderman naderman deleted the multi-conjunctive-match-disjunctive branch May 26, 2021 19:51
@Seldaek
Copy link
Member

Seldaek commented May 26, 2021

Nope, I figured this was an improvement already. Deeper nesting as stof mentioned is hard to produce if not by hand. At least the deepest you can go with string constraint parsing is (x OR (y AND z)), not sure if that's deep enough to cause problems.

@naderman
Copy link
Member Author

That's what this bug was about so fine, yeah I suppose more complex ones would be automatically constructed somehow by combining constraints only, and then you're better off using intervals.

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

Successfully merging this pull request may close these issues.

None yet

3 participants