naneau / semver

PHP Semantic Versioning library
MIT License
73 stars 9 forks source link

Sorting changes version strings #12

Closed schorsch3000 closed 9 years ago

schorsch3000 commented 9 years ago

running

$versions = \Naneau\SemVer\Sort::sort(['1.0.0','1.0.0-alpha']);
echo $versions[0];

gives me

1.0.0-alpha.0

and there seems no method to get the original string back.

since i need to sort filenames and read the files based on the sortorder this is impossible for me.

ferrydg commented 9 years ago

This update broke the __toString function

$version = Parser::parse('1.0.0+build.4'); $version->setMinor(1); echo $version;

now results in 1.0.0+build.4 in stead of the expected 1.1.0+build.4

please revert the change or provide an alternative to get the new version.

schorsch3000 commented 9 years ago

Maybe wo should revert the __toString() method and implement a getOriginalVersionString() method? also there shold be a testcase :) i can not work on this before sunday, but if this a way everyone is fine with i'll implement it

naneau commented 9 years ago

Fix seems acceptable. We'll also have to add a better test case to prevent changes from affecting __toString(), since it's important.

schorsch3000 commented 9 years ago

yes i have test cases in mind to proof this. gonna do it tomorrow.