1
0
Fork 0

Merge branch '2.2' into main

pull/10477/head
Jordi Boggiano 2022-01-21 15:52:32 +01:00
commit bab974575c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
31 changed files with 138 additions and 629 deletions

View File

@ -67,7 +67,7 @@ if (function_exists('ini_set')) {
// Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
// see https://github.com/php/php-src/issues/7896
if (PHP_VERSION_ID >= 70113 && Platform::isWindows()) {
if (PHP_VERSION_ID >= 70113 && (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)) && Platform::isWindows()) {
foreach ($_SERVER as $serverVar => $serverVal) {
if (($serverVal = getenv($serverVar)) !== false) {
$_SERVER[$serverVar] = $serverVal;

View File

@ -1,402 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(Composer\\\\Autoload\\\\ClassLoader\\), 'loadClass'\\} given\\.$#"
count: 1
path: ../src/Composer/Autoload/ClassLoader.php
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\<string\\>\\|null given\\.$#"
count: 2
path: ../src/Composer/Command/BaseDependencyCommand.php
-
message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/ConfigCommand.php
-
message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Config\\\\JsonConfigSource, string\\} given\\.$#"
count: 2
path: ../src/Composer/Command/ConfigCommand.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/DiagnoseCommand.php
-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/ExecCommand.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/InitCommand.php
-
message: "#^Parameter \\#1 \\$from of function rename expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/SelfUpdateCommand.php
-
message: "#^Parameter \\#1 \\$user_id of function posix_getpwuid expects int, int\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/SelfUpdateCommand.php
-
message: "#^Parameter \\#2 \\$permissions of function chmod expects int, int\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/SelfUpdateCommand.php
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\<int, array\\<string, array\\|string\\>\\>\\|string given\\.$#"
count: 1
path: ../src/Composer/Command/ShowCommand.php
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|string given\\.$#"
count: 1
path: ../src/Composer/Command/ShowCommand.php
-
message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(string, string\\)\\: int, 'version_compare' given\\.$#"
count: 1
path: ../src/Composer/Command/ShowCommand.php
-
message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#"
count: 1
path: ../src/Composer/Command/ValidateCommand.php
-
message: "#^Parameter \\#1 \\$string of function substr_replace expects array\\|string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Compiler.php
-
message: "#^Parameter \\#1 \\$string of function rtrim expects string, int\\|string\\|null given\\.$#"
count: 1
path: ../src/Composer/Config.php
-
message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Config.php
-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Composer\\\\Json\\\\JsonManipulator, string\\} given\\.$#"
count: 1
path: ../src/Composer/Config/JsonConfigSource.php
-
message: "#^Parameter \\#2 \\$callback of function uksort expects callable\\(string, string\\)\\: int, 'version_compare' given\\.$#"
count: 2
path: ../src/Composer/DependencyResolver/Problem.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, array\\<string, array\\<string\\>\\>\\|string\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/FileDownloader.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/GzipDownloader.php
-
message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/GzipDownloader.php
-
message: "#^Parameter \\#1 \\$stream of function gzclose expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/GzipDownloader.php
-
message: "#^Parameter \\#1 \\$stream of function gzread expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/GzipDownloader.php
-
message: "#^Parameter \\#3 \\$length of function fwrite expects int\\<0, max\\>\\|null, int given\\.$#"
count: 1
path: ../src/Composer/Downloader/GzipDownloader.php
-
message: "#^Parameter \\#1 \\$string of function rawurldecode expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Downloader/VcsDownloader.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#"
count: 1
path: ../src/Composer/EventDispatcher/EventDispatcher.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Factory.php
-
message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/IO/BufferIO.php
-
message: "#^Parameter \\#1 \\$stream of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/IO/BufferIO.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Installer/BinaryInstaller.php
-
message: "#^Parameter \\#1 \\$stream of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Installer/BinaryInstaller.php
-
message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, int\\<min, \\-1\\>\\|int\\<2, max\\>\\|string given\\.$#"
count: 1
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Parameter \\#2 \\$handler of function pcntl_signal expects \\(callable\\(\\)\\: mixed\\)\\|int, int\\|string given\\.$#"
count: 2
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Only numeric types are allowed in \\-, int\\|false given on the left side\\.$#"
count: 1
path: ../src/Composer/Package/Archiver/PharArchiver.php
-
message: "#^Parameter \\#2 \\$baseDirectory of method Phar\\:\\:buildFromIterator\\(\\) expects string\\|null, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Package/Archiver/PharArchiver.php
-
message: "#^Parameter \\#1 \\$array of function ksort expects array, array\\<int\\|string, mixed\\>\\|string given\\.$#"
count: 1
path: ../src/Composer/Package/Dumper/ArrayDumper.php
-
message: "#^Only booleans are allowed in an if condition, int\\|false given\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Parameter \\#1 \\$array of function array_splice expects array, array\\<Composer\\\\Package\\\\BasePackage\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ArrayRepository.php
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\<Composer\\\\Package\\\\BasePackage\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ArrayRepository.php
-
message: "#^Parameter \\#1 \\$array of function array_keys expects array, array\\<string, array\\<string, string\\>\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$array of function array_values expects array, array\\<string, Composer\\\\Package\\\\PackageInterface\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\<string, int\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/SelfUpdate/Versions.php
-
message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|false\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/AuthHelper.php
-
message: "#^Parameter \\#1 \\$from of function stream_copy_to_stream expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/Filesystem.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 4
path: ../src/Composer/Util/Filesystem.php
-
message: "#^Parameter \\#1 \\$stream of function feof expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/Filesystem.php
-
message: "#^Parameter \\#1 \\$stream of function fread expects resource, resource\\|false given\\.$#"
count: 2
path: ../src/Composer/Util/Filesystem.php
-
message: "#^Parameter \\#2 \\$to of function stream_copy_to_stream expects resource, resource\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/Filesystem.php
-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#"
count: 17
path: ../src/Composer/Util/Git.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/GitHub.php
-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#"
count: 2
path: ../src/Composer/Util/Hg.php
-
message: "#^Parameter \\#1 \\$handle of function curl_close expects CurlHandle, resource given\\.$#"
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\{retryAuthFailure\\: bool, redirects\\: int, retries\\: int, storeAuth\\: bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\<literal\\-string&non\\-empty\\-string, bool\\|int\\>, options\\: array, progress\\: array, curlHandle\\: CurlHandle\\|resource, filename\\: string\\|false\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$handle of function curl_getinfo expects CurlHandle, resource given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_add_handle expects CurlMultiHandle, resource\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_exec expects CurlMultiHandle, resource\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_info_read expects CurlMultiHandle, resource\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_remove_handle expects CurlMultiHandle, resource\\|null given\\.$#"
count: 2
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_select expects CurlMultiHandle, resource\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#2 \\$handle of function curl_multi_remove_handle expects CurlHandle, resource given\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\{retryAuthFailure\\: bool, redirects\\: int, retries\\: int, storeAuth\\: bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\<literal\\-string&non\\-empty\\-string, bool\\|int\\>, options\\: array, progress\\: array, curlHandle\\: CurlHandle\\|resource, filename\\: string\\|false\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\>\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$multiHandle \\(resource\\|null\\) does not accept CurlMultiHandle\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$shareHandle \\(resource\\|null\\) does not accept CurlShareHandle\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/NoProxyPattern.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 2
path: ../src/Composer/Util/Perforce.php
-
message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#"
count: 13
path: ../src/Composer/Util/Perforce.php
-
message: "#^Parameter \\#1 \\$string1 of function strcmp expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Perforce.php
-
message: "#^Parameter \\#2 \\$needle of function strpos expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Util/Perforce.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/Perforce.php
-
message: "#^Parameter \\#1 \\$string of function base64_encode expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Util/RemoteFilesystem.php
-
message: "#^Parameter \\#5 \\$length of function file_get_contents expects int\\<0, max\\>\\|null, int given\\.$#"
count: 1
path: ../src/Composer/Util/RemoteFilesystem.php
-
message: "#^Parameter \\#1 \\$include_path of function set_include_path expects string, string\\|false given\\.$#"
count: 2
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#"
count: 2
path: ../tests/Composer/Test/ConfigTest.php
-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Composer\\\\Repository\\\\CompositeRepository, string\\} given\\.$#"
count: 1
path: ../tests/Composer/Test/Repository/CompositeRepositoryTest.php
-
message: "#^Parameter \\#1 \\$object of method ReflectionProperty\\:\\:getValue\\(\\) expects object\\|null, object\\|string given\\.$#"
count: 1
path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php

View File

@ -2450,11 +2450,6 @@ parameters:
count: 1
path: ../src/Composer/Config.php
-
message: "#^Property Composer\\\\Config\\:\\:\\$warnedHosts \\(array\\<string, true\\>\\) does not accept non\\-empty\\-array\\<0\\|string, true\\>\\.$#"
count: 1
path: ../src/Composer/Config.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 2
@ -2925,11 +2920,6 @@ parameters:
count: 1
path: ../src/Composer/DependencyResolver/RuleSet.php
-
message: "#^Property Composer\\\\DependencyResolver\\\\RuleSet\\:\\:\\$rulesByHash \\(array\\<string, array\\<Composer\\\\DependencyResolver\\\\Rule\\>\\|Composer\\\\DependencyResolver\\\\Rule\\>\\) does not accept array\\<int\\|string, array\\<Composer\\\\DependencyResolver\\\\Rule\\>\\|Composer\\\\DependencyResolver\\\\Rule\\>\\.$#"
count: 3
path: ../src/Composer/DependencyResolver/RuleSet.php
-
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\DependencyResolver\\\\Rule\\|null given\\.$#"
count: 1
@ -2980,16 +2970,6 @@ parameters:
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Casting to int something that's already int\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Casting to int\\<min, 0\\>\\|int\\<2, max\\> something that's already int\\<min, 0\\>\\|int\\<2, max\\>\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
@ -3005,11 +2985,6 @@ parameters:
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Only booleans are allowed in &&, int\\<0, max\\> given on the left side\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Only booleans are allowed in &&, int\\<0, max\\> given on the right side\\.$#"
count: 2
@ -3032,11 +3007,6 @@ parameters:
-
message: "#^Only booleans are allowed in a negated boolean, int given\\.$#"
count: 2
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Only booleans are allowed in a negated boolean, int\\<0, max\\> given\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
@ -3875,11 +3845,6 @@ parameters:
count: 1
path: ../src/Composer/IO/BaseIO.php
-
message: "#^Property Composer\\\\IO\\\\BaseIO\\:\\:\\$authentications \\(array\\<string, array\\{username\\: string, password\\: string\\}\\>\\) does not accept non\\-empty\\-array\\<string, array\\{username\\: string, password\\: string\\|null\\}\\>\\.$#"
count: 1
path: ../src/Composer/IO/BaseIO.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 6
@ -4030,11 +3995,6 @@ parameters:
count: 1
path: ../src/Composer/Installer.php
-
message: "#^Only booleans are allowed in an if condition, int\\<0, max\\> given\\.$#"
count: 1
path: ../src/Composer/Installer.php
-
message: "#^Only booleans are allowed in \\|\\|, array\\<string\\>\\|null given on the left side\\.$#"
count: 2
@ -4110,11 +4070,6 @@ parameters:
count: 2
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Constant PHP_WINDOWS_EVENT_CTRL_C not found\\.$#"
count: 1
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
@ -4125,11 +4080,6 @@ parameters:
count: 2
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Function sapi_windows_set_ctrl_handler not found\\.$#"
count: 3
path: ../src/Composer/Installer/InstallationManager.php
-
message: "#^Only booleans are allowed in &&, Composer\\\\EventDispatcher\\\\EventDispatcher\\|null given on the right side\\.$#"
count: 2
@ -4325,11 +4275,6 @@ parameters:
count: 1
path: ../src/Composer/Json/JsonFile.php
-
message: "#^Only booleans are allowed in an if condition, int\\<min, 2\\> given\\.$#"
count: 1
path: ../src/Composer/Json/JsonFile.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
@ -4480,11 +4425,6 @@ parameters:
count: 1
path: ../src/Composer/Package/BasePackage.php
-
message: "#^Offset 'string' does not exist on array\\{added\\?\\: array\\<string\\>, changed\\?\\: array\\<string\\>, removed\\?\\: array\\<string\\>, string\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>\\}\\.$#"
count: 1
path: ../src/Composer/Package/Comparer/Comparer.php
-
message: "#^Only booleans are allowed in &&, int\\<0, max\\>\\|false given on the right side\\.$#"
count: 1
@ -5040,31 +4980,16 @@ parameters:
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Parameter \\#1 \\$installer of method Composer\\\\Installer\\\\InstallationManager\\:\\:addInstaller\\(\\) expects Composer\\\\Installer\\\\InstallerInterface, object given\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Parameter \\#1 \\$path of function dirname expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Parameter \\#1 \\$plugin of method Composer\\\\Plugin\\\\PluginManager\\:\\:addPlugin\\(\\) expects Composer\\\\Plugin\\\\PluginInterface, object given\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Parameter \\#3 \\$subject of static method Composer\\\\Pcre\\\\Preg\\:\\:replace\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Property Composer\\\\Plugin\\\\PluginManager\\:\\:\\$registeredPlugins \\(array\\<string, Composer\\\\Plugin\\\\PluginInterface\\>\\) does not accept array\\<string, object\\>\\.$#"
count: 2
path: ../src/Composer/Plugin/PluginManager.php
-
message: "#^Property Composer\\\\Plugin\\\\PostFileDownloadEvent\\:\\:\\$fileName \\(string\\) does not accept string\\|null\\.$#"
count: 1
@ -5105,11 +5030,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ArrayRepository.php
-
message: "#^Property Composer\\\\Repository\\\\ArrayRepository\\:\\:\\$packages \\(array\\<Composer\\\\Package\\\\BasePackage\\>\\|null\\) does not accept array\\<Composer\\\\Package\\\\PackageInterface\\>\\.$#"
count: 1
path: ../src/Composer/Repository/ArrayRepository.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 1
@ -5125,11 +5045,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ArtifactRepository.php
-
message: "#^Argument of an invalid type array\\<string, Composer\\\\Package\\\\PackageInterface\\>\\|null supplied for foreach, only iterables are supported\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Cannot access offset 'path' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#"
count: 1
@ -5270,11 +5185,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Only booleans are allowed in an if condition, int\\<min, 2\\> given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#"
count: 3
@ -5295,11 +5205,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$input of function array_values expects array, array\\<string, Composer\\\\Package\\\\PackageInterface\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 3
@ -5310,11 +5215,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Property Composer\\\\Repository\\\\ComposerRepository\\:\\:\\$partialPackagesByName \\(array\\<string, Composer\\\\Package\\\\PackageInterface\\>\\|null\\) does not accept array\\<string, array\\<int, mixed\\>\\|Composer\\\\Package\\\\PackageInterface\\>\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Only booleans are allowed in a ternary operator condition, array\\<int, array\\<Composer\\\\Package\\\\BasePackage\\>\\> given\\.$#"
count: 3
@ -5775,16 +5675,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/Vcs/GitDriver.php
-
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitDriver\\:\\:\\$branches \\(array\\<string, string\\>\\) does not accept array\\<int\\|string, mixed\\>\\.$#"
count: 1
path: ../src/Composer/Repository/Vcs/GitDriver.php
-
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitDriver\\:\\:\\$tags \\(array\\<string, string\\>\\) does not accept array\\<int\\|string, mixed\\>\\.$#"
count: 1
path: ../src/Composer/Repository/Vcs/GitDriver.php
-
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
count: 2
@ -5965,11 +5855,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
-
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitLabDriver\\:\\:\\$commits \\(array\\<string, array\\>\\) does not accept array\\<int\\|string, mixed\\>\\.$#"
count: 1
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
-
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\VcsDriver\\:\\:\\$originUrl \\(string\\) does not accept string\\|false\\.$#"
count: 1
@ -6590,16 +6475,6 @@ parameters:
count: 2
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Constant CURLOPT_PROXY_CAINFO not found\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Constant CURLOPT_PROXY_CAPATH not found\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 3
@ -6776,7 +6651,7 @@ parameters:
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\{retryAuthFailure\\: bool, redirects\\: int, retries\\: int, storeAuth\\: bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\<literal\\-string&non\\-empty\\-string, bool\\|int\\>, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\>\\.$#"
message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\{retryAuthFailure\\: bool, redirects\\: int, retries\\: int, storeAuth\\: bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\<array\\{url\\: string, origin\\: string, attributes\\: array\\<literal\\-string&non\\-empty\\-string, bool\\|int\\>, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
@ -7005,11 +6880,6 @@ parameters:
count: 2
path: ../src/Composer/Util/Loop.php
-
message: "#^Cannot access offset int\\<1, 16\\> on array\\|false\\.$#"
count: 6
path: ../src/Composer/Util/NoProxyPattern.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
@ -7415,36 +7285,6 @@ parameters:
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: mixed, password\\?\\: string\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: non\\-empty\\-string, password\\?\\: string\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: string\\|null, password\\?\\: string\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: mixed\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: string\\|null\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: string\\}\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 1
@ -7965,11 +7805,6 @@ parameters:
count: 1
path: ../tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
-
message: "#^Call to function is_array\\(\\) with array\\<string, array\\{username\\: string, password\\: string\\}\\> will always evaluate to true\\.$#"
count: 1
path: ../tests/Composer/Test/IO/NullIOTest.php
-
message: """
#^Call to deprecated method getRawData\\(\\) of class Composer\\\\InstalledVersions\\:
@ -8353,11 +8188,6 @@ parameters:
count: 2
path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php
-
message: "#^Property Composer\\\\Test\\\\Plugin\\\\PluginInstallerTest\\:\\:\\$packages \\(array\\<Composer\\\\Package\\\\CompletePackage\\>\\) does not accept array\\<Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\>\\.$#"
count: 1
path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php
-
message: "#^Unable to resolve the template type CapabilityClass in call to method Composer\\\\Plugin\\\\PluginManager\\:\\:getPluginCapability\\(\\)$#"
count: 2

View File

@ -472,6 +472,7 @@ TAGSPUBKEY
return $this->tryAsWindowsAdmin($localFilename, $newFilename);
}
@unlink($newFilename);
$action = 'Composer '.($backupTarget ? 'update' : 'rollback');
throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
}
@ -624,7 +625,7 @@ EOT;
exec('"'.$script.'"');
@unlink($script);
// see if the file was moved and is still accessible
// see if the file was copied and is still accessible
if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
$io->writeError('<info>Operation succeeded.</info>');
@unlink($newFilename);

View File

@ -604,6 +604,7 @@ class Config
}
if ($io) {
$host = parse_url($url, PHP_URL_HOST);
if (is_string($host)) {
if (!isset($this->warnedHosts[$host])) {
$io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
}
@ -611,6 +612,7 @@ class Config
}
}
}
}
/**
* Used by long-running custom scripts in composer.json

View File

@ -45,7 +45,7 @@ class RuleSet implements \IteratorAggregate, \Countable
/** @var int */
protected $nextRuleId = 0;
/** @var array<string, Rule|Rule[]> */
/** @var array<int|string, Rule|Rule[]> */
protected $rulesByHash = array();
public function __construct()

View File

@ -324,7 +324,7 @@ class Solver
if ($newLevel <= 0 || $newLevel >= $level) {
throw new SolverBugException(
"Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
"Trying to revert to invalid level ".$newLevel." from level ".$level."."
);
}
@ -423,7 +423,7 @@ class Solver
while ($l1retry) {
$l1retry = false;
if (!$num && !--$l1num) {
if (0 === $num && 0 === --$l1num) {
// all level 1 literals done
break 2;
}
@ -447,7 +447,7 @@ class Solver
unset($seen[abs($literal)]);
if ($num && 0 === --$num) {
if (0 !== $num && 0 === --$num) {
if ($literal < 0) {
$this->testFlagLearnedPositiveLiteral = true;
}

View File

@ -19,7 +19,7 @@ use Psr\Log\LogLevel;
abstract class BaseIO implements IOInterface
{
/** @var array<string, array{username: string, password: string}> */
/** @var array<string, array{username: string|null, password: string|null}> */
protected $authentications = array();
/**

View File

@ -198,7 +198,7 @@ interface IOInterface extends LoggerInterface
/**
* Get all authentication information entered.
*
* @return array<string, array{username: string, password: string}> The map of authentication data
* @return array<string, array{username: string|null, password: string|null}> The map of authentication data
*/
public function getAuthentications();

View File

@ -354,7 +354,7 @@ class Installer
$fundingCount++;
}
}
if ($fundingCount) {
if ($fundingCount > 0) {
$this->io->writeError(array(
sprintf(
"<info>%d package%s you are using %s looking for funding.</info>",

View File

@ -77,6 +77,10 @@ class BinaryInstaller
$this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
continue;
}
if (is_dir($binPath)) {
$this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path</warning>');
continue;
}
if (!$this->filesystem->isAbsolutePath($binPath)) {
// in case a custom installer returned a relative path for the
// $package, we can now safely turn it into a absolute path (as we
@ -333,6 +337,16 @@ if (PHP_VERSION_ID < 80000) {
return \$operation ? flock(\$this->handle, \$operation) : true;
}
public function stream_seek(\$offset, \$whence)
{
if (0 === fseek(\$this->handle, \$offset, \$whence)) {
\$this->position = ftell(\$this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return \$this->position;

View File

@ -152,7 +152,7 @@ class JsonFile
$this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & JSON_PRETTY_PRINT ? "\n" : ''));
break;
} catch (\Exception $e) {
if ($retries) {
if ($retries > 0) {
usleep(500000);
continue;
}

View File

@ -67,12 +67,13 @@ class Comparer
}
if ($toString) {
$strings = array();
foreach ($changed as $sectionKey => $itemSection) {
foreach ($itemSection as $itemKey => $item) {
$changed['string'][] = $item."\r\n";
$strings[] = $item."\r\n";
}
}
$changed = implode("\r\n", $changed['string']);
$changed = implode("\r\n", $strings);
}
return $changed;

View File

@ -113,12 +113,15 @@ class ArrayLoader implements LoaderInterface
if (!isset($config['name'])) {
throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
}
if (!isset($config['version'])) {
if (!isset($config['version']) || !is_scalar($config['version'])) {
throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
}
if (!is_string($config['version'])) {
$config['version'] = (string) $config['version'];
}
// handle already normalized versions
if (isset($config['version_normalized'])) {
if (isset($config['version_normalized']) && is_string($config['version_normalized'])) {
$version = $config['version_normalized'];
// handling of existing repos which need to remain composer v1 compatible, in case the version_normalized contained VersionParser::DEFAULT_BRANCH_ALIAS, we renormalize it

View File

@ -71,6 +71,12 @@ class ValidatingArrayLoader implements LoaderInterface
}
if (!empty($this->config['version'])) {
if (!is_scalar($this->config['version'])) {
$this->validateString('version');
} else {
if (!is_string($this->config['version'])) {
$this->config['version'] = (string) $this->config['version'];
}
try {
$this->versionParser->normalize($this->config['version']);
} catch (\Exception $e) {
@ -78,6 +84,7 @@ class ValidatingArrayLoader implements LoaderInterface
unset($this->config['version']);
}
}
}
if (!empty($this->config['config']['platform'])) {
foreach ((array) $this->config['config']['platform'] as $key => $platform) {

View File

@ -251,7 +251,7 @@ class VersionGuesser
// re-use the HgDriver to fetch branches (this properly includes bookmarks)
$io = new NullIO();
$driver = new HgDriver(array('url' => $path), $io, $this->config, new HttpDownloader($io, $this->config), $this->process);
$branches = array_keys($driver->getBranches());
$branches = array_map('strval', array_keys($driver->getBranches()));
// try to find the best (nearest) version branch to assume this feature's version
$result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);

View File

@ -14,6 +14,7 @@ namespace Composer\Plugin;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Installer\InstallerInterface;
use Composer\IO\IOInterface;
use Composer\Package\BasePackage;
use Composer\Package\CompletePackage;
@ -50,7 +51,7 @@ class PluginManager
/** @var array<PluginInterface> */
protected $plugins = array();
/** @var array<string, PluginInterface> */
/** @var array<string, PluginInterface|InstallerInterface> */
protected $registeredPlugins = array();
/**
@ -284,11 +285,17 @@ class PluginManager
}
if ($oldInstallerPlugin) {
if (!is_a($class, 'Composer\Installer\InstallerInterface', true)) {
throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Installer\InstallerInterface');
}
$this->io->writeError('<warning>Loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'which is a legacy composer-installer built for Composer 1.x, it is likely to cause issues as you are running Composer 2.x.</warning>');
$installer = new $class($this->io, $this->composer);
$this->composer->getInstallationManager()->addInstaller($installer);
$this->registeredPlugins[$package->getName()] = $installer;
} elseif (class_exists($class)) {
if (!is_a($class, 'Composer\Plugin\PluginInterface', true)) {
throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Plugin\PluginInterface');
}
$plugin = new $class();
$this->addPlugin($plugin, $isGlobalPlugin, $package);
$this->registeredPlugins[$package->getName()] = $plugin;
@ -316,20 +323,15 @@ class PluginManager
return;
}
$oldInstallerPlugin = ($package->getType() === 'composer-installer');
if (!isset($this->registeredPlugins[$package->getName()])) {
return;
}
if ($oldInstallerPlugin) {
/** @var \Composer\Installer\InstallerInterface $installer */
$installer = $this->registeredPlugins[$package->getName()];
unset($this->registeredPlugins[$package->getName()]);
$this->composer->getInstallationManager()->removeInstaller($installer);
} else {
$plugin = $this->registeredPlugins[$package->getName()];
unset($this->registeredPlugins[$package->getName()]);
if ($plugin instanceof InstallerInterface) {
$this->composer->getInstallationManager()->removeInstaller($plugin);
} else {
$this->removePlugin($plugin);
}
}
@ -352,16 +354,14 @@ class PluginManager
return;
}
$oldInstallerPlugin = ($package->getType() === 'composer-installer');
if (!isset($this->registeredPlugins[$package->getName()])) {
return;
}
if ($oldInstallerPlugin) {
$plugin = $this->registeredPlugins[$package->getName()];
if ($plugin instanceof InstallerInterface) {
$this->deactivatePackage($package);
} else {
$plugin = $this->registeredPlugins[$package->getName()];
unset($this->registeredPlugins[$package->getName()]);
$this->removePlugin($plugin);
$this->uninstallPlugin($plugin);
@ -699,6 +699,10 @@ class PluginManager
}
}
if ($package === 'composer/package-versions-deprecated') {
return false;
}
if (!isset($warned[$package])) {
if ($this->io->isInteractive()) {
$composer = $isGlobalPlugin && $this->globalComposer !== null ? $this->globalComposer : $this->composer;

View File

@ -210,12 +210,13 @@ class ArrayRepository implements RepositoryInterface
/**
* Adds a new package to the repository
*
* @param PackageInterface $package
*
* @return void
*/
public function addPackage(PackageInterface $package)
{
if (!$package instanceof BasePackage) {
throw new \InvalidArgumentException('Only subclasses of BasePackage are supported');
}
if (null === $this->packages) {
$this->initialize();
}

View File

@ -79,7 +79,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
$directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
$iterator = new \RecursiveIteratorIterator($directory);
$regex = new \RegexIterator($iterator, '/^.+\.(zip|phar|tar|gz|tgz)$/i');
$regex = new \RegexIterator($iterator, '/^.+\.(zip|tar|gz|tgz)$/i');
foreach ($regex as $file) {
/* @var $file \SplFileInfo */
if (!$file->isFile()) {

View File

@ -102,7 +102,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
private $rootData;
/** @var bool */
private $hasPartialPackages = false;
/** @var ?array<string, PackageInterface> */
/** @var ?array<string, mixed[]> */
private $partialPackagesByName = null;
/**
@ -318,7 +318,10 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
}
if ($this->hasPartialPackages()) {
return array_values($this->partialPackagesByName);
if (!is_array($this->partialPackagesByName)) {
throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
}
return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
}
throw new \LogicException('Composer repositories that have lazy providers and no available-packages list can not load the complete list of packages, use getPackageNames instead.');
@ -609,6 +612,9 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
}
if ($this->hasPartialPackages()) {
if (!is_array($this->partialPackagesByName)) {
throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
}
foreach ($this->partialPackagesByName as $versions) {
foreach ($versions as $candidate) {
if (isset($result[$candidate['name']]) || !isset($candidate['provide'][$packageName])) {
@ -1314,7 +1320,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$filename = str_replace('http://', 'https://', $filename);
}
if ($retries) {
if ($retries > 0) {
usleep(100000);
continue;

View File

@ -26,9 +26,9 @@ use Composer\Config;
*/
class GitDriver extends VcsDriver
{
/** @var array<string, string> Map of tag name to identifier */
/** @var array<int|string, string> Map of tag name (can be turned to an int by php if it is a numeric name) to identifier */
protected $tags;
/** @var array<string, string> Map of branch name to identifier */
/** @var array<int|string, string> Map of branch name (can be turned to an int by php if it is a numeric name) to identifier */
protected $branches;
/** @var string */
protected $rootIdentifier;
@ -172,7 +172,7 @@ class GitDriver extends VcsDriver
$this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
foreach ($output = $this->process->splitLines($output) as $tag) {
if ($tag && Preg::isMatch('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
$this->tags[$match[2]] = $match[1];
$this->tags[$match[2]] = (string) $match[1];
}
}
}

View File

@ -46,7 +46,7 @@ class GitLabDriver extends VcsDriver
private $project;
/**
* @var array<string, mixed[]> Keeps commits returned by GitLab API
* @var array<string|int, mixed[]> Keeps commits returned by GitLab API as commit id => info
*/
private $commits = array();

View File

@ -62,14 +62,14 @@ interface VcsDriverInterface
/**
* Return list of branches in the repository
*
* @return array<string, string> Branch names as keys, identifiers as values
* @return array<int|string, string> Branch names as keys, identifiers as values
*/
public function getBranches();
/**
* Return list of tags in the repository
*
* @return array<string, string> Tag names as keys, identifiers as values
* @return array<int|string, string> Tag names as keys, identifiers as values
*/
public function getTags();

View File

@ -223,6 +223,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
foreach ($driver->getTags() as $tag => $identifier) {
$tag = (string) $tag;
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
if ($isVeryVerbose) {
$this->io->writeError($msg);
@ -330,6 +331,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
foreach ($branches as $branch => $identifier) {
$branch = (string) $branch;
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
if ($isVeryVerbose) {
$this->io->writeError($msg);

View File

@ -96,10 +96,7 @@ class AuthHelper
if ($requiresSso) {
$ssoUrl = $gitHubUtil->getSsoUrl($headers);
$message = sprintf(
'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl,
$ssoUrl
) . "\n";
$message = 'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl . "\n";
$this->io->writeError($message);
if (!$this->io->isInteractive()) {
throw new TransportException('Could not authenticate against ' . $origin, 403);

View File

@ -174,6 +174,9 @@ class CurlDownloader
$curlHandle = curl_init();
$headerHandle = fopen('php://temp/maxmemory:32768', 'w+b');
if (false === $headerHandle) {
throw new \RuntimeException('Failed to open a temp stream to store curl headers');
}
if ($copyTo) {
$errorMessage = '';

View File

@ -159,6 +159,15 @@ class NoProxyPattern
$net = unpack('C*', $network->ip);
$mask = unpack('C*', $network->netmask);
$ip = unpack('C*', $target->ip);
if (false === $net) {
throw new \RuntimeException('Could not parse network IP '.$network->ip);
}
if (false === $mask) {
throw new \RuntimeException('Could not parse netmask '.$network->netmask);
}
if (false === $ip) {
throw new \RuntimeException('Could not parse target IP '.$target->ip);
}
for ($i = 1; $i < 17; ++$i) {
if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
@ -304,6 +313,12 @@ class NoProxyPattern
$mask = unpack('C*', $netmask);
$ip = unpack('C*', $rangeIp);
$net = '';
if (false === $mask) {
throw new \RuntimeException('Could not parse netmask '.$netmask);
}
if (false === $ip) {
throw new \RuntimeException('Could not parse range IP '.$rangeIp);
}
for ($i = 1; $i < 17; ++$i) {
$net .= chr($ip[$i] & $mask[$i]);

View File

@ -217,8 +217,10 @@ class Svn
$this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
$this->hasAuth = true;
$this->credentials['username'] = $this->io->ask("Username: ");
$this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
$this->credentials = array(
'username' => (string) $this->io->ask("Username: ", ''),
'password' => (string) $this->io->askAndHideAnswer("Password: "),
);
$this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
@ -345,8 +347,10 @@ class Svn
$host = parse_url($this->url, PHP_URL_HOST);
if (isset($authConfig[$host])) {
$this->credentials['username'] = $authConfig[$host]['username'];
$this->credentials['password'] = $authConfig[$host]['password'];
$this->credentials = array(
'username' => $authConfig[$host]['username'],
'password' => $authConfig[$host]['password'],
);
return $this->hasAuth = true;
}
@ -366,8 +370,10 @@ class Svn
return $this->hasAuth = false;
}
$this->credentials['username'] = $uri['user'];
$this->credentials['password'] = !empty($uri['pass']) ? $uri['pass'] : '';
$this->credentials = array(
'username' => $uri['user'],
'password' => !empty($uri['pass']) ? $uri['pass'] : '',
);
return $this->hasAuth = true;
}

View File

@ -42,7 +42,7 @@ class NullIOTest extends TestCase
{
$io = new NullIO();
$this->assertTrue(is_array($io->getAuthentications()));
$this->assertTrue(is_array($io->getAuthentications())); // @phpstan-ignore-line
$this->assertEmpty($io->getAuthentications());
$this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo'));
}

View File

@ -314,4 +314,15 @@ class ArrayLoaderTest extends TestCase
$this->assertArrayHasKey('composer-plugin-api', $links);
$this->assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString());
}
public function testNoneStringVersion()
{
$config = array(
'name' => 'acme/package',
'version' => 1,
);
$package = $this->loader->load($config);
$this->assertSame('1', $package->getPrettyVersion());
}
}

View File

@ -15,6 +15,7 @@ namespace Composer\Test\Plugin;
use Composer\Composer;
use Composer\Config;
use Composer\Installer\PluginInstaller;
use Composer\Package\CompleteAliasPackage;
use Composer\Package\CompletePackage;
use Composer\Package\Loader\JsonLoader;
use Composer\Package\Loader\ArrayLoader;
@ -44,7 +45,7 @@ class PluginInstallerTest extends TestCase
protected $autoloadGenerator;
/**
* @var CompletePackage[]
* @var array<CompletePackage|CompleteAliasPackage>
*/
protected $packages;
@ -275,7 +276,7 @@ class PluginInstallerTest extends TestCase
/**
* @param string $newPluginApiVersion
* @param CompletePackage[] $plugins
* @param array<CompletePackage|CompleteAliasPackage> $plugins
*
* @return void
*/