31 Commits (bd6403a6bef36fdbefdb287dc7e26286d5e06e5e)

Author SHA1 Message Date
Jordi Boggiano bd6403a6be
Fix newly surfaced errors 2 years ago
Jordi Boggiano 6a466a120a
Enable strict types on all files 2 years ago
Jordi Boggiano 6da38f83a0
Add parameter types to all the things 2 years ago
Jordi Boggiano eda9014bef
Add return types to all code which is not being extended by open source packages 2 years ago
Jordi Boggiano a16ed3d0ed
Add return types to private/internal methods 2 years ago
Jordi Boggiano 24ce1eddbd
Add composer/pcre dependency and use it everywhere instead of preg_* 2 years ago
Martin Herndl 995bf5a932
Add types to `Util` namespace, refs #10159 (#10190) 3 years ago
Vitaly Baev 7305d50277
Changed GitLab's applications URL (#10104) 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 b7d770659b
CS fixes 4 years ago
Jordi Boggiano 8b934a415f
Merge branch '1.10' 4 years ago
Stephan fb0ad7c900 GitLab: clarify interactive auth prompt 4 years ago
Matěj Kmínek a074819a51
Add support for gitlab deploy token (#8867)
* feat: Added ability to work with GitLab deploy tokens: https://docs.gitlab.com/ee/user/project/deploy_tokens/

Deploy tokens can be specified two ways:
1) GIT CONFIG:
git config --add gitlab.deploytoken.user USERNAME && git config --add gitlab.deploytoken.token TOKEN
2) Auth.json:
"gitlab-token": {
    "gitlab.com": {"username": "USERNAME", "token": "TOKEN"}
}
4 years ago
Jordi Boggiano 6c4357a7ed
Merge branch 'master' into 2.0 5 years ago
Jordi Boggiano 0261ce8092
Improve handling of non-standard ports for GitLab and GitHub installs, fixes #8173 5 years ago
CZechBoY a062cd1a31
added phpstan on level 0 5 years ago
Jordi Boggiano 713bc4de1d Minor fixes and updated the rest of the code/tests to use HttpDownloader 5 years ago
Jordi Boggiano bf125295df Fix escaping of URLs in Perforce and Subversion drivers 6 years ago
Jordi Boggiano 2eb69cd679 Always recommend using global config to store auth tokens 7 years ago
Matt Isenhower 4dc8748e68 Update GitLab personal access token URL and the token config command 7 years ago
Jordi Boggiano daff57189f Add http_build_query 3rd param to make it more explicit 7 years ago
moyo 997a062ebd Support gitlab private-token (or personal-access-token) for easier access via gitlab API
Config example:

$HOME/.composer/auth.json

{
  "gitlab-token": {
    "gitlab.com": "YOUR-TOKEN-HERE"
  }
}

Gitlab API authentication doc: http://doc.gitlab.com/ce/api/README.html
8 years ago
Niels Keurentjes eb77c0b7f5 phpDoc cleanup, removed unused imports, variables and parameters. 8 years ago
Jordi Boggiano f8dff0867c Remove --disable-tls/--cafile flags and rely solely on config options plus some wording clarifications 8 years ago
Jordi Boggiano 020c126c27 Fix CS 9 years ago
Jérôme Tamarelle 4255db9e31 Allows SSH urls for gitlab and detect the scheme
SSH urls uses HTTPS to request the API
9 years ago
Jerome TAMARELLE 6ccc562c0f Add tests on GitLab class (copied from GitHubTest) 9 years ago
Jerome TAMARELLE db056b8383 Fix retry authentification on gitlab oauth 9 years ago
Jerome TAMARELLE 211d4632bb Fix compatibility with PHP 5.3 9 years ago
Roshan Gautam 7bf886b3ba Remove two factor authentication 9 years ago
Roshan Gautam f870396568 Add oauth2 support for gitlab 9 years ago