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

major version only not supported, e.g. ^6 #35

Closed
tacman opened this issue Jan 30, 2024 · 1 comment
Closed

major version only not supported, e.g. ^6 #35

tacman opened this issue Jan 30, 2024 · 1 comment

Comments

@tacman
Copy link

tacman commented Jan 30, 2024

https://packagist.org/packages/braunstetter/choosy-type

not sure why symfony/form: ^6 is different than the rest, but composer thinks it's valid, can you change the library to support this format as well?

symfony/form ^6
https://packagist.org/packages/braunstetter/choosy-type
Version string '6' does not follow SemVer semantics

The code I'm using for this is

$version = '^6';
                                try {
                                    $constraint = $parser->parse($version);
                                } catch (\Exception $exception) {
                                    $this->logger->error(sprintf("%s %s\n%s\n%s",
                                        $dependency, $version,
                                        $this->getPackagistUrl($name),
                                        $exception->getMessage()));
                                    break;
                                }
theseer added a commit that referenced this issue Jan 31, 2024
@theseer
Copy link
Member

theseer commented Jan 31, 2024

Technically, a "major version only" string like 6 is not valid according to the semver specification.
According to the specs, a valid version string must take the format X.Y.Z (https://semver.org/#spec-item-2) and it would fail the suggested regular expression made available in the specification (https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string).

As we already relaxed the rules (for parsing ^1.0-types of strings) and thus already support technically invalid strings, I decided to add support for it anyway.

@theseer theseer closed this as completed Jan 31, 2024
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

No branches or pull requests

2 participants