133 Commits (main)

Author SHA1 Message Date
Jordi Boggiano 6a466a120a
Enable strict types on all files 2 years ago
Jordi Boggiano 3cdca37e85
Fix strict type issues 2 years ago
Jordi Boggiano abdc6893a6
Add void types where no return statement is present 2 years ago
Jordi Boggiano 6ed3aeb343
Remove setExpectedException wrapper 3 years ago
Jordi Boggiano 2a771dfb2d
Update PHPUnit to 8.5 3 years ago
Jordi Boggiano 65765a148a
Explicitly deprecate misuse of the link setters to enforce the fact they expect maps (#10281) 3 years ago
megubyte a155c076db
phpstan: update tests/Composer/Test/DependencyResolver/* to level 6 standard (#10242) 3 years ago
Jordi Boggiano 44b69ba77f
Upgrade php-cs-fixer to 3.x and fix CS 3 years ago
Jordi Boggiano c3c6969cf5
Type annotations 3 years ago
David Zülke 28b2b5c0c9
tests for solver handling multiple packages with same name and version (#10110)
Not a case with regular Packagist packages, but some custom installers with custom repos do this, and the current behavior should not randomly change at some point, as that would cause downstream breakage.
3 years ago
Jordi Boggiano d00edab884
Merge pull request #9477 from naderman/fix-alias-conflicts
Explicit conflicts should conflict with aliases of packages too
4 years ago
Nils Adermann 7197278fe9 Always install aliases together with their original package
Restores some Composer 1.x behavior like unbound constraints conflicting
with default branches unless they are branch aliased.

Simplifies conflicts with aliases because packages cannot be installed
without their aliases, so we do not need to know which aliases are
uninstalled in lock file or installed.json.
4 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Jordi Boggiano 7b183956d8
Make sure the root aliases always get installed when a package is updated, fixes #9448 4 years ago
Michael Telgmann a4509d28e7
Introduce constants for Composer\Package\Link types 4 years ago
Jordi Boggiano 67a88880ec
Get rid of EmptyConstraint 4 years ago
Yanick Witschi bde9502473
Made the constraint argument in Link mandatory 4 years ago
Yanick Witschi 63906171f0
Cleanup EmptyConstraint output 4 years ago
Yanick Witschi 8e2dd62d10
Fixed tests related to constraint changes 4 years ago
Jordi Boggiano b72ac2d01a
Oops 4 years ago
Jordi Boggiano 863e7076ba
Bump to use composer/semver 3.x 4 years ago
Jordi Boggiano 34801239f1
Tweak problem wording slightly 4 years ago
Jordi Boggiano afa18f2092
Fix semver usage 4 years ago
Jordi Boggiano 80a7c40c76
Shorten long lists of similar versions in problem output, fixes #8743 4 years ago
Nils Adermann c270d3cfa6 PoolBuilder: make io non-nullable, NullIO can be used instead 4 years ago
Jordi Boggiano 2f4ea3a463
Fix show command, refactor RepositorySet constructor 4 years ago
Jordi Boggiano 189d5adab0
Fix reporting of replace conflicts to not mention provides 4 years ago
Jordi Boggiano ec90c17e3b
Fix conflict order to be more accurate 4 years ago
Jordi Boggiano c41df325d8
Remove RepositorySet from Solver and remove getPool from RepositorySet 4 years ago
Jordi Boggiano 1d4cdb60d0
Improve error reporting for conflicts/replaces of various kinds, fixes #7254 4 years ago
Jordi Boggiano 3fc7e10c5c
Improve error reporting of solver issues, refs #7779
Fixes #8525
Fixes #6513
4 years ago
Nils Adermann 0b4e8952f6 PHP5 disallows require as a function name, use requireName analog to fixPackage 4 years ago
Nils Adermann 5bdc0fc9c5 Request jobs replaced by root require / fixed package
The only type of request job remaining was "install" which is really a
root requirement. The only other kind of input for the solver is now a
set of fixed packages.

Rules have been updated to account for only two kinds of former job
reason: FIXED or ROOT_REQUIRE. The job property has always been
redundant and has been removed, since reasonData suffices.

Problem reasons are always rules, so the unnecessary wrapping in an
array has been removed.

We now only ever generate a single rule per root require or fixed
package, so there is no need for the solver to special handle disabling
"jobs" anymore, the rule can just be disabled as usual.

For consistency special handling of rules for jobs in problems has been
integrated into the rule class like all other rule reasons. As part of
this change the error message for root requirements has been improved a
bit to make it clearer where the package installation request came from.

The word job has also been removed from operations, which are called
operations, not jobs.
4 years ago
Jordi Boggiano b5e34ca767
Fix remove tests 5 years ago
Jordi Boggiano 7a4d3e6f25
Fix SolverTest 5 years ago
Nils Adermann 25de5218c3 Reunify lock and local repo transaction code and apply the same sorting 5 years ago
Nils Adermann 26da52227e Clean up the Solver tests, no more installed repo input and new sorting
The solver now only calculates a lock file transaction which does not
need to be sorted in order of dependencies. This is only necessary for
the local repo transaction generated without the solver during install
5 years ago
Nils Adermann f1e4ccbe1d Fix handling of reference updates and root references 5 years ago
Nils Adermann 9053d74282 Merge branch '2.0' into solve-without-installed
* 2.0: (101 commits)
  SVN: hide passwords for debug output
  Free $solver asap
  fixes #8179
  [minor] Fixed a typo in the CHANGELOG.md.
  Update deps
  Update changelog
  Revert "Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET" Revert "Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151"
  Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151
  Fix display of HHVM warning appearing when HHVM is not in use, fixes #8138
  Read classmap-authoritative and apcu-autoloader from project config when installing via create-project, fixes #8155
  Use possessive quantifiers
  Update xdebug-handler to 1.3.3
  fixes #8159
  Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET
  flag should come before script name
  use full command name, not abbreviated/alias
  modify text
  Document the alternatives to disable the default script timeout
  Anchor pattern
  Fix URL resolution for Composer repositories
  ...
5 years ago
Jordi Boggiano 799717f102
Tweak and fix some more phpstan reports 5 years ago
Jordi Boggiano fb3d0981c0
Fix test suite 5 years ago
Nils Adermann 10ada7bf82 Refactor Installer class into separate install and update processes
- Introduce separate Lock and LocalRepo transactions, one for changes
  to the lock file, one for changes to locally installed packages based
  on lock file
- Remove various hacks to keep dev dependencies updated and
  incorporated the functionality into the transaction classes
- Remove installed repo, there are now local repo, locked repo and
  platform repo
- Remove access to local repo from solver, only supply locked packages
- Update can now be run to modify the lock file but not install packages
  to local repo
5 years ago
Nils Adermann 287419f6a0 Merge branch 'master' into 2.0
* master:
  Follow up to #7946 test: add solver flag to assert path execution
  Fix tests
  Make sure config command output is also output on --quiet so that warnings can be hidden, fixes #7963
  Recognize composer-plugin-api as a platform package, fixes #7951
  Quote wildcards to avoid issues in some shells, fixes #7960
  Avoid dumping null values for dist reference/shasum and source reference, fixes #7955
  Soften hard exit after revert of composer file
  Make unixy proxy code POSIX compatible
  Update aliases.md
  Same but for Problem.php
  Better error message for present but incompatible versions
  Fix inconsistent casing
  Don't do (new Foo())->bar() - not 5.3-compatible
  Support identifying the HHVM version when not running with HHVM
5 years ago
Nils Adermann 29ff6a40ae Follow up to #7946 test: add solver flag to assert path execution 5 years ago
Nils Adermann 728e57b9e0 Merge branch 'master' into 2.0
* master:
  Fix solver problem exceptions with unexpected contradictory "Conclusions"
  Also load config into IO if not freshly created
  Only load configuration into IO if IO is available
  Fix defaultRepos fallback does not use auth config
  Add warning/info msg when tweaking disable-tls setting to avoid confusion, fixes #7935
5 years ago
Nils Adermann 6b2edeae56 Fix solver problem exceptions with unexpected contradictory "Conclusions"
This 5 character fix comes with a solver test as well as a functional
installer test essentially verifying the same thing. The solver test is
more useful when working on the solver. But the functional test is less
likely to be accidentally modified incorrectly during refactoring, as
every single package, version and link in the rather complex test
scenario is essential, and a modified version of the test may very well
still result in a successful installation but no longer verify the bug
described below.

Background:

In commit 451bab1c2c from May 19, 2012 I
refactored literals from complex objects into pure integers to reduce
memory consumption. The absolute value of an integer literal is the id
of the package it refers to in the package pool. The sign indicates
whether the package should be installed (positive) or removed (negative),

So a major part of the refactoring was swapping this call:

$literal->getPackageId()

For this:

abs($literal)

Unintentionally in line 554/523 I incorrectly applied this change to the
line:

$this->literalFromId(-$literal->getPackageId());

It was converted to:

-abs($literal);

The function literalFromId used to create a new literal object. By using
the abs() function this change essentially forces the resulting literal
to be negative, while the minus sign previously inverted the literal, so
positive into negative and vice versa.

This particular line is in a function meant to analyze a conflicting
decision during dependency resolution and to draw a conclusion from it,
then revert the state of the solver to an earlier position, and attempt
to solve the rest of the rules again with this new "learned" conclusion.

Because of this bug these conclusions could only ever occur in the
negative, e.g. "don't install package X". This is by far the most likely
scenario when the solver reaches this particular line, but there are
exceptions.

If you experienced a solver problem description that contained a
statement like "Conclusion: don't install vendor/package 1.2.3" which
directly contradicted other statements listed as part of the problem,
this could likely have been the cause.
5 years ago
Jordi Boggiano 2e0f31106a Merge remote-tracking branch 'origin/master' into 2.0 6 years ago
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
6 years ago
Nils Adermann c0f19f6c57 Move construction of pool from repo set into a pool builder
Pool construction depends on the install request now, so only required
packages get loaded, add some structure for future asynchronously
loading composer repositories
6 years ago
Nils Adermann b6e2d60c9e Create the pool in the installer before giving it to the solver 6 years ago