114 Commits (2a771dfb2d911754dd4d91aecb2f0778ef2a3f4c)

Author SHA1 Message Date
Jordi Boggiano 2a771dfb2d
Update PHPUnit to 8.5 3 years ago
Jordi Boggiano 24ce1eddbd
Add composer/pcre dependency and use it everywhere instead of preg_* 3 years ago
Jordi Boggiano f509c41280
Upgrade PHPStan to 1.0 (#10253)
Co-authored-by: Martin Herndl <martin@herndl.org>
3 years ago
Yanick Witschi 34183f49f9
Implemented PoolOptimizer 3 years ago
Martin Herndl 3013674c92
Refactor ignore platform reqs checks (#10079)
Introduces a `PlatformRequirementFilter` with methods that help to decide if a requirement is ignored or not as discussed in #10045 but without changing behaviour.
3 years ago
Jordi Boggiano cb0293cf30
Finalize phpstan level 6 for tests dir, closes #10159 3 years ago
Jordi Boggiano 44b69ba77f
Upgrade php-cs-fixer to 3.x and fix CS 3 years ago
Jordi Boggiano a6f1e803b1
Use more BasePackage instead of PackageInterface 3 years ago
Jordi Boggiano b77fce8a4f
More deprecation fixes by using ProcessExecutorMock and a couple of PackageInterface type fixes 3 years ago
jrfnl 7022ceb0a6 PHP 8.1: prevent a "null to non-nullable" deprecation notice (test only fix)
Not all tests in the `InstallerTest` class actually create a temporary directory and set the `$this->tempComposerHome` property.

Those tests which didn't, throw a notice in PHP 8.1.

Fixes 3 notices along the lines of:
```
Deprecation triggered by Composer\Test\InstallerTest::tearDown:
is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 53)
1 tests/Composer/Test/InstallerTest.php(53): is_dir(NULL)
...
```
3 years ago
Juliette f5a0dfeb50
PHP 8.1: fix deprecation warnings about incorrect default values (#10036)
* PHP 8.1/Tests: fix some deprecation warnings

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes numerous `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1/NoProxyPattern: fix deprecation warning

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes some `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

```
Deprecation triggered by Composer\Test\Util\Http\ProxyManagerTest::testGetProxyForRequest:
preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 42)
1 src/Composer/Util/NoProxyPattern.php(42): preg_split('...', '...', NULL, 1)
2 src/Composer/Util/Http/ProxyManager.php(148): Composer\Util\NoProxyPattern->__construct('...')
3 src/Composer/Util/Http/ProxyManager.php(50): Composer\Util\Http\ProxyManager->initProxyData()
4 src/Composer/Util/Http/ProxyManager.php(59): Composer\Util\Http\ProxyManager->__construct()
5 tests/Composer/Test/Util/Http/ProxyManagerTest.php(75): Composer\Util\Http\ProxyManager::getInstance()
...
```

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1: fix deprecation warnings / http_build_query()

This fixes all relevant calls to the PHP native `http_build_query()` function.
The second parameter of which is the _optional_ `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.
In this case, these function calls yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without BC-break.

Fixes a few deprecation warnings found when running the tests.

Refs:
* https://www.php.net/manual/en/function.http-build-query.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

* PHP 8.1: fix deprecation notices / PharData::__construct()

This fixes all relevant calls to the PHP native `PharData::__construct()` method.

The second parameter of this method is the _optional_ `$flags` parameter which expects an `int` of flags to be passed to the `Phar` parent class `RecursiveDirectoryIterator`.
Fixed by passing the default value for the `$flags` parameter as per the `RecursiveDirectoryIterator::__construct()` method.

The third parameter of the method is the _optional_ `$alias` parameter which expects an `string`.
Fixed by passing an empty string.

Fixes various notices along the lines of:
```
Deprecation triggered by Composer\Test\Package\Archiver\ArchiveManagerTest::testArchiveTar:
PharData::__construct(): Passing null to parameter #2 ($flags) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 55)
1 src/Composer/Package/Archiver/PharArchiver.php(55): PharData->__construct('...', NULL, NULL, 2)
2 src/Composer/Package/Archiver/ArchiveManager.php(193): Composer\Package\Archiver\PharArchiver->archive('...', '...', '...', Array, false)
3 tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php(65): Composer\Package\Archiver\ArchiveManager->archive(Object(Composer\Package\CompletePackage), '...', '...')
...
```

Refs:
* https://www.php.net/manual/en/phardata.construct.php
* https://www.php.net/manual/en/recursivedirectoryiterator.construct.php

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
3 years ago
Jordi Boggiano 1b34495daa
Some phpstan level 4 fixes 3 years ago
Jordi Boggiano 4940009f83
Bump phpstan to level 3 (#9734)
Clean up PackageInterface/CompletePackageInterface, add missing methods, type things in solver as BasePackage, added CompleteAliasPackage, ..
3 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Nils Adermann c0236c5ed2 Move slow integration test to separate fixtures directory and add to slow group 4 years ago
Jordi Boggiano 24abd233ec
Merge branch 'master' into code-improvements 4 years ago
Simon Berger 80d71ccb3f Merged isset, unset and str_replace calls 4 years ago
Michael Telgmann a4509d28e7
Introduce constants for Composer\Package\Link types 4 years ago
Jordi Boggiano 7a37e78a30
Speed up installer tests by avoiding lots of bootstrapping and git processes 4 years ago
Jordi Boggiano c8efb50d39
Change the single requirement ignore from --ignore-platform-reqs=xx to --ignore-platform-req=xx to avoid BC issues 4 years ago
Jordi Boggiano e85da00dff
Add a way to ignore only some packages in --ignore-platform-reqs, and make the platform check ignore those packages which were ignored as requirements, fixes #8861 4 years ago
Jordi Boggiano d89342dc43
Fix tests 4 years ago
Jordi Boggiano 82502684b2
Allow testing for installed repo state 4 years ago
Adam Žurek 25cd2382cb
Raise phpstan level to 1 (#8027) 4 years ago
Nils Adermann 9fb09049ff Rename and document constants for partial update behavior 4 years ago
Nils Adermann 01fe92905a The update allow list is now generated while building the pool
This reduces code complexity while making partial updates more
predictable. This also allows composer require to successfully run a
partial update for a new package with transitive dependency updates.
4 years ago
Jordi Boggiano 9cab8c10cc
Merge branch 'master' into 2.0 4 years ago
Jordi Boggiano 0b9c658bef
Add plugin-api-version used to generate a lock file in itself 4 years ago
Jordi Boggiano 3fc7e10c5c
Improve error reporting of solver issues, refs #7779
Fixes #8525
Fixes #6513
4 years ago
Nils Adermann 97ec2d7b61 Merge remote-tracking branch 'github-composer/2.0' into solve-without-installed
* github-composer/2.0: (63 commits)
  Fix PSR warnings for optimized autoloader, refs #8397, refs #8403
  Prepare 1.9.1 changelog
  Output a hint that maybe you are not in the right directory, fixes #8404
  Fix PSR warnings for optimized autoloader, refs #8397, refs #8403
  Fix tests for PSR-fix in optimized autoloader, refs #8397
  Fix tests for PSR-fix in optimized autoloader, refs #8397
  Change PSR-fix for optimized autoloader to only warn for now, refs #8397
  Fix output of dump-autoload command to avoid interfering with warnings, refs #8397
  Remove credentials from git remotes in cache and vendor dirs
  Avoid overwriting credentials with existing ones from git repos, refs #8293
  Fix github auth to try https with pwd also, fixes #8356
  Fix gitlab support for basic-auth fallback from ssh URLs
  Avoid clearing the error output during removeDirectory execution, losing git error output, fixes #8351
  Move test file parsing into try/catch block to avoid phpunit swallowing errors
  make optimized autoloader respect PSR standards
  Validate composer show with --tree and --path options set (#8390)
  Don't show root warning for docker containers
  Added phpdoc for ComposerAutoloaderInit$SHA1::getLoader() (#8393)
  Validate schema name, type and version
  Fix require command to allow working on network mounts, fixes #8231
  ...
5 years ago
Nils Adermann bd6b4e433c Use JsonFile::JSON_PRETTY_PRINT instead of php const for PHP 5.3 compat 5 years ago
Nils Adermann 737a613a50 Use array() instead of [] for PHP 5.3 compat 5 years ago
Nils Adermann 6925005ac9 Implement update mirrors/nothing/lock as its own installer mode
These special commands no longer (ab)use the partial update mechanism
but rather create a special install request for all current lock file
contents and later override any modified code references to the
originals. This leads to up to date remote metadata but no other
changes.
5 years ago
Jordi Boggiano bc2a1d762a
Merge branch 'master' into 2.0 5 years ago
Nils Adermann 0873c4099b Merge branch '1.9'
* 1.9:
  Move test file parsing into try/catch block to avoid phpunit swallowing errors
5 years ago
Nils Adermann 6a335a459c Move test file parsing into try/catch block to avoid phpunit swallowing errors 5 years ago
Arnout Boks 22caa0f097 Add tests for installer with lock: false
https://github.com/composer/composer/issues/8354
5 years ago
Nils Adermann b700aa3d62 Sort local repo transaction as topological as possible 5 years ago
Nils Adermann f5e18250e6 Merge remote-tracking branch 'github-composer/2.0' into solve-without-installed
* github-composer/2.0: (48 commits)
  Fix missing use/undefined var
  Split up steps on VCS downloaders to allow doing network operations before touching the filesystem on GitDownloader, fixes #7903
  Fix use statement
  Deduplicate findHeaderValue code
  Add install-path to the installed.json for every package, fixes #2174, closes #2424
  Remove unnecessary config from phpstan
  Make sure the directory exists and will not block installation later when downloading
  Avoid wiping the whole target package if download of the new one fails, refs #7929
  Only empty dir before actually installing packages, fixes #7929
  Improve output when installing packages
  Show best possible version in diagnose command
  Remove extra arg
  Allow path repos to point to their own source dir as install target, resulting in noop, fixes #8254
  Fix use of decodeJson
  Fix update mirrors to also update transport-options, fixes #7672
  Fix updating or URLs to include dist type and shasum, fixes #8216
  Fix origin computation
  Improve handling of non-standard ports for GitLab and GitHub installs, fixes #8173
  Load packages from the lock file for check-platform-reqs if no dependencies have been installed yet, fixes #8058
  Fix error_handler return type declaration
  ...
5 years ago
Jordi Boggiano 8dfadd99d1
Merge branch '2.0' into fix/unused 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
Jordi Boggiano f946d8eb5a More RemoteFilesystem usage removals and some repository/vcs driver refactorings 6 years ago
Jordi Boggiano 713bc4de1d Minor fixes and updated the rest of the code/tests to use HttpDownloader 6 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 96c812fb24 Properly buffer installer test output to display as errors if necessary 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
Jordi Boggiano 066351c5b9 Remove use of deprecated getMock method 6 years ago
Andreas Möller 6059acf0a3
Fix: Remove unused parameter and field 7 years ago
Jordi Boggiano a1c5754b1f Make sure tests run non-interactively 7 years ago