1
0
Fork 0
Commit Graph

2508 Commits (b8caf4b214562aceb6406da23b1c18ae0ea52573)

Author SHA1 Message Date
Paolo Rossi a921d9b233
Reaching phpstan level 6 in EventDispatcher Exception and Installer folders (#10192) 2021-10-25 10:44:29 +02:00
immeëmosol 50d738eeee
Reaching phpstan level 6 in Composer/DependencyResolver (refs #10159) (#10178) 2021-10-18 22:33:37 +02:00
Jordi Boggiano a6f1e803b1
Use more BasePackage instead of PackageInterface 2021-10-17 14:43:34 +02:00
Jordi Boggiano 9599eb613b
Type annotations 2021-10-16 11:14:10 +02:00
Jordi Boggiano c3c6969cf5
Type annotations 2021-10-16 10:25:12 +02:00
Jordi Boggiano 97fe881af4
Add some docblocks 2021-10-15 16:36:28 +02:00
Jordi Boggiano 135611fc9d
Add deprecation baseline for php8.1+ builds which use locked or lowest dependencies 2021-10-15 13:37:02 +02:00
Jordi Boggiano 260ac0011c
Add constants to describe error codes from Installer::run 2021-10-14 15:12:06 +02:00
Jordi Boggiano cf7fa7087c
Fix test 2021-10-13 22:23:18 +02:00
Jordi Boggiano 2828ce59cf
Merge branch '1.10' 2021-10-13 22:12:54 +02:00
John Stevenson 906442117c Carriage returns are ignored by cmd 2021-10-13 14:54:37 +01:00
John Stevenson 0783b043d2 Fix Windows escaping in tests 2021-10-10 17:02:22 +01:00
John Stevenson 8f974fe741 Improve Windows escaping 2021-10-10 16:24:49 +01:00
Jordi Boggiano 18e24976c1
Merge branch '1.10' 2021-10-05 09:43:00 +02:00
Jordi Boggiano ca5e2f8d50
Fix escaping issues on Windows which could lead to command injection, fixes GHSA-frqg-7g38-6gcf 2021-10-05 09:39:50 +02:00
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.
2021-10-02 19:02:22 +02:00
Jordi Boggiano d64d1adf61
Rewrite php file cleaning step to be less regex intensive and support extreme cases better, fixes #10106 (#10107) 2021-10-02 14:39:39 +02:00
Jordi Boggiano d99b200cf3
Fix tests 2021-10-01 10:54:33 +02:00
Jordi Boggiano f85e2136fd
Merge branch '1.10' 2021-10-01 10:34:36 +02:00
Jordi Boggiano 8cd2d0e541
Fix scanning of classmaps in files containing invalid Unicode, fixes #10102 2021-09-15 11:31:43 +02:00
Jordi Boggiano 4bcd860b65
Add more type annotations 2021-09-05 17:34:12 +02:00
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 2021-09-05 09:56:28 +02:00
Jordi Boggiano 0761474599
Add type info to many properties/methods 2021-08-30 14:46:49 +02:00
Jordi Boggiano f4e2b389a1
Fix test 2021-08-29 20:10:24 +02:00
Jordi Boggiano 922ba01d07
Merge pull request #10072 from jrfnl/feature/10067-fix-classmap-regression
ClassMapGenerator: stabilize the heredoc/nowdoc stripping
2021-08-29 12:26:20 +02:00
Jordi Boggiano d8054d1d2f
Add more possessive quantifiers, unicode flag and support for more post-heredoc syntax, fix test file syntax being invalid 2021-08-29 12:23:02 +02:00
Jordi Boggiano 3f79e59f69
Add test assertions for heredoc marker inside the text 2021-08-23 13:14:16 +02:00
powellblyth 5e75017166
Just some comments with 'it's' that should have been 'its' (#10071)
Co-authored-by: Toby Powell-Blyth <tobypowell-blyth@elasticstage.com>
2021-08-22 13:41:18 +02:00
jrfnl b66b23a03f
ClassMapGeneratorTest: add test with consecutive duplicate heredoc markers
... as well as a test with heredoc markers with only a newline character between the start and end marker.
2021-08-21 17:45:42 +02:00
Jordi Boggiano d3c176ec69
PHPStan Level 5 (#10070)
* Bump PHPStan to level 5

* Update seld/phar-utils to latest

* Add phpstan-setup / phpstan scripts
2021-08-21 17:41:52 +02:00
Jordi Boggiano 74b231a4bc
Fix lib-openssl detection on FreeBSD, fixes #10046 2021-08-19 15:00:08 +02:00
Juliette 5f48f87501
PHPUnit: move environment variable into PHPUnit config file (#10062)
Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-08-19 13:21:04 +02:00
Jordi Boggiano a586a753df
Fix all remaining php8.1 test suite deprecations 2021-08-19 13:00:30 +02:00
Jordi Boggiano b77fce8a4f
More deprecation fixes by using ProcessExecutorMock and a couple of PackageInterface type fixes 2021-08-18 23:35:27 +02:00
Jordi Boggiano 6aa2d15868
Introduce ProcessExecutorMock to fix deprecations and amount of mocking pain 2021-08-18 17:17:56 +02:00
Jordi Boggiano 5062619046
Fix deprecation warnings with strpos receiving null 2021-08-18 15:55:37 +02:00
Jordi Boggiano 0b09e08f4b
Fix direct deprecations 2021-08-18 15:17:06 +02:00
Jordi Boggiano cac4c190f1
Merge pull request #10053 from jrfnl/feature/php-8.1-null-to-non-nullable-fix-2
PHP 8.1: prevent a "null to non-nullable" deprecation notice [2] (test only fix)
2021-08-18 14:39:51 +02:00
Jordi Boggiano 9708f4568f
Merge pull request #10055 from jrfnl/feature/php-8.1-fix-missing-mock-expectation
PHP 8.1/LibraryInstallerTest: add missing mock expectation
2021-08-18 14:31:30 +02:00
Jordi Boggiano b232ee6663
Fix test 2021-08-18 14:25:35 +02:00
jrfnl 7004e0d031 PHP 8.1/LibraryInstallerTest: add missing mock expectation
The `LibraryInstallerTest::testUninstall()` method mocks a `Package` object, but did not set an expectation for a call to `getName()`, while that method _is_ called in the `LibraryInstaller::uninstall()` method.

Without expectation, the mock returns `null`, which was subsequently being passed on to `strpos()` leading to the below error.

Fixes:
```
Deprecation triggered by Composer\Test\Installer\LibraryInstallerTest::testUninstall:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 202)
1 src/Composer/Installer/LibraryInstaller.php(202): strpos(NULL, '...')
2 vendor/react/promise/src/FulfilledPromise.php(28): Composer\Installer\LibraryInstaller->Composer\Installer\{closure}(NULL)
3 src/Composer/Installer/LibraryInstaller.php(208): React\Promise\FulfilledPromise->then(Object(Closure))
4 tests/Composer/Test/Installer/LibraryInstallerTest.php(221): Composer\Installer\LibraryInstaller->uninstall(Object(Mock_InstalledRepositoryInterface_e3699f95), Object(Mock_Package_e4571076))
...
```
2021-08-12 03:38:56 +02:00
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)
...
```
2021-08-12 03:02:19 +02:00
jrfnl e729c418dd ClassMapGenerator: add test for "marker in text" bug
In PHP < 7.3, the heredoc/nowdoc marker was allowed to occur in the text, as long as it did not occur at the very start of the line.

This was also not handled correctly.

Ref: https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.heredoc-nowdoc
2021-08-11 22:23:24 +02:00
jrfnl 9588654ae3 ClassMapGenerator: add tests for "long heredoc" bug
... to proof the existence of the bug and demonstrate the effect.

Note: in the test the backtrack limit is being lowered (and restored back to the default afterwards) to prevent the tests needing ridiculously huge test fixture files.
2021-08-11 22:21:57 +02:00
Stephan c65bd832d6
Url: fix sanitize for new github tokens (#10048) 2021-08-11 13:24:41 +02:00
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>
2021-08-11 13:05:45 +02:00
Jordi Boggiano df99150db6
Pin versions to avoid new dependencies breaking tests 2021-08-04 16:39:19 +02:00
Jordi Boggiano 24f5e54fbe
Fix only/exclude to avoid matching names as sub-strings of full package names, fixes #10001 2021-07-22 13:47:31 +02:00
Jordi Boggiano 10ae1d7b08
Fix some PHP 8.1 deprecation warnings, fixes #10008 2021-07-21 15:13:24 +02:00
Jordi Boggiano 005c55185a
Fix support for writing into UNC paths, and comparing UNC paths correctly in InstalledVersions, fixes #9993 2021-07-12 14:03:00 +02:00
Jordi Boggiano cc81f5bac3
Fix support for UNC paths in normalizePath, refs #9993 2021-07-12 13:36:57 +02:00
Jordi Boggiano a02802b109
Warn 1.x users when a package is not found that it may be due to our deprecation policy 2021-06-08 21:12:49 +02:00
adlacruzes 7366b8e362 Fix JsonFile when using custom json schema with no "name" and "description" properties 2021-06-03 20:15:35 +02:00
Jordi Boggiano 1b34495daa
Some phpstan level 4 fixes 2021-06-03 11:29:00 +02:00
Jordi Boggiano 4c9e75c6e5
Fix CS 2021-06-03 10:38:38 +02:00
Jordi Boggiano 91dd175f74
Fix env var handling when variables_order includes E and symfony/console 3.3.15+ is used, fixes #9930 2021-06-03 10:17:54 +02:00
Jordi Boggiano 8bf0ddf905
Clean up ZipDownloader, always do async first if possible then fallback to non-async 2021-06-02 15:13:19 +02:00
Nils Adermann 1ca6397442
Merge pull request #9765 from Seldaek/always_sync_symlinked_path_pkgs
Always mark symlinked path packages for update even during partial updates to make sure they always reflect the current state on disk
2021-06-02 11:50:15 +02:00
Jordi Boggiano 1f37d1c1d5
Add better error reporting for cases where a package conflicts with a replace and not directly a package, fixes #9834 2021-06-02 10:08:13 +02:00
Brad Jones dd625669e8
Introduce gitlab-protocol option to force the gitlab repos to use https or git protocol (#9401) 2021-05-27 23:05:53 +02:00
Jordi Boggiano 0dce0f80f1
Also hint for errors when the root package does not match the constraint 2021-05-25 23:05:44 +02:00
Nils Adermann 21c70c2606
Merge pull request #9902 from Seldaek/cyclic-deps
Detect and output a better hint for cyclic dependencies
2021-05-25 22:58:50 +02:00
Jordi Boggiano cbef7b9172
Detect and output a better hint for dependencies on the root package, fixes #9837 2021-05-25 22:47:53 +02:00
Jordi Boggiano 084fff2014
Merge remote-tracking branch 'guilliamxavier/lax-schema' 2021-05-24 22:27:48 +02:00
Jordi Boggiano 44e6591573
Improve error reporting for exts overridden by platform config, fixes #9876 2021-05-24 16:57:33 +02:00
Guilliam Xavier 393c9a5946 Add more tests 2021-05-24 14:42:23 +02:00
Guilliam Xavier 2d21dd675a Invert strict/lax schema validation 2021-05-24 11:51:04 +02:00
Guilliam Xavier 9e2cb30dfb Revert "Merge remote-tracking branch 'BoShurik/schema'"
This reverts commit 89c3045e2b, reversing
changes made to 991985792d.
2021-05-24 11:46:08 +02:00
Jordi Boggiano da3d5e3143
Merge pull request #9699 from ochorocho/improve-installed-versions-9648
Add install-path and type to installedVersions.php and installed.php,…
2021-05-24 10:29:40 +02:00
Jordi Boggiano f0e178c318
Merge branch '2.0' 2021-05-21 16:49:42 +02:00
Jordi Boggiano 17f6363ea9
Fix tests 2021-05-21 16:49:17 +02:00
John Stevenson ce19bcd992
Upgrade to xdebug-handler 2 (#9832)
This adds support for Xdebug3 modes and changes the default behaviour
from always restarting if Xdebug is loaded, to only restarting if Xdebug
is active.

Xdebug is considered active if it is loaded, and for Xdebug3, if it is
running in a mode other than `xdebug.mode=off`.
2021-05-21 16:47:29 +02:00
Jordi Boggiano 3fe4f84a76
Fix handling of metapackages with null paths, and handling of paths which do not have a shortest-path and require an absolute path to be addressed 2021-05-21 14:33:10 +02:00
Jordi Boggiano 518b44a810
Clean up dump code to avoid reimplementing var export, and remove DIRECTORY_SEPARATOR 2021-05-21 14:33:10 +02:00
Jochen Roth b6c9d34125
Add install-path and type to installedVersions.php and installed.php, add method to get installed packages by type
Issue https://github.com/composer/composer/issues/9648
2021-05-21 14:33:09 +02:00
Jordi Boggiano 89c3045e2b
Merge remote-tracking branch 'BoShurik/schema' 2021-05-20 15:42:39 +02:00
Jordi Boggiano ac49e61931
Add more tests
Co-authored-by: Guilliam Xavier <guilliamxavier@users.noreply.github.com>
2021-05-20 15:41:56 +02:00
Jordi Boggiano 991985792d
Merge branch '2.0' 2021-05-20 14:16:52 +02:00
Guilliam Xavier 8d8842eb8c
Fix schema minimum-stability pattern 2021-05-20 14:15:39 +02:00
Nils Adermann 05caeb008f
Merge pull request #9887 from Seldaek/require-exts-simpler
Use a simpler suggested require version of * to keep things simple for extensions which are versioned like PHP
2021-05-17 14:47:29 +02:00
Jordi Boggiano 459a7d9623
Use a simpler suggested require version of * to keep things simple for extensions which are versioned like PHP, fixes #9483 2021-05-17 14:36:46 +02:00
Michael Voříšek 5456cf8197
Fix EOL of text files (#9877) 2021-05-12 15:19:52 +02:00
Jordi Boggiano 9b7a8d4543
Hint at a branch rename if we detect dev-master can not be found but dev-main or dev-default exists, fixes #9850 2021-05-03 14:42:58 +02:00
Jordi Boggiano 832f4007d6
Allow ints in source/dist reference 2021-04-30 09:40:58 +02:00
Jordi Boggiano 832af78e28
Add basic source/dist validation 2021-04-28 21:53:09 +02:00
Jordi Boggiano 40c7a725e1
Merge branch '2.0' 2021-04-27 13:06:49 +02:00
Jordi Boggiano 332c46af8b
Merge pull request from GHSA-h5h8-pc6h-jvvx
* Fix external process calls to avoid user input being able to pass extra parameters

* Tweak some fixes
2021-04-27 13:00:40 +02:00
Jordi Boggiano 083b73515d
Merge pull request from GHSA-h5h8-pc6h-jvvx
* Fix external process calls to avoid user input being able to pass extra parameters

* Tweak some fixes
2021-04-27 13:00:40 +02:00
Andreas Scheibel bb1bb022e4
"composer init --autoload" - Interactive generates PSR-4 autoloader in composer.json (#9829)
- Generates PSR-4 autoload entry in composer.json.
- Run dump-autoload, if no dependencies are set
2021-04-20 21:58:38 +02:00
John Stevenson c3b76a8532
Upgrade to xdebug-handler 2 (#9832)
This adds support for Xdebug3 modes and changes the default behaviour
from always restarting if Xdebug is loaded, to only restarting if Xdebug
is active.

Xdebug is considered active if it is loaded, and for Xdebug3, if it is
running in a mode other than `xdebug.mode=off`.
2021-04-13 09:59:06 +02:00
Jordi Boggiano d75d79b452
Merge pull request #9822 from phenaproxima/post-file-download
Fire POST_FILE_DOWNLOAD event for metadata fetched by ComposerRepository
2021-04-09 14:53:20 +02:00
Jordi Boggiano 7dd95a768b
Clean stuff up and deprecate old usages for PostFileDownloadEvent 2021-04-09 11:21:13 +02:00
Jordi Boggiano 549dabf878
Merge branch '2.0' 2021-04-08 12:06:38 +02:00
Jordi Boggiano e6cede4a61
Make sure update mirrors/--lock keeps the release date of the original reference when dev versions have newer commits, refs #9812 2021-04-08 11:54:39 +02:00
Jordi Boggiano 0ab4013788
Fix output listing some updates that do not really happen when updating mirrors/--lock, fixes #9812 2021-04-08 10:55:48 +02:00
Jordi Boggiano 101a5e2a21
Merge branch '2.0' 2021-04-07 16:05:26 +02:00
Jordi Boggiano 3e33cc1d93
Add new dep to the tests 2021-04-07 16:02:41 +02:00
Jordi Boggiano 1ce41efa6a
Fix tests 2021-04-07 14:39:42 +02:00
Jordi Boggiano 1179e4b481
Change root.dev-requirement to root.dev in installed.php as the root is not required per se, and this simply tracks the dev mode at install time 2021-04-07 13:42:22 +02:00
BoShurik cc55b56dd7 Allow optional name and description fields for project type 2021-03-30 16:51:03 +03:00