composer / semver

Semantic versioning utilities with the addition of version constraints parsing and checking.
MIT License
3.15k stars 76 forks source link

The operation matches() should be commutative, add missing tests and fix unbound constraint behavior #95

Closed naderman closed 4 years ago

naderman commented 4 years ago

Most importantly $a->matches($b) should be equivalent to $b->matches($a). The current behavior is responsible for this bug: https://github.com/composer/composer/pull/8869

This PR also improves the test suite a lot and defines clear rules for comparison on branch names.

Also addresses https://github.com/composer/semver/issues/94

codecov-io commented 4 years ago

Codecov Report

Merging #95 into master will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #95      +/-   ##
============================================
+ Coverage     95.65%   95.68%   +0.02%     
- Complexity      296      299       +3     
============================================
  Files             8        8              
  Lines           576      579       +3     
============================================
+ Hits            551      554       +3     
  Misses           25       25              
Impacted Files Coverage Δ Complexity Δ
src/Constraint/Constraint.php 100.00% <100.00%> (ø) 61.00 <0.00> (+3.00)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 538b669...3d658c2. Read the comment docs.

naderman commented 4 years ago

@jderusse I touched quite a bit of your compile code here too, would appreciate your review as well.

naderman commented 4 years ago

I've also reinstated your swapping of constraint/provider in multi constraint which you reverted after previous problems here https://github.com/composer/semver/pull/86/files/7b9d999c2201b1ba2a8c30b62c5802eac696911a..fa8fd4df1cb8a9d382288be1cbc287ec364a5aac#diff-d1af82c1eb4f081e79f3671589922a96