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

[Documentation] It's not clear that this package does not follow the semver.org specification #160

Open
anomiex opened this issue Jun 28, 2024 · 2 comments

Comments

@anomiex
Copy link

anomiex commented Jun 28, 2024

I'm not asking you to reverse the decision in #15 not to follow the actual semantic versioning specification. I'm asking you to please make it clear in the package description and documentation that this package implements a version_compare()-compatible versioning system rather than following semver.org's rules.

For example,

// This outputs "true". Per semver.org, these are not equal.
var_dump( \Composer\Semver\Comparator::equalTo( "1.2.3-alpha", "1.2.3-a" ) );

// This outputs "true". Per semver.org, prerelease string "c" > "a".
var_dump( \Composer\Semver\Comparator::lessThan( "1.2.3-c", "1.2.3-a" ) );

// This outputs "true". Per semver.org, 1.2.3-prerelease is less than 1.2.3, not greater than.
// (version_compare considers "p" as meaning "patchlevel", along the lines of what might otherwise be "1.2.3.1").
var_dump( \Composer\Semver\Comparator::greaterThan( "1.2.3-prelease", "1.2.3" ) );

Again, I'm not asking you to change any of those results. But please make it clear in the documentation that if someone is looking for a package to follow semver.org rather than version_compare(), they should keep looking.

I suggest the following changes:

  • Change the description to call it a "Version comparison library" rather than a "Semver library".
    "description": "Semver library that offers utilities, version constraint parsing and validation.",
  • Change the first line of the readme to call it a "Version comparison library" rather than a "Semver (Sementic Versioning) library".
    Semver (Semantic Versioning) library that offers utilities, version constraint parsing and validation.
  • In the Version Comparison section, add a paragraph something like "This package compares versions in the same way PHP's version_compare() does. It does not follow the specification at semver.org." before the existing paragraph linking to the details.

    semver/README.md

    Lines 29 to 33 in a40ea7e

    Version Comparison
    ------------------
    For details on how versions are compared, refer to the [Versions](https://getcomposer.org/doc/articles/versions.md)
    article in the documentation section of the [getcomposer.org](https://getcomposer.org) website.
  • Remove the "semver" and "semantic" keywords.

    semver/composer.json

    Lines 6 to 11 in a40ea7e

    "keywords": [
    "semver",
    "semantic",
    "versioning",
    "validation"
    ],
  • Adjust the description of this repository to describe it as something like "Versioning utilities" rather than "Semantic versioning utilities".

(I'm not going to suggest renaming the package, namespaces, or classes. That would break too much stuff to be worth me advocating for.)

Thanks!

@Seldaek
Copy link
Member

Seldaek commented Jul 8, 2024

Yeah, we do follow the key parts of the semver spec, but cannot reasonably follow these minor details due to language support. So I disagree we should drop semver entirely because for most intents and purposes, this is quite semver compatible. But I agree that a warning in the readme at least is in order :)

@Seldaek
Copy link
Member

Seldaek commented Jul 8, 2024

And btw if you do want to send a PR for that, it'll for sure help resolve it sooner.

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

No branches or pull requests

2 participants