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

Passing the latest allowable version as package constraints #10018

Merged

Conversation

thavaahariharangit
Copy link
Contributor

@thavaahariharangit thavaahariharangit commented Jun 16, 2024

What are you trying to accomplish?

Passing the latest allowable version to native helper and using it as a composer require constraints

Anything you want to highlight for special attention from reviewers?

Functionality was tested with smoke test, and the existing unit tests are updated as per the functionality change.

How will you know you've accomplished your goal?

Error reproduced in local
Given the solution and tested via smoke test.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@thavaahariharangit thavaahariharangit requested a review from a team as a code owner June 16, 2024 17:33
@github-actions github-actions bot added the L: php:composer Issues and code for Composer label Jun 16, 2024
@thavaahariharangit thavaahariharangit merged commit 11ce6b8 into main Jun 17, 2024
54 checks passed
@thavaahariharangit thavaahariharangit deleted the harry/passing-latest-allowable-version-as-constraints branch June 17, 2024 13:46
Comment on lines +57 to +63
$constraint = $versionParser->parseConstraints($latestAllowableVersion); // your version constraint
$packageLink = new Link($package->getName(), $dependencyName, $constraint);

$requires = $package->getRequires();
$requires[$dependencyName] = $packageLink;

$package->setRequires($requires);
Copy link

@cs278 cs278 Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand what is going on here, but it looks like you are overriding the constraint from the composer.json file with $latestAllowableVersion. I don't know what $latestAllowableVersion contains, but at a guess it's the latest version obtained from the registry? Should it not combine that with the existing constraint instead of overriding it? Does this work properly with dev constraints or is this going to introduce a non-dev constraint when updating dev requirements?

I suspect this is probably the cause of #10033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: php:composer Issues and code for Composer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants