895 Commits (e3d99cac5928d72859fac8300255c9566a26e9d5)

Author SHA1 Message Date
Jordi Boggiano e3d99cac59
Fix phpstan issues, update baseline and pin PHPStan version in 2.2 branch (#10474) 2 years ago
Jordi Boggiano 24ce1eddbd
Add composer/pcre dependency and use it everywhere instead of preg_* 3 years ago
Jordi Boggiano 91548d178b
Add support for setting platform packages to false to disable them (#10308)
Fixes #9664
3 years ago
Jordi Boggiano 2c1ff41f8f
Fix phpstan 3 years ago
Jordi Boggiano 032db5bc01
Fix tests 3 years ago
Jordi Boggiano deaec7c0ac
Report validation error if a package replaces and conflicts against the same name, fixes #9845 3 years ago
Jordi Boggiano c15eba3fe3
Turn naming errors into hard failures in validating array loader 3 years ago
Jordi Boggiano 126f95a8d7
Get rid of gitignore/hgignore handling (fixes #7358), Add support for -export-ignore (fixes #9153) 3 years ago
Jordi Boggiano cc3b53bc2e
Also mark @putenv and @php deprecated/forbidden as script names to avoid clashes 3 years ago
Jordi Boggiano f509c41280
Upgrade PHPStan to 1.0 (#10253)
Co-authored-by: Martin Herndl <martin@herndl.org>
3 years ago
Jordi Boggiano 65765a148a
Explicitly deprecate misuse of the link setters to enforce the fact they expect maps (#10281) 3 years ago
Jordi Boggiano 410771af36
Merge pull request #10274 from func0der/add_sorting_to_archiving
Add name sorting to ArchivableFilesFinder.
3 years ago
Martin Herndl 7eca450d9b
Add wildcard support to ignore-platform-req, fixes #10045 (#10083) 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
func0der 41a0c660b1 [add_sorting_to_archiving] Do not use natural sorting, cause of minimum required versions. 3 years ago
func0der a48afcd790 [add_sorting_to_archiving] Add natural sorting to ArchivableFilesFinder. 3 years ago
Jordi Boggiano b09a39f9c8
Error out on recursive links in validating loader and ignore them in regular loader 3 years ago
Jordi Boggiano bd4d624cc7
Read first from $_SERVER and $_ENV before using getenv (#10218) 3 years ago
Jordi Boggiano c65d09dff7
Fix @inheritDoc annotations 3 years ago
Cédric Anne a7686e82f0
Filter candidates requiring an unknown platform package; fixes #10167 (#10184) 3 years ago
Martin Herndl 3645d3042c
Add types to root namespace (#10213) 3 years ago
Martin Herndl f267b01852
Use single docblock for parameter types (#10212) 3 years ago
Martin Herndl bd8b39fe01
Add types to `Package` (#10210) 3 years ago
Martin Herndl 13d433fad0
Add types to `Package/Loader` (#10206) 3 years ago
Martin Herndl 3fa7a6cb51
Add types to `Package/Version` (#10199) 3 years ago
pistej b99e21259c
phpstan level 6 in src/Composer/Package/Comparer (refs #10159) (#10196) 3 years ago
Martin Herndl db9e9a544e
Add types to `Package/Dumper` (#10198) 3 years ago
pistej dbd0ccaad8
phpstan level 6 in src/Composer/Package/Archiver (refs #10159) (#10195) 3 years ago
Jordi Boggiano d1c8a4d1b4
Lots of typing improvements 3 years ago
SvenRtbg 5c4e1cedb2
Add ability check for ZipArchive (#10092)
ZipArchive::setExternalAttributesName() is only available when libzip 0.11.2 or higher is present. 
This is not the case with at least SUSE SLES 12, so a simple PHP version check will not work here.
3 years ago
Jordi Boggiano dd49db6f08
Make sure that names with wildcards which are not preceded by dots are also seen as package names and not version constraints 3 years ago
Jordi Boggiano 01d734125c
Add more type info 3 years ago
Jordi Boggiano 61fba697a0
Fix validating array loader handling of invalid target branch datatype 3 years ago
Jordi Boggiano 73c109c561
Make sure that names with wildcards which are not preceded by dots are also seen as package names and not version constraints 3 years ago
Jordi Boggiano d3c176ec69
PHPStan Level 5 (#10070)
* Bump PHPStan to level 5

* Update seld/phar-utils to latest

* Add phpstan-setup / phpstan scripts
3 years ago
Jordi Boggiano b583310476
Allow ircs protocol for support.irc 3 years ago
Jordi Boggiano b77fce8a4f
More deprecation fixes by using ProcessExecutorMock and a couple of PackageInterface type fixes 3 years ago
jrfnl 609007b072 PHP 8.1: prevent a "null to non-nullable" deprecation notice
Discovered while running the existing unit tests on PHP 8.1.

The default state of the protected `$distUrl` property is "not set" and the property may not be set when the `Package::setSourceDistReferences()` method gets called.

Fixes a total of 9 deprecation notices along the lines of:
```
Deprecation triggered by Composer\Test\DependencyResolver\PoolBuilderTest::testPoolBuilder:
preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 597)
1 src/Composer/Package/Package.php(597): preg_match('...', NULL)
2 src/Composer/DependencyResolver/PoolBuilder.php(360): Composer\Package\Package->setSourceDistReferences('...')
3 src/Composer/DependencyResolver/PoolBuilder.php(338): Composer\DependencyResolver\PoolBuilder->loadPackage(Object(Composer\DependencyResolver\Request), Object(Composer\Package\CompletePackage))
4 src/Composer/DependencyResolver/PoolBuilder.php(195): Composer\DependencyResolver\PoolBuilder->loadPackagesMarkedForLoading(Object(Composer\DependencyResolver\Request), Array)
5 src/Composer/Repository/RepositorySet.php(229): Composer\DependencyResolver\PoolBuilder->buildPool(Array, Object(Composer\DependencyResolver\Request))
6 tests/Composer/Test/DependencyResolver/PoolBuilderTest.php(110): Composer\Repository\RepositorySet->createPool(Object(Composer\DependencyResolver\Request), Object(Composer\IO\NullIO))
...
```

Side-note: I'm wondering why `$this->getDistUrl()` is used instead of using the `$distUrl` property. It is a property within the same class after all. Haven't changed it, but did want to raise the question.

Refs:
* https://www.php.net/manual/en/function.preg-match.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
3 years ago
Juliette c7d11f361c
PHP 8.1: fix more return type deprecation warnings (#10039)
Follow up on 10008 and the various commits made for that.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
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 b602b19f6d
Fix archive command now that zips are extracted async, refs composer/satis#655 3 years ago
Michael Telgmann 66fb240e1b
Fix initial values of CompletePackage properties 3 years ago
Jordi Boggiano 4c9e75c6e5
Fix CS 3 years ago
Jordi Boggiano 93a5b27631
Add prettyVersion to URL placeholders 3 years ago
Jordi Boggiano c257395a6d
Add support for mirror-style placeholders for the dist url, fixes #9661 3 years ago
Jordi Boggiano 6441e1f94f
Merge branch '2.0' 3 years ago
Jordi Boggiano 7d19930ca6
Fix minimum-stability validation to match what VersionParser::normalizeStability does, closes #9904 3 years ago
Jordi Boggiano 459a7d9623
Use a simpler suggested require version of * to keep things simple for extensions which are versioned like PHP, fixes #9483 3 years ago
Jordi Boggiano 649087d6de
Fix type issues with root package interface 3 years ago
Jordi Boggiano 7b77161b7e
Merge branch '2.0' 3 years ago