commit
b6c1afaa47
|
@ -16,8 +16,8 @@ $finder = PhpCsFixer\Finder::create()
|
||||||
->in(__DIR__.'/tests')
|
->in(__DIR__.'/tests')
|
||||||
->name('*.php')
|
->name('*.php')
|
||||||
->notPath('Fixtures')
|
->notPath('Fixtures')
|
||||||
->notPath(__DIR__.'/src/Composer/Autoload/ClassLoader.php')
|
->notPath('Composer/Autoload/ClassLoader.php')
|
||||||
->notPath(__DIR__.'/src/Composer/InstalledVersions.php')
|
->notPath('Composer/InstalledVersions.php')
|
||||||
;
|
;
|
||||||
|
|
||||||
$config = new PhpCsFixer\Config();
|
$config = new PhpCsFixer\Config();
|
||||||
|
@ -70,7 +70,11 @@ return $config->setRules([
|
||||||
'combine_nested_dirname' => true,
|
'combine_nested_dirname' => true,
|
||||||
'random_api_migration' => true,
|
'random_api_migration' => true,
|
||||||
'ternary_to_null_coalescing' => true,
|
'ternary_to_null_coalescing' => true,
|
||||||
|
'phpdoc_to_param_type' => true,
|
||||||
//'declare_strict_types' => true,
|
//'declare_strict_types' => true,
|
||||||
|
|
||||||
|
// TODO php 7.4 migration (one day..)
|
||||||
|
// 'phpdoc_to_property_type' => true,
|
||||||
])
|
])
|
||||||
->setUsingCache(true)
|
->setUsingCache(true)
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
|
assert(is_string($cwd));
|
||||||
chdir(__DIR__.'/../');
|
chdir(__DIR__.'/../');
|
||||||
$ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD'));
|
$ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD'));
|
||||||
if (!is_numeric($ts)) {
|
if (!is_numeric($ts)) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
||||||
count: 3
|
count: 2
|
||||||
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -127,7 +127,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
|
||||||
count: 3
|
count: 2
|
||||||
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -240,16 +240,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Autoload/ClassMapGenerator.php
|
path: ../src/Composer/Autoload/ClassMapGenerator.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Autoload/ClassMapGenerator.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$str of function preg_quote expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Autoload/ClassMapGenerator.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -325,11 +315,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/ArchiveCommand.php
|
path: ../src/Composer/Command/ArchiveCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$from of method Composer\\\\Util\\\\Filesystem\\:\\:findShortestPath\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/ArchiveCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, Composer\\\\Composer\\|null given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, Composer\\\\Composer\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -395,11 +380,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/CheckPlatformReqsCommand.php
|
path: ../src/Composer/Command/CheckPlatformReqsCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getLockedRepository\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/CheckPlatformReqsCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\|null given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -470,11 +450,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/ConfigCommand.php
|
path: ../src/Composer/Command/ConfigCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/ConfigCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$rawContents of method Composer\\\\Command\\\\ConfigCommand\\:\\:listConfiguration\\(\\) expects array\\<array\\|string\\>, array\\|string\\|null given\\.$#"
|
message: "#^Parameter \\#2 \\$rawContents of method Composer\\\\Command\\\\ConfigCommand\\:\\:listConfiguration\\(\\) expects array\\<array\\|string\\>, array\\|string\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -485,11 +460,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/ConfigCommand.php
|
path: ../src/Composer/Command/ConfigCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/CreateProjectCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in &&, Composer\\\\Package\\\\PackageInterface\\|false given on the right side\\.$#"
|
message: "#^Only booleans are allowed in &&, Composer\\\\Package\\\\PackageInterface\\|false given on the right side\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -515,21 +485,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../src/Composer/Command/CreateProjectCommand.php
|
path: ../src/Composer/Command/CreateProjectCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/CreateProjectCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$dirs of method Symfony\\\\Component\\\\Finder\\\\Finder\\:\\:in\\(\\) expects array\\<string\\>\\|string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/CreateProjectCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$from of method Composer\\\\Util\\\\Filesystem\\:\\:findShortestPath\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/CreateProjectCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#3 \\$existingRepos of static method Composer\\\\Repository\\\\RepositoryFactory\\:\\:generateRepositoryName\\(\\) expects array\\<string, mixed\\>, array\\<int\\|string, mixed\\> given\\.$#"
|
message: "#^Parameter \\#3 \\$existingRepos of static method Composer\\\\Repository\\\\RepositoryFactory\\:\\:generateRepositoryName\\(\\) expects array\\<string, mixed\\>, array\\<int\\|string, mixed\\> given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -600,11 +555,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/DiagnoseCommand.php
|
path: ../src/Composer/Command/DiagnoseCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, array\\<string\\>\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/DiagnoseCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, array\\<string\\>\\|string\\|false given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, array\\<string\\>\\|string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -795,11 +745,6 @@ parameters:
|
||||||
count: 8
|
count: 8
|
||||||
path: ../src/Composer/Command/InitCommand.php
|
path: ../src/Composer/Command/InitCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Package\\\\Locker\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/InstallCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in \\|\\|, mixed given on the right side\\.$#"
|
message: "#^Only booleans are allowed in \\|\\|, mixed given on the right side\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -830,16 +775,6 @@ parameters:
|
||||||
count: 3
|
count: 3
|
||||||
path: ../src/Composer/Command/ReinstallCommand.php
|
path: ../src/Composer/Command/ReinstallCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getLockedRepository\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/RemoveCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/RemoveCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Foreach overwrites \\$type with its key variable\\.$#"
|
message: "#^Foreach overwrites \\$type with its key variable\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -875,11 +810,6 @@ parameters:
|
||||||
count: 4
|
count: 4
|
||||||
path: ../src/Composer/Command/RequireCommand.php
|
path: ../src/Composer/Command/RequireCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/RequireCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -940,11 +870,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/RunScriptCommand.php
|
path: ../src/Composer/Command/RunScriptCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/ScriptAliasCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1130,11 +1055,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
path: ../src/Composer/Command/ShowCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getLockedRepository\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method getPrettyVersion\\(\\) on Composer\\\\Package\\\\BasePackage\\|int\\.$#"
|
message: "#^Cannot call method getPrettyVersion\\(\\) on Composer\\\\Package\\\\BasePackage\\|int\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1145,11 +1065,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
path: ../src/Composer/Command/ShowCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Foreach overwrites \\$packages with its value variable\\.$#"
|
message: "#^Foreach overwrites \\$packages with its value variable\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1180,11 +1095,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
path: ../src/Composer/Command/ShowCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in &&, Composer\\\\Package\\\\PackageInterface\\|false\\|null given on the right side\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/ShowCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in &&, Composer\\\\Package\\\\PackageInterface\\|null given on the left side\\.$#"
|
message: "#^Only booleans are allowed in &&, Composer\\\\Package\\\\PackageInterface\\|null given on the left side\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1455,21 +1365,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Command/SuggestsCommand.php
|
path: ../src/Composer/Command/SuggestsCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getLockedRepository\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/SuggestsCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getPlatformOverrides\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/SuggestsCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/SuggestsCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -1505,21 +1400,6 @@ parameters:
|
||||||
count: 3
|
count: 3
|
||||||
path: ../src/Composer/Command/UpdateCommand.php
|
path: ../src/Composer/Command/UpdateCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getLockedRepository\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/ValidateCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isFresh\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Command/ValidateCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method isLocked\\(\\) on Composer\\\\Package\\\\Locker\\|null\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Command/ValidateCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, array\\<Composer\\\\Package\\\\BasePackage\\> given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, array\\<Composer\\\\Package\\\\BasePackage\\> given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1710,11 +1590,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Console/Application.php
|
path: ../src/Composer/Console/Application.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, array\\<string\\>\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Console/Application.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, int given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, int given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1745,21 +1620,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Console/Application.php
|
path: ../src/Composer/Console/Application.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$path of function dirname expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Console/Application.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$file of method Composer\\\\Console\\\\GithubActionError\\:\\:emit\\(\\) expects string\\|null, string\\|false given\\.$#"
|
message: "#^Parameter \\#2 \\$file of method Composer\\\\Console\\\\GithubActionError\\:\\:emit\\(\\) expects string\\|null, string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Console/Application.php
|
path: ../src/Composer/Console/Application.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property Composer\\\\Console\\\\Application\\:\\:\\$initialWorkingDirectory \\(string\\) does not accept string\\|false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Console/Application.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -1820,21 +1685,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/DependencyResolver/DefaultPolicy.php
|
path: ../src/Composer/DependencyResolver/DefaultPolicy.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$requiredPackage \\(string\\) of method Composer\\\\DependencyResolver\\\\DefaultPolicy\\:\\:selectPreferredPackages\\(\\) should be contravariant with parameter \\$requiredPackage \\(string\\|null\\) of method Composer\\\\DependencyResolver\\\\PolicyInterface\\:\\:selectPreferredPackages\\(\\)$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/DependencyResolver/DefaultPolicy.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot access offset 'hash' on array\\|false\\.$#"
|
message: "#^Cannot access offset 'hash' on array\\|false\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/DependencyResolver/GenericRule.php
|
path: ../src/Composer/DependencyResolver/GenericRule.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in &&, DateTime\\|null given on the left side\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/DependencyResolver/LockTransaction.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in &&, string\\|null given on the left side\\.$#"
|
message: "#^Only booleans are allowed in &&, string\\|null given on the left side\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -2340,11 +2195,6 @@ parameters:
|
||||||
count: 4
|
count: 4
|
||||||
path: ../src/Composer/Downloader/DownloadManager.php
|
path: ../src/Composer/Downloader/DownloadManager.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, React\\\\Promise\\\\PromiseInterface\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Downloader/DownloadManager.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -2725,11 +2575,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../src/Composer/Downloader/VcsDownloader.php
|
path: ../src/Composer/Downloader/VcsDownloader.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in a negated boolean, string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Downloader/VcsDownloader.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, string\\|null given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, string\\|null given\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -2745,11 +2590,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Downloader/VcsDownloader.php
|
path: ../src/Composer/Downloader/VcsDownloader.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Downloader/VcsDownloader.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$fromReference of method Composer\\\\Downloader\\\\VcsDownloader\\:\\:getCommitLogs\\(\\) expects string, string\\|null given\\.$#"
|
message: "#^Parameter \\#1 \\$fromReference of method Composer\\\\Downloader\\\\VcsDownloader\\:\\:getCommitLogs\\(\\) expects string, string\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -2990,11 +2830,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Factory.php
|
path: ../src/Composer/Factory.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Factory.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#4 \\$composerFileContents of class Composer\\\\Package\\\\Locker constructor expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#4 \\$composerFileContents of class Composer\\\\Package\\\\Locker constructor expects string, string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -3002,7 +2837,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 5
|
count: 3
|
||||||
path: ../src/Composer/Factory.php
|
path: ../src/Composer/Factory.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -3625,21 +3460,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Package/Comparer/Comparer.php
|
path: ../src/Composer/Package/Comparer/Comparer.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Package/Comparer/Comparer.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc type Composer\\\\Package\\\\CompletePackage of property Composer\\\\Package\\\\CompleteAliasPackage\\:\\:\\$aliasOf is not the same as PHPDoc type Composer\\\\Package\\\\BasePackage of overridden property Composer\\\\Package\\\\AliasPackage\\:\\:\\$aliasOf\\.$#"
|
message: "#^PHPDoc type Composer\\\\Package\\\\CompletePackage of property Composer\\\\Package\\\\CompleteAliasPackage\\:\\:\\$aliasOf is not the same as PHPDoc type Composer\\\\Package\\\\BasePackage of overridden property Composer\\\\Package\\\\AliasPackage\\:\\:\\$aliasOf\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Package/CompleteAliasPackage.php
|
path: ../src/Composer/Package/CompleteAliasPackage.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, DateTime\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Package/Dumper/ArrayDumper.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, array\\<int, array\\<string, bool\\|string\\>\\>\\|null given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, array\\<int, array\\<string, bool\\|string\\>\\>\\|null given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -3700,11 +3525,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Package/Loader/ArrayLoader.php
|
path: ../src/Composer/Package/Loader/ArrayLoader.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Composer\\\\Package\\\\Loader\\\\ArrayLoader\\:\\:createObject\\(\\) should return Composer\\\\Package\\\\CompletePackage but returns PackageClass of Composer\\\\Package\\\\CompletePackageInterface\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Package/Loader/ArrayLoader.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in &&, string\\|false given on the left side\\.$#"
|
message: "#^Only booleans are allowed in &&, string\\|false given on the left side\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -3786,23 +3606,18 @@ parameters:
|
||||||
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$class \\(class\\-string\\<PackageClass of Composer\\\\Package\\\\RootPackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\RootPackageLoader\\:\\:load\\(\\) should be contravariant with parameter \\$class \\(class\\-string\\<Composer\\\\Package\\\\CompletePackageInterface\\>\\) of method Composer\\\\Package\\\\Loader\\\\ArrayLoader\\:\\:load\\(\\)$#"
|
message: "#^Parameter \\#2 \\$class \\(class\\-string\\<Composer\\\\Package\\\\RootPackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\RootPackageLoader\\:\\:load\\(\\) should be contravariant with parameter \\$class \\(class\\-string\\<Composer\\\\Package\\\\CompletePackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\ArrayLoader\\:\\:load\\(\\)$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$class \\(class\\-string\\<PackageClass of Composer\\\\Package\\\\RootPackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\RootPackageLoader\\:\\:load\\(\\) should be contravariant with parameter \\$class \\(class\\-string\\<Composer\\\\Package\\\\CompletePackageInterface\\>\\) of method Composer\\\\Package\\\\Loader\\\\LoaderInterface\\:\\:load\\(\\)$#"
|
message: "#^Parameter \\#2 \\$class \\(class\\-string\\<Composer\\\\Package\\\\RootPackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\RootPackageLoader\\:\\:load\\(\\) should be contravariant with parameter \\$class \\(class\\-string\\<Composer\\\\Package\\\\CompletePackage\\>\\) of method Composer\\\\Package\\\\Loader\\\\LoaderInterface\\:\\:load\\(\\)$#"
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$path of method Composer\\\\Package\\\\Version\\\\VersionGuesser\\:\\:guessVersion\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 2
|
count: 1
|
||||||
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
path: ../src/Composer/Package/Loader/RootPackageLoader.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -4080,11 +3895,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Platform/Runtime.php
|
path: ../src/Composer/Platform/Runtime.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method getInstallationManager\\(\\) on Composer\\\\Composer\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Plugin/PluginManager.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Casting to array\\<string\\> something that's already array\\<string\\>\\.$#"
|
message: "#^Casting to array\\<string\\> something that's already array\\<string\\>\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -4115,11 +3925,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Plugin/PluginManager.php
|
path: ../src/Composer/Plugin/PluginManager.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in a ternary operator condition, Composer\\\\Composer\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Plugin/PluginManager.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a ternary operator condition, array\\<int, string\\> given\\.$#"
|
message: "#^Only booleans are allowed in a ternary operator condition, array\\<int, string\\> given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -4137,7 +3942,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, Composer\\\\Repository\\\\InstalledRepositoryInterface\\|null given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, Composer\\\\Repository\\\\InstalledRepositoryInterface\\|null given\\.$#"
|
||||||
count: 3
|
count: 2
|
||||||
path: ../src/Composer/Plugin/PluginManager.php
|
path: ../src/Composer/Plugin/PluginManager.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -4475,11 +4280,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Repository/FilesystemRepository.php
|
path: ../src/Composer/Repository/FilesystemRepository.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Repository/FilesystemRepository.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$path of method Composer\\\\Util\\\\Filesystem\\:\\:normalizePath\\(\\) expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$path of method Composer\\\\Util\\\\Filesystem\\:\\:normalizePath\\(\\) expects string, string\\|false given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -4647,7 +4447,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$prettyVersion of method Composer\\\\Repository\\\\PlatformRepository\\:\\:addLibrary\\(\\) expects string, string\\|null given\\.$#"
|
message: "#^Parameter \\#2 \\$prettyVersion of method Composer\\\\Repository\\\\PlatformRepository\\:\\:addLibrary\\(\\) expects string, string\\|null given\\.$#"
|
||||||
count: 4
|
count: 3
|
||||||
path: ../src/Composer/Repository/PlatformRepository.php
|
path: ../src/Composer/Repository/PlatformRepository.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -4670,11 +4470,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Repository/RepositoryFactory.php
|
path: ../src/Composer/Repository/RepositoryFactory.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Composer\\\\Repository\\\\RepositoryFactory\\:\\:generateRepositoryName\\(\\) should return string but returns int\\|string\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Repository/RepositoryFactory.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Config\\|null given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Config\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -4790,11 +4585,6 @@ parameters:
|
||||||
count: 10
|
count: 10
|
||||||
path: ../src/Composer/Repository/Vcs/GitBitbucketDriver.php
|
path: ../src/Composer/Repository/Vcs/GitBitbucketDriver.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Repository/Vcs/GitBitbucketDriver.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitBitbucketDriver\\:\\:\\$branches \\(array\\<string, string\\>\\) does not accept array\\<int\\|string, mixed\\>\\.$#"
|
message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitBitbucketDriver\\:\\:\\$branches \\(array\\<string, string\\>\\) does not accept array\\<int\\|string, mixed\\>\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -4915,11 +4705,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Repository/Vcs/GitHubDriver.php
|
path: ../src/Composer/Repository/Vcs/GitHubDriver.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Repository/Vcs/GitHubDriver.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -4992,7 +4777,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||||
count: 2
|
count: 1
|
||||||
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
|
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -5170,11 +4955,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Repository/Vcs/VcsDriver.php
|
path: ../src/Composer/Repository/Vcs/VcsDriver.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in &&, DateTime\\|null given on the right side\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Repository/Vcs/VcsDriver.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in &&, string\\|false given on the right side\\.$#"
|
message: "#^Only booleans are allowed in &&, string\\|false given on the right side\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -5220,11 +5000,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Repository/VcsRepository.php
|
path: ../src/Composer/Repository/VcsRepository.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Only booleans are allowed in a negated boolean, array given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Repository/VcsRepository.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, array\\<Composer\\\\Package\\\\BasePackage\\> given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, array\\<Composer\\\\Package\\\\BasePackage\\> given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -5460,11 +5235,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Util/Filesystem.php
|
path: ../src/Composer/Util/Filesystem.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Util/Filesystem.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
||||||
count: 4
|
count: 4
|
||||||
|
@ -5885,11 +5655,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Util/Http/RequestProxy.php
|
path: ../src/Composer/Util/Http/RequestProxy.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Casting to int something that's already int\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Util/Http/Response.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Argument of an invalid type array\\<array\\<string, string\\>\\>\\|string supplied for foreach, only iterables are supported\\.$#"
|
message: "#^Argument of an invalid type array\\<array\\<string, string\\>\\>\\|string supplied for foreach, only iterables are supported\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -5985,11 +5750,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Util/HttpDownloader.php
|
path: ../src/Composer/Util/HttpDownloader.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$code of class Composer\\\\Util\\\\Http\\\\Response constructor expects int, int\\|null given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Util/HttpDownloader.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#4 \\$body of class Composer\\\\Util\\\\Http\\\\Response constructor expects string\\|null, bool\\|string given\\.$#"
|
message: "#^Parameter \\#4 \\$body of class Composer\\\\Util\\\\Http\\\\Response constructor expects string\\|null, bool\\|string given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6115,11 +5875,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../src/Composer/Util/Perforce.php
|
path: ../src/Composer/Util/Perforce.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../src/Composer/Util/Perforce.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -6415,16 +6170,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../src/Composer/Util/Svn.php
|
path: ../src/Composer/Util/Svn.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$cwd of method Composer\\\\Util\\\\Svn\\:\\:executeWithAuthRetry\\(\\) expects string, string\\|null given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../src/Composer/Util/Svn.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#4 \\$path of method Composer\\\\Util\\\\Svn\\:\\:executeWithAuthRetry\\(\\) expects string, string\\|null given\\.$#"
|
|
||||||
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\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6595,11 +6340,6 @@ parameters:
|
||||||
count: 3
|
count: 3
|
||||||
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
|
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property Composer\\\\Test\\\\Autoload\\\\AutoloadGeneratorTest\\:\\:\\$origDir \\(string\\) does not accept string\\|false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:ensureDirectoryExistsAndClear\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:ensureDirectoryExistsAndClear\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6650,16 +6390,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../tests/Composer/Test/ConfigTest.php
|
path: ../tests/Composer/Test/ConfigTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setProvides\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setReplaces\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Casting to string something that's already string\\.$#"
|
message: "#^Casting to string something that's already string\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -6700,11 +6430,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
|
path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6775,26 +6500,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/DependencyResolver/RuleTest.php
|
path: ../tests/Composer/Test/DependencyResolver/RuleTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setConflicts\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setProvides\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setReplaces\\(\\)\\.$#"
|
|
||||||
count: 9
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setRequires\\(\\)\\.$#"
|
|
||||||
count: 46
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot access property \\$testFlagLearnedPositiveLiteral on Composer\\\\DependencyResolver\\\\Solver\\|null\\.$#"
|
message: "#^Cannot access property \\$testFlagLearnedPositiveLiteral on Composer\\\\DependencyResolver\\\\Solver\\|null\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -6805,36 +6510,6 @@ parameters:
|
||||||
count: 8
|
count: 8
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$package of method Composer\\\\Test\\\\TestCase\\:\\:getAliasPackage\\(\\) expects Composer\\\\Package\\\\Package, Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage given\\.$#"
|
|
||||||
count: 5
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/SolverTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setExtra\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/TransactionTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setProvides\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/TransactionTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setRequires\\(\\)\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/TransactionTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setType\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/TransactionTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$package of method Composer\\\\Test\\\\TestCase\\:\\:getAliasPackage\\(\\) expects Composer\\\\Package\\\\Package, Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage given\\.$#"
|
|
||||||
count: 4
|
|
||||||
path: ../tests/Composer/Test/DependencyResolver/TransactionTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a ternary operator condition, int\\<0, max\\>\\|false given\\.$#"
|
message: "#^Only booleans are allowed in a ternary operator condition, int\\<0, max\\>\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6850,11 +6525,6 @@ parameters:
|
||||||
count: 6
|
count: 6
|
||||||
path: ../tests/Composer/Test/Downloader/FileDownloaderTest.php
|
path: ../tests/Composer/Test/Downloader/FileDownloaderTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$promises of method Composer\\\\Util\\\\Loop\\:\\:wait\\(\\) expects array\\<React\\\\Promise\\\\PromiseInterface\\>, array\\<int, React\\\\Promise\\\\PromiseInterface\\|null\\> given\\.$#"
|
|
||||||
count: 5
|
|
||||||
path: ../tests/Composer/Test/Downloader/FileDownloaderTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -6905,21 +6575,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Downloader/XzDownloaderTest.php
|
path: ../tests/Composer/Test/Downloader/XzDownloaderTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$promises of method Composer\\\\Util\\\\Loop\\:\\:wait\\(\\) expects array\\<React\\\\Promise\\\\PromiseInterface\\>, array\\<int, React\\\\Promise\\\\PromiseInterface\\|null\\> given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Downloader/XzDownloaderTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Downloader/ZipDownloaderTest.php
|
path: ../tests/Composer/Test/Downloader/ZipDownloaderTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$promises of method Composer\\\\Util\\\\Loop\\:\\:wait\\(\\) expects array\\<React\\\\Promise\\\\PromiseInterface\\>, array\\<int, React\\\\Promise\\\\PromiseInterface\\|null\\> given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Downloader/ZipDownloaderTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in a negated boolean, string\\|false given\\.$#"
|
message: "#^Only booleans are allowed in a negated boolean, string\\|false given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
@ -6930,11 +6590,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
|
path: ../tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -6988,21 +6643,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Installer/InstallerEventTest.php
|
path: ../tests/Composer/Test/Installer/InstallerEventTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:ensureDirectoryExistsAndClear\\(\\)\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/Installer/LibraryInstallerTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Installer/LibraryInstallerTest.php
|
path: ../tests/Composer/Test/Installer/LibraryInstallerTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setRequires\\(\\)\\.$#"
|
|
||||||
count: 4
|
|
||||||
path: ../tests/Composer/Test/InstallerTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to function is_array\\(\\) with array\\<Composer\\\\Repository\\\\RepositoryInterface\\> will always evaluate to true\\.$#"
|
message: "#^Call to function is_array\\(\\) with array\\<Composer\\\\Repository\\\\RepositoryInterface\\> will always evaluate to true\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7083,11 +6728,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/InstallerTest.php
|
path: ../tests/Composer/Test/InstallerTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property Composer\\\\Test\\\\InstallerTest\\:\\:\\$prevCwd \\(string\\) does not accept string\\|false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/InstallerTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 5
|
count: 5
|
||||||
|
@ -7113,16 +6753,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Json/JsonManipulatorTest.php
|
path: ../tests/Composer/Test/Json/JsonManipulatorTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$message of class Composer\\\\Json\\\\JsonValidationException constructor expects string, string\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Json/JsonValidationExceptionTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$errors of class Composer\\\\Json\\\\JsonValidationException constructor expects array\\<string\\>, array\\<string\\>\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Json/JsonValidationExceptionTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Offset 'url' on array\\{url\\: string, options\\?\\: array, status\\?\\: int, body\\?\\: string, headers\\?\\: array\\<string\\>\\} on left side of \\?\\? always exists and is not nullable\\.$#"
|
message: "#^Offset 'url' on array\\{url\\: string, options\\?\\: array, status\\?\\: int, body\\?\\: string, headers\\?\\: array\\<string\\>\\} on left side of \\?\\? always exists and is not nullable\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7173,11 +6803,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: ../tests/Composer/Test/Mock/ProcessExecutorMock.php
|
path: ../tests/Composer/Test/Mock/ProcessExecutorMock.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$cwd of method Composer\\\\Test\\\\Mock\\\\ProcessExecutorMock\\:\\:doExecute\\(\\) expects string, string\\|null given\\.$#"
|
|
||||||
count: 4
|
|
||||||
path: ../tests/Composer/Test/Mock/ProcessExecutorMock.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Composer\\\\Test\\\\Mock\\\\VersionGuesserMock\\:\\:__construct\\(\\) does not call parent constructor from Composer\\\\Package\\\\Version\\\\VersionGuesser\\.$#"
|
message: "#^Composer\\\\Test\\\\Mock\\\\VersionGuesserMock\\:\\:__construct\\(\\) does not call parent constructor from Composer\\\\Package\\\\Version\\\\VersionGuesser\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7198,61 +6823,31 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php
|
path: ../tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 8
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ArchiverTest.php
|
path: ../tests/Composer/Test/Package/Archiver/ArchiverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$url of method Composer\\\\Package\\\\Package\\:\\:setSourceUrl\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ArchiverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$sources of method Composer\\\\Package\\\\Archiver\\\\PharArchiver\\:\\:archive\\(\\) expects string, string\\|null given\\.$#"
|
message: "#^Parameter \\#1 \\$sources of method Composer\\\\Package\\\\Archiver\\\\PharArchiver\\:\\:archive\\(\\) expects string, string\\|null given\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$currentWorkDir of method Composer\\\\Test\\\\Package\\\\Archiver\\\\PharArchiverTest\\:\\:writeFile\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 5
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/PharArchiverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$sources of method Composer\\\\Package\\\\Archiver\\\\ZipArchiver\\:\\:archive\\(\\) expects string, string\\|null given\\.$#"
|
message: "#^Parameter \\#1 \\$sources of method Composer\\\\Package\\\\Archiver\\\\ZipArchiver\\:\\:archive\\(\\) expects string, string\\|null given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$currentWorkDir of method Composer\\\\Test\\\\Package\\\\Archiver\\\\ZipArchiverTest\\:\\:writeFile\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Implicit array creation is not allowed \\- variable \\$provider does not exist\\.$#"
|
message: "#^Implicit array creation is not allowed \\- variable \\$provider does not exist\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7260,7 +6855,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||||
count: 2
|
count: 1
|
||||||
path: ../tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
|
path: ../tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -7353,16 +6948,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
|
path: ../tests/Composer/Test/Question/StrictConfirmationQuestionTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setType\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/ArrayRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$package of method Composer\\\\Test\\\\TestCase\\:\\:getAliasPackage\\(\\) expects Composer\\\\Package\\\\Package, Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/ArrayRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method getDistType\\(\\) on Composer\\\\Package\\\\BasePackage\\|null\\.$#"
|
message: "#^Cannot call method getDistType\\(\\) on Composer\\\\Package\\\\BasePackage\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7388,34 +6973,14 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Repository/CompositeRepositoryTest.php
|
path: ../tests/Composer/Test/Repository/CompositeRepositoryTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setType\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/FilesystemRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Repository/FilesystemRepositoryTest.php
|
path: ../tests/Composer/Test/Repository/FilesystemRepositoryTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$package of method Composer\\\\Test\\\\TestCase\\:\\:getAliasPackage\\(\\) expects Composer\\\\Package\\\\Package, Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: ../tests/Composer/Test/Repository/FilesystemRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setProvides\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/InstalledRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\:\\:setReplaces\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/InstalledRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
||||||
count: 3
|
count: 2
|
||||||
path: ../tests/Composer/Test/Repository/PathRepositoryTest.php
|
path: ../tests/Composer/Test/Repository/PathRepositoryTest.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -7523,21 +7088,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: ../tests/Composer/Test/Repository/VcsRepositoryTest.php
|
path: ../tests/Composer/Test/Repository/VcsRepositoryTest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$directory of function chdir expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/VcsRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$cwd of method Composer\\\\Util\\\\ProcessExecutor\\:\\:execute\\(\\) expects string\\|null, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/Repository/VcsRepositoryTest.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Composer\\\\Test\\\\TestCase\\:\\:getPackage\\(\\) should return Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage but returns PackageClass of Composer\\\\Package\\\\PackageInterface\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../tests/Composer/Test/TestCase.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\) should return string but returns string\\|false\\.$#"
|
message: "#^Method Composer\\\\Test\\\\TestCase\\:\\:getUniqueTmpDirectory\\(\\) should return string but returns string\\|false\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -7575,7 +7125,7 @@ parameters:
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Only booleans are allowed in an if condition, string given\\.$#"
|
message: "#^Only booleans are allowed in an if condition, string given\\.$#"
|
||||||
count: 2
|
count: 1
|
||||||
path: ../tests/Composer/Test/Util/Http/ProxyManagerTest.php
|
path: ../tests/Composer/Test/Util/Http/ProxyManagerTest.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
|
|
@ -89,7 +89,7 @@ class AutoloadGenerator
|
||||||
* @param bool $devMode
|
* @param bool $devMode
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setDevMode($devMode = true)
|
public function setDevMode(bool $devMode = true)
|
||||||
{
|
{
|
||||||
$this->devMode = (bool) $devMode;
|
$this->devMode = (bool) $devMode;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class AutoloadGenerator
|
||||||
* @param bool $classMapAuthoritative
|
* @param bool $classMapAuthoritative
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
public function setClassMapAuthoritative(bool $classMapAuthoritative)
|
||||||
{
|
{
|
||||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ class AutoloadGenerator
|
||||||
* @param string|null $apcuPrefix
|
* @param string|null $apcuPrefix
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setApcu($apcu, $apcuPrefix = null)
|
public function setApcu(bool $apcu, ?string $apcuPrefix = null)
|
||||||
{
|
{
|
||||||
$this->apcu = (bool) $apcu;
|
$this->apcu = (bool) $apcu;
|
||||||
$this->apcuPrefix = $apcuPrefix !== null ? (string) $apcuPrefix : $apcuPrefix;
|
$this->apcuPrefix = $apcuPrefix !== null ? (string) $apcuPrefix : $apcuPrefix;
|
||||||
|
@ -124,7 +124,7 @@ class AutoloadGenerator
|
||||||
* @param bool $runScripts
|
* @param bool $runScripts
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setRunScripts($runScripts = true)
|
public function setRunScripts(bool $runScripts = true)
|
||||||
{
|
{
|
||||||
$this->runScripts = (bool) $runScripts;
|
$this->runScripts = (bool) $runScripts;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ class AutoloadGenerator
|
||||||
* @return int
|
* @return int
|
||||||
* @throws \Seld\JsonLint\ParsingException
|
* @throws \Seld\JsonLint\ParsingException
|
||||||
*/
|
*/
|
||||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
|
public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, string $suffix = '')
|
||||||
{
|
{
|
||||||
if ($this->classMapAuthoritative) {
|
if ($this->classMapAuthoritative) {
|
||||||
// Force scanPsrPackages when classmap is authoritative
|
// Force scanPsrPackages when classmap is authoritative
|
||||||
|
@ -200,7 +200,7 @@ class AutoloadGenerator
|
||||||
// Do not remove double realpath() calls.
|
// Do not remove double realpath() calls.
|
||||||
// Fixes failing Windows realpath() implementation.
|
// Fixes failing Windows realpath() implementation.
|
||||||
// See https://bugs.php.net/bug.php?id=72738
|
// See https://bugs.php.net/bug.php?id=72738
|
||||||
$basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
|
$basePath = $filesystem->normalizePath(realpath(realpath(Platform::getCwd())));
|
||||||
$vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
|
$vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
|
||||||
$useGlobalIncludePath = (bool) $config->get('use-include-path');
|
$useGlobalIncludePath = (bool) $config->get('use-include-path');
|
||||||
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
|
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
|
||||||
|
@ -433,15 +433,15 @@ EOF;
|
||||||
* @param string $basePath
|
* @param string $basePath
|
||||||
* @param string $vendorPath
|
* @param string $vendorPath
|
||||||
* @param string $dir
|
* @param string $dir
|
||||||
* @param ?array<int, string> $excluded
|
* @param null|array<int, string> $excluded
|
||||||
* @param ?string $namespaceFilter
|
* @param null|string $namespaceFilter
|
||||||
* @param ?string $autoloadType
|
* @param null|string $autoloadType
|
||||||
* @param array<class-string, string> $classMap
|
* @param array<class-string, string> $classMap
|
||||||
* @param array<class-string, array<int, string>> $ambiguousClasses
|
* @param array<class-string, array<int, string>> $ambiguousClasses
|
||||||
* @param array<string, true> $scannedFiles
|
* @param array<string, true> $scannedFiles
|
||||||
* @return array<class-string, string>
|
* @return array<class-string, string>
|
||||||
*/
|
*/
|
||||||
private function addClassMapCode(Filesystem $filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles): array
|
private function addClassMapCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $dir, ?array $excluded, ?string $namespaceFilter, ?string $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles): array
|
||||||
{
|
{
|
||||||
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
|
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
|
||||||
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
|
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
|
||||||
|
@ -457,14 +457,14 @@ EOF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $dir
|
* @param string $dir
|
||||||
* @param ?array<int, string> $excluded
|
* @param null|array<int, string> $excluded
|
||||||
* @param ?string $namespaceFilter
|
* @param null|string $namespaceFilter
|
||||||
* @param ?string $autoloadType
|
* @param null|string $autoloadType
|
||||||
* @param bool $showAmbiguousWarning
|
* @param bool $showAmbiguousWarning
|
||||||
* @param array<string, true> $scannedFiles
|
* @param array<string, true> $scannedFiles
|
||||||
* @return array<class-string, string>
|
* @return array<class-string, string>
|
||||||
*/
|
*/
|
||||||
private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles): array
|
private function generateClassMap(string $dir, ?array $excluded, ?string $namespaceFilter, ?string $autoloadType, bool $showAmbiguousWarning, array &$scannedFiles): array
|
||||||
{
|
{
|
||||||
if ($excluded) {
|
if ($excluded) {
|
||||||
// filter excluded patterns here to only use those matching $dir
|
// filter excluded patterns here to only use those matching $dir
|
||||||
|
@ -586,10 +586,10 @@ EOF;
|
||||||
* Registers an autoloader based on an autoload-map returned by parseAutoloads
|
* Registers an autoloader based on an autoload-map returned by parseAutoloads
|
||||||
*
|
*
|
||||||
* @param array<string, mixed[]> $autoloads see parseAutoloads return value
|
* @param array<string, mixed[]> $autoloads see parseAutoloads return value
|
||||||
* @param ?string $vendorDir
|
* @param null|string $vendorDir
|
||||||
* @return ClassLoader
|
* @return ClassLoader
|
||||||
*/
|
*/
|
||||||
public function createLoader(array $autoloads, $vendorDir = null)
|
public function createLoader(array $autoloads, ?string $vendorDir = null)
|
||||||
{
|
{
|
||||||
$loader = new ClassLoader($vendorDir);
|
$loader = new ClassLoader($vendorDir);
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ EOF;
|
||||||
* @param string $appBaseDirCode
|
* @param string $appBaseDirCode
|
||||||
* @return ?string
|
* @return ?string
|
||||||
*/
|
*/
|
||||||
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
|
||||||
{
|
{
|
||||||
$includePaths = array();
|
$includePaths = array();
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ EOF;
|
||||||
* @param string $appBaseDirCode
|
* @param string $appBaseDirCode
|
||||||
* @return ?string
|
* @return ?string
|
||||||
*/
|
*/
|
||||||
protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
protected function getIncludeFilesFile(array $files, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
|
||||||
{
|
{
|
||||||
$filesCode = '';
|
$filesCode = '';
|
||||||
foreach ($files as $fileIdentifier => $functionFile) {
|
foreach ($files as $fileIdentifier => $functionFile) {
|
||||||
|
@ -712,7 +712,7 @@ EOF;
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
|
protected function getPathCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $path)
|
||||||
{
|
{
|
||||||
if (!$filesystem->isAbsolutePath($path)) {
|
if (!$filesystem->isAbsolutePath($path)) {
|
||||||
$path = $basePath . '/' . $path;
|
$path = $basePath . '/' . $path;
|
||||||
|
@ -748,7 +748,7 @@ EOF;
|
||||||
* @param string[] $devPackageNames
|
* @param string[] $devPackageNames
|
||||||
* @return ?string
|
* @return ?string
|
||||||
*/
|
*/
|
||||||
protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
|
protected function getPlatformCheck(array $packageMap, bool $checkPlatform, array $devPackageNames)
|
||||||
{
|
{
|
||||||
$lowestPhpVersion = Bound::zero();
|
$lowestPhpVersion = Bound::zero();
|
||||||
$requiredExtensions = array();
|
$requiredExtensions = array();
|
||||||
|
@ -906,7 +906,7 @@ PLATFORM_CHECK;
|
||||||
* @param string $suffix
|
* @param string $suffix
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
|
protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
|
||||||
{
|
{
|
||||||
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
||||||
if ("'" === $lastChar || '"' === $lastChar) {
|
if ("'" === $lastChar || '"' === $lastChar) {
|
||||||
|
@ -930,7 +930,7 @@ AUTOLOAD;
|
||||||
/**
|
/**
|
||||||
* @param bool $useClassMap
|
* @param bool $useClassMap
|
||||||
* @param bool $useIncludePath
|
* @param bool $useIncludePath
|
||||||
* @param ?string $targetDirLoader
|
* @param null|string $targetDirLoader
|
||||||
* @param bool $useIncludeFiles
|
* @param bool $useIncludeFiles
|
||||||
* @param string $vendorPathCode unused in this method
|
* @param string $vendorPathCode unused in this method
|
||||||
* @param string $appBaseDirCode unused in this method
|
* @param string $appBaseDirCode unused in this method
|
||||||
|
@ -940,7 +940,7 @@ AUTOLOAD;
|
||||||
* @param bool $checkPlatform
|
* @param bool $checkPlatform
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform)
|
protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)
|
||||||
{
|
{
|
||||||
$file = <<<HEADER
|
$file = <<<HEADER
|
||||||
<?php
|
<?php
|
||||||
|
@ -1092,7 +1092,7 @@ FOOTER;
|
||||||
* @param string $basePath input for findShortestPathCode
|
* @param string $basePath input for findShortestPathCode
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath)
|
protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
|
||||||
{
|
{
|
||||||
$file = <<<HEADER
|
$file = <<<HEADER
|
||||||
<?php
|
<?php
|
||||||
|
@ -1185,7 +1185,7 @@ INITIALIZER;
|
||||||
* @param string $type one of: 'psr-0'|'psr-4'|'classmap'|'files'
|
* @param string $type one of: 'psr-0'|'psr-4'|'classmap'|'files'
|
||||||
* @return array<int, string>|array<string, array<string>>|array<string, string>
|
* @return array<int, string>|array<string, array<string>>|array<string, string>
|
||||||
*/
|
*/
|
||||||
protected function parseAutoloadsType(array $packageMap, $type, RootPackageInterface $rootPackage)
|
protected function parseAutoloadsType(array $packageMap, string $type, RootPackageInterface $rootPackage)
|
||||||
{
|
{
|
||||||
$autoloads = array();
|
$autoloads = array();
|
||||||
|
|
||||||
|
@ -1240,7 +1240,7 @@ INITIALIZER;
|
||||||
$path
|
$path
|
||||||
);
|
);
|
||||||
if (empty($installPath)) {
|
if (empty($installPath)) {
|
||||||
$installPath = strtr(getcwd(), '\\', '/');
|
$installPath = strtr(Platform::getCwd(), '\\', '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$resolvedPath = realpath($installPath . '/' . $updir);
|
$resolvedPath = realpath($installPath . '/' . $updir);
|
||||||
|
@ -1271,7 +1271,7 @@ INITIALIZER;
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getFileIdentifier(PackageInterface $package, $path)
|
protected function getFileIdentifier(PackageInterface $package, string $path)
|
||||||
{
|
{
|
||||||
return md5($package->getName() . ':' . $path);
|
return md5($package->getName() . ':' . $path);
|
||||||
}
|
}
|
||||||
|
@ -1364,12 +1364,7 @@ INITIALIZER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function composerRequire(string $fileIdentifier, string $file): void
|
||||||
* @param string $fileIdentifier
|
|
||||||
* @param string $file
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function composerRequire($fileIdentifier, $file)
|
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
use Composer\Pcre\Preg;
|
use Composer\Pcre\Preg;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
@ -38,7 +39,7 @@ class ClassMapGenerator
|
||||||
* @param string $file The name of the class map file
|
* @param string $file The name of the class map file
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function dump($dirs, $file): void
|
public static function dump(iterable $dirs, string $file): void
|
||||||
{
|
{
|
||||||
$maps = array();
|
$maps = array();
|
||||||
|
|
||||||
|
@ -55,13 +56,13 @@ class ClassMapGenerator
|
||||||
* @param \Traversable<\SplFileInfo>|string|array<string> $path The path to search in or an iterator
|
* @param \Traversable<\SplFileInfo>|string|array<string> $path The path to search in or an iterator
|
||||||
* @param string $excluded Regex that matches file paths to be excluded from the classmap
|
* @param string $excluded Regex that matches file paths to be excluded from the classmap
|
||||||
* @param ?IOInterface $io IO object
|
* @param ?IOInterface $io IO object
|
||||||
* @param ?string $namespace Optional namespace prefix to filter by
|
* @param null|string $namespace Optional namespace prefix to filter by
|
||||||
* @param ?string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
|
* @param null|string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
|
||||||
* @param array<string, true> $scannedFiles
|
* @param array<string, true> $scannedFiles
|
||||||
* @return array<class-string, string> A class map array
|
* @return array<class-string, string> A class map array
|
||||||
* @throws \RuntimeException When the path is neither an existing file nor directory
|
* @throws \RuntimeException When the path is neither an existing file nor directory
|
||||||
*/
|
*/
|
||||||
public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array()): array
|
public static function createMap($path, string $excluded = null, IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = array()): array
|
||||||
{
|
{
|
||||||
$basePath = $path;
|
$basePath = $path;
|
||||||
if (is_string($path)) {
|
if (is_string($path)) {
|
||||||
|
@ -81,7 +82,7 @@ class ClassMapGenerator
|
||||||
|
|
||||||
$map = array();
|
$map = array();
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$cwd = realpath(getcwd());
|
$cwd = realpath(Platform::getCwd());
|
||||||
|
|
||||||
foreach ($path as $file) {
|
foreach ($path as $file) {
|
||||||
$filePath = $file->getPathname();
|
$filePath = $file->getPathname();
|
||||||
|
@ -157,7 +158,7 @@ class ClassMapGenerator
|
||||||
* @param ?IOInterface $io IO object
|
* @param ?IOInterface $io IO object
|
||||||
* @return array<int, class-string> valid classes
|
* @return array<int, class-string> valid classes
|
||||||
*/
|
*/
|
||||||
private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io): array
|
private static function filterByNamespace(array $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath, ?IOInterface $io): array
|
||||||
{
|
{
|
||||||
$validClasses = array();
|
$validClasses = array();
|
||||||
$rejectedClasses = array();
|
$rejectedClasses = array();
|
||||||
|
@ -198,7 +199,7 @@ class ClassMapGenerator
|
||||||
if (empty($validClasses)) {
|
if (empty($validClasses)) {
|
||||||
foreach ($rejectedClasses as $class) {
|
foreach ($rejectedClasses as $class) {
|
||||||
if ($io) {
|
if ($io) {
|
||||||
$io->writeError("<warning>Class $class located in ".Preg::replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.</warning>");
|
$io->writeError("<warning>Class $class located in ".Preg::replace('{^'.preg_quote(Platform::getCwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.</warning>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ class ClassMapGenerator
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return array<int, class-string> The found classes
|
* @return array<int, class-string> The found classes
|
||||||
*/
|
*/
|
||||||
private static function findClasses($path): array
|
private static function findClasses(string $path): array
|
||||||
{
|
{
|
||||||
$extraTypes = self::getExtraTypes();
|
$extraTypes = self::getExtraTypes();
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class PhpFileCleaner
|
||||||
* @param string[] $types
|
* @param string[] $types
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function setTypeConfig($types): void
|
public static function setTypeConfig(array $types): void
|
||||||
{
|
{
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
self::$typeConfig[$type[0]] = array(
|
self::$typeConfig[$type[0]] = array(
|
||||||
|
@ -68,7 +68,7 @@ class PhpFileCleaner
|
||||||
* @param string $contents
|
* @param string $contents
|
||||||
* @param int $maxMatches
|
* @param int $maxMatches
|
||||||
*/
|
*/
|
||||||
public function __construct($contents, $maxMatches)
|
public function __construct(string $contents, int $maxMatches)
|
||||||
{
|
{
|
||||||
$this->contents = $contents;
|
$this->contents = $contents;
|
||||||
$this->len = \strlen($this->contents);
|
$this->len = \strlen($this->contents);
|
||||||
|
@ -168,7 +168,7 @@ class PhpFileCleaner
|
||||||
* @param string $delimiter
|
* @param string $delimiter
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function skipString($delimiter): void
|
private function skipString(string $delimiter): void
|
||||||
{
|
{
|
||||||
$this->index += 1;
|
$this->index += 1;
|
||||||
while ($this->index < $this->len) {
|
while ($this->index < $this->len) {
|
||||||
|
@ -217,7 +217,7 @@ class PhpFileCleaner
|
||||||
* @param string $delimiter
|
* @param string $delimiter
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function skipHeredoc($delimiter): void
|
private function skipHeredoc(string $delimiter): void
|
||||||
{
|
{
|
||||||
$firstDelimiterChar = $delimiter[0];
|
$firstDelimiterChar = $delimiter[0];
|
||||||
$delimiterLength = \strlen($delimiter);
|
$delimiterLength = \strlen($delimiter);
|
||||||
|
@ -260,14 +260,14 @@ class PhpFileCleaner
|
||||||
* @param string $char
|
* @param string $char
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function peek($char): bool
|
private function peek(string $char): bool
|
||||||
{
|
{
|
||||||
return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
|
return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param non-empty-string $regex
|
* @param non-empty-string $regex
|
||||||
* @param ?array<int, string> $match
|
* @param null|array<int, string> $match
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function match($regex, array &$match = null): bool
|
private function match($regex, array &$match = null): bool
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Cache
|
||||||
* @param Filesystem $filesystem optional filesystem instance
|
* @param Filesystem $filesystem optional filesystem instance
|
||||||
* @param bool $readOnly whether the cache is in readOnly mode
|
* @param bool $readOnly whether the cache is in readOnly mode
|
||||||
*/
|
*/
|
||||||
public function __construct(IOInterface $io, $cacheDir, $allowlist = 'a-z0-9.', Filesystem $filesystem = null, $readOnly = false)
|
public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9.', Filesystem $filesystem = null, bool $readOnly = false)
|
||||||
{
|
{
|
||||||
$this->io = $io;
|
$this->io = $io;
|
||||||
$this->root = rtrim($cacheDir, '/\\') . '/';
|
$this->root = rtrim($cacheDir, '/\\') . '/';
|
||||||
|
@ -66,7 +66,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setReadOnly($readOnly)
|
public function setReadOnly(bool $readOnly)
|
||||||
{
|
{
|
||||||
$this->readOnly = (bool) $readOnly;
|
$this->readOnly = (bool) $readOnly;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isUsable($path)
|
public static function isUsable(string $path)
|
||||||
{
|
{
|
||||||
return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
|
return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function read($file)
|
public function read(string $file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -142,7 +142,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function write($file, $contents)
|
public function write(string $file, string $contents)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled() && !$this->readOnly) {
|
if ($this->isEnabled() && !$this->readOnly) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -186,7 +186,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function copyFrom($file, $source)
|
public function copyFrom(string $file, string $source)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled() && !$this->readOnly) {
|
if ($this->isEnabled() && !$this->readOnly) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -212,7 +212,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function copyTo($file, $target)
|
public function copyTo(string $file, string $target)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -256,7 +256,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function remove($file)
|
public function remove(string $file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -287,7 +287,7 @@ class Cache
|
||||||
* @return int|false
|
* @return int|false
|
||||||
* @phpstan-return int<0, max>|false
|
* @phpstan-return int<0, max>|false
|
||||||
*/
|
*/
|
||||||
public function getAge($file)
|
public function getAge(string $file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -305,7 +305,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function gc($ttl, $maxSize)
|
public function gc(int $ttl, int $maxSize)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$expire = new \DateTime();
|
$expire = new \DateTime();
|
||||||
|
@ -340,7 +340,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function sha1($file)
|
public function sha1(string $file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
@ -357,7 +357,7 @@ class Cache
|
||||||
*
|
*
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function sha256($file)
|
public function sha256(string $file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Composer\Plugin\CommandEvent;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
use Composer\Util\Loop;
|
use Composer\Util\Loop;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -136,7 +137,7 @@ EOT
|
||||||
$io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
|
$io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
|
||||||
$packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
|
$packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
|
||||||
$fs = new Filesystem;
|
$fs = new Filesystem;
|
||||||
$shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
|
$shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
|
||||||
|
|
||||||
$io->writeError('Created: ', false);
|
$io->writeError('Created: ', false);
|
||||||
$io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
|
$io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
|
||||||
|
@ -150,7 +151,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return (BasePackage&CompletePackageInterface)|false
|
* @return (BasePackage&CompletePackageInterface)|false
|
||||||
*/
|
*/
|
||||||
protected function selectPackage(IOInterface $io, $packageName, $version = null)
|
protected function selectPackage(IOInterface $io, string $packageName, ?string $version = null)
|
||||||
{
|
{
|
||||||
$io->writeError('<info>Searching for the specified package.</info>');
|
$io->writeError('<info>Searching for the specified package.</info>');
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ abstract class BaseCommand extends Command
|
||||||
* @return Composer|null
|
* @return Composer|null
|
||||||
* @deprecated since Composer 2.3.0 use requireComposer or tryComposer depending on whether you have $required set to true or false
|
* @deprecated since Composer 2.3.0 use requireComposer or tryComposer depending on whether you have $required set to true or false
|
||||||
*/
|
*/
|
||||||
public function getComposer($required = true, $disablePlugins = null, $disableScripts = null)
|
public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
|
||||||
{
|
{
|
||||||
if ($required) {
|
if ($required) {
|
||||||
return $this->requireComposer($disablePlugins, $disableScripts);
|
return $this->requireComposer($disablePlugins, $disableScripts);
|
||||||
|
@ -226,7 +226,7 @@ abstract class BaseCommand extends Command
|
||||||
*
|
*
|
||||||
* @return bool[] An array composed of the preferSource and preferDist values
|
* @return bool[] An array composed of the preferSource and preferDist values
|
||||||
*/
|
*/
|
||||||
protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
|
protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
|
||||||
{
|
{
|
||||||
$preferSource = false;
|
$preferSource = false;
|
||||||
$preferDist = false;
|
$preferDist = false;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
* @param bool $inverted Whether to invert matching process (why-not vs why behaviour)
|
* @param bool $inverted Whether to invert matching process (why-not vs why behaviour)
|
||||||
* @return int Exit code of the operation.
|
* @return int Exit code of the operation.
|
||||||
*/
|
*/
|
||||||
protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false): int
|
protected function doExecute(InputInterface $input, OutputInterface $output, bool $inverted = false): int
|
||||||
{
|
{
|
||||||
// Emit command event on startup
|
// Emit command event on startup
|
||||||
$composer = $this->requireComposer();
|
$composer = $this->requireComposer();
|
||||||
|
@ -197,7 +197,7 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printTree($results, $prefix = '', $level = 1): void
|
protected function printTree(array $results, string $prefix = '', int $level = 1): void
|
||||||
{
|
{
|
||||||
$count = count($results);
|
$count = count($results);
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
|
@ -223,7 +223,7 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function writeTreeLine($line): void
|
private function writeTreeLine(string $line): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
if (!$io->isDecorated()) {
|
if (!$io->isDecorated()) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printTable(OutputInterface $output, $results): void
|
protected function printTable(OutputInterface $output, array $results): void
|
||||||
{
|
{
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
|
|
|
@ -175,7 +175,7 @@ EOT
|
||||||
if (
|
if (
|
||||||
($configFile === 'composer.json' || $configFile === './composer.json')
|
($configFile === 'composer.json' || $configFile === './composer.json')
|
||||||
&& !file_exists($configFile)
|
&& !file_exists($configFile)
|
||||||
&& realpath(getcwd()) === realpath($this->config->get('home'))
|
&& realpath(Platform::getCwd()) === realpath($this->config->get('home'))
|
||||||
) {
|
) {
|
||||||
file_put_contents($configFile, "{\n}\n");
|
file_put_contents($configFile, "{\n}\n");
|
||||||
}
|
}
|
||||||
|
@ -810,7 +810,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function handleSingleValue($key, array $callbacks, array $values, $method): void
|
protected function handleSingleValue(string $key, array $callbacks, array $values, string $method): void
|
||||||
{
|
{
|
||||||
list($validator, $normalizer) = $callbacks;
|
list($validator, $normalizer) = $callbacks;
|
||||||
if (1 !== count($values)) {
|
if (1 !== count($values)) {
|
||||||
|
@ -845,7 +845,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function handleMultiValue($key, array $callbacks, array $values, $method): void
|
protected function handleMultiValue(string $key, array $callbacks, array $values, string $method): void
|
||||||
{
|
{
|
||||||
list($validator, $normalizer) = $callbacks;
|
list($validator, $normalizer) = $callbacks;
|
||||||
if (true !== $validation = $validator($values)) {
|
if (true !== $validation = $validator($values)) {
|
||||||
|
@ -868,7 +868,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null, $showSource = false): void
|
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, ?string $k = null, bool $showSource = false): void
|
||||||
{
|
{
|
||||||
$origK = $k;
|
$origK = $k;
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
|
@ -187,9 +187,9 @@ EOT
|
||||||
* @return int
|
* @return int
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName = null, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositories = null, $disablePlugins = false, $disableScripts = false, $noProgress = false, $noInstall = false, PlatformRequirementFilterInterface $platformRequirementFilter = null, $secureHttp = true, $addRepository = false): int
|
public function installProject(IOInterface $io, Config $config, InputInterface $input, ?string $packageName = null, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $noInstall = false, PlatformRequirementFilterInterface $platformRequirementFilter = null, bool $secureHttp = true, bool $addRepository = false): int
|
||||||
{
|
{
|
||||||
$oldCwd = getcwd();
|
$oldCwd = Platform::getCwd();
|
||||||
|
|
||||||
if ($repositories !== null && !is_array($repositories)) {
|
if ($repositories !== null && !is_array($repositories)) {
|
||||||
$repositories = (array) $repositories;
|
$repositories = (array) $repositories;
|
||||||
|
@ -284,7 +284,7 @@ EOT
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$finder = new Finder();
|
$finder = new Finder();
|
||||||
$finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
|
$finder->depth(0)->directories()->in(Platform::getCwd())->ignoreVCS(false)->ignoreDotFiles(false);
|
||||||
foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
|
foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
|
||||||
$finder->name($vcsName);
|
$finder->name($vcsName);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ EOT
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function installRootPackage(IOInterface $io, Config $config, $packageName, PlatformRequirementFilterInterface $platformRequirementFilter, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, array $repositories = null, $disablePlugins = false, $disableScripts = false, $noProgress = false, $secureHttp = true): bool
|
protected function installRootPackage(IOInterface $io, Config $config, string $packageName, PlatformRequirementFilterInterface $platformRequirementFilter, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, array $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $secureHttp = true): bool
|
||||||
{
|
{
|
||||||
if (!$secureHttp) {
|
if (!$secureHttp) {
|
||||||
$config->merge(array('config' => array('secure-http' => false)), Config::SOURCE_COMMAND);
|
$config->merge(array('config' => array('secure-http' => false)), Config::SOURCE_COMMAND);
|
||||||
|
@ -366,16 +366,16 @@ EOT
|
||||||
// if no directory was specified, use the 2nd part of the package name
|
// if no directory was specified, use the 2nd part of the package name
|
||||||
if (null === $directory) {
|
if (null === $directory) {
|
||||||
$parts = explode("/", $name, 2);
|
$parts = explode("/", $name, 2);
|
||||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
$directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new ProcessExecutor($io);
|
$process = new ProcessExecutor($io);
|
||||||
$fs = new Filesystem($process);
|
$fs = new Filesystem($process);
|
||||||
if (!$fs->isAbsolutePath($directory)) {
|
if (!$fs->isAbsolutePath($directory)) {
|
||||||
$directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
|
$directory = Platform::getCwd() . DIRECTORY_SEPARATOR . $directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(getcwd(), $directory, true) . '"</info>');
|
$io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(Platform::getCwd(), $directory, true) . '"</info>');
|
||||||
|
|
||||||
if (file_exists($directory)) {
|
if (file_exists($directory)) {
|
||||||
if (!is_dir($directory)) {
|
if (!is_dir($directory)) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ class DiagnoseCommand extends BaseCommand
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('diagnose')
|
->setName('diagnose')
|
||||||
|
@ -245,7 +245,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return string|string[]|true
|
* @return string|string[]|true
|
||||||
*/
|
*/
|
||||||
private function checkHttp($proto, Config $config)
|
private function checkHttp(string $proto, Config $config)
|
||||||
{
|
{
|
||||||
$result = $this->checkConnectivity();
|
$result = $this->checkConnectivity();
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
|
@ -315,7 +315,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return string|true|\Exception
|
* @return string|true|\Exception
|
||||||
*/
|
*/
|
||||||
private function checkGithubOauth($domain, $token)
|
private function checkGithubOauth(string $domain, string $token)
|
||||||
{
|
{
|
||||||
$result = $this->checkConnectivity();
|
$result = $this->checkConnectivity();
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
|
@ -346,7 +346,7 @@ EOT
|
||||||
* @throws TransportException
|
* @throws TransportException
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
private function getGithubRateLimit($domain, $token = null)
|
private function getGithubRateLimit(string $domain, string $token = null)
|
||||||
{
|
{
|
||||||
$result = $this->checkConnectivity();
|
$result = $this->checkConnectivity();
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ EOT
|
||||||
// If the CWD was modified, we restore it to what it was initially, as it was
|
// If the CWD was modified, we restore it to what it was initially, as it was
|
||||||
// most likely modified by the global command, and we want exec to run in the local working directory
|
// most likely modified by the global command, and we want exec to run in the local working directory
|
||||||
// not the global one
|
// not the global one
|
||||||
if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
|
if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
|
||||||
try {
|
try {
|
||||||
chdir($this->getApplication()->getInitialWorkingDirectory());
|
chdir($this->getApplication()->getInitialWorkingDirectory());
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ EOT
|
||||||
* @param bool $showOnly
|
* @param bool $showOnly
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly): bool
|
private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
|
||||||
{
|
{
|
||||||
$support = $package->getSupport();
|
$support = $package->getSupport();
|
||||||
$url = $support['source'] ?? $package->getSourceUrl();
|
$url = $support['source'] ?? $package->getSourceUrl();
|
||||||
|
@ -128,7 +128,7 @@ EOT
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function openBrowser($url): void
|
private function openBrowser(string $url): void
|
||||||
{
|
{
|
||||||
$url = ProcessExecutor::escape($url);
|
$url = ProcessExecutor::escape($url);
|
||||||
|
|
||||||
|
|
|
@ -456,11 +456,10 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
|
||||||
* @param string $author
|
* @param string $author
|
||||||
* @return array{name: string, email: string|null}
|
* @return array{name: string, email: string|null}
|
||||||
*/
|
*/
|
||||||
public function parseAuthorString($author)
|
private function parseAuthorString(string $author): array
|
||||||
{
|
{
|
||||||
if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
|
if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
|
||||||
$hasEmail = isset($match['email']) && '' !== $match['email'];
|
$hasEmail = isset($match['email']) && '' !== $match['email'];
|
||||||
|
@ -485,7 +484,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return array<int, array{name: string, email?: string}>
|
* @return array<int, array{name: string, email?: string}>
|
||||||
*/
|
*/
|
||||||
protected function formatAuthors($author)
|
protected function formatAuthors(string $author): array
|
||||||
{
|
{
|
||||||
$author = $this->parseAuthorString($author);
|
$author = $this->parseAuthorString($author);
|
||||||
if (null === $author['email']) {
|
if (null === $author['email']) {
|
||||||
|
@ -504,7 +503,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function namespaceFromPackageName($packageName)
|
public function namespaceFromPackageName(string $packageName): ?string
|
||||||
{
|
{
|
||||||
if (!$packageName || strpos($packageName, '/') === false) {
|
if (!$packageName || strpos($packageName, '/') === false) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -526,7 +525,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
protected function getGitConfig()
|
protected function getGitConfig(): array
|
||||||
{
|
{
|
||||||
if (null !== $this->gitConfig) {
|
if (null !== $this->gitConfig) {
|
||||||
return $this->gitConfig;
|
return $this->gitConfig;
|
||||||
|
@ -567,7 +566,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
|
protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
|
||||||
{
|
{
|
||||||
if (!file_exists($ignoreFile)) {
|
if (!file_exists($ignoreFile)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -591,7 +590,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
|
protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
|
||||||
{
|
{
|
||||||
$contents = "";
|
$contents = "";
|
||||||
if (file_exists($ignoreFile)) {
|
if (file_exists($ignoreFile)) {
|
||||||
|
@ -610,7 +609,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isValidEmail($email)
|
protected function isValidEmail(string $email): bool
|
||||||
{
|
{
|
||||||
// assume it's valid if we can't validate it
|
// assume it's valid if we can't validate it
|
||||||
if (!function_exists('filter_var')) {
|
if (!function_exists('filter_var')) {
|
||||||
|
@ -652,7 +651,7 @@ EOT
|
||||||
* @param array<string, string|array<string>> $options
|
* @param array<string, string|array<string>> $options
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function hasDependencies($options): bool
|
private function hasDependencies(array $options): bool
|
||||||
{
|
{
|
||||||
$requires = (array) $options['require'];
|
$requires = (array) $options['require'];
|
||||||
$devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
|
$devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
|
||||||
|
|
|
@ -163,7 +163,7 @@ EOT
|
||||||
* @param array<string, PackageInterface> $bucket
|
* @param array<string, PackageInterface> $bucket
|
||||||
* @return array<string, PackageInterface>
|
* @return array<string, PackageInterface>
|
||||||
*/
|
*/
|
||||||
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()): array
|
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, array $bucket = array()): array
|
||||||
{
|
{
|
||||||
$requires = array_keys($package->getRequires());
|
$requires = array_keys($package->getRequires());
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ EOT
|
||||||
* @param string $requireKey
|
* @param string $requireKey
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function getInconsistentRequireKeys(array $newRequirements, $requireKey): array
|
private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
|
||||||
{
|
{
|
||||||
$requireKeys = $this->getPackagesByRequireKey();
|
$requireKeys = $this->getPackagesByRequireKey();
|
||||||
$inconsistentRequirements = array();
|
$inconsistentRequirements = array();
|
||||||
|
@ -335,15 +335,6 @@ EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function markSolverComplete()
|
|
||||||
{
|
|
||||||
$this->dependencyResolutionCompleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string> $requirements
|
* @param array<string, string> $requirements
|
||||||
* @param string $requireKey
|
* @param string $requireKey
|
||||||
|
@ -351,14 +342,16 @@ EOT
|
||||||
* @return int
|
* @return int
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, $requireKey, $removeKey): int
|
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, string $requireKey, string $removeKey): int
|
||||||
{
|
{
|
||||||
// Update packages
|
// Update packages
|
||||||
$this->resetComposer();
|
$this->resetComposer();
|
||||||
$composer = $this->requireComposer();
|
$composer = $this->requireComposer();
|
||||||
|
|
||||||
$this->dependencyResolutionCompleted = false;
|
$this->dependencyResolutionCompleted = false;
|
||||||
$composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, array($this, 'markSolverComplete'), 10000);
|
$composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, function (): void {
|
||||||
|
$this->dependencyResolutionCompleted = true;
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
if ($input->getOption('dry-run')) {
|
if ($input->getOption('dry-run')) {
|
||||||
$rootPackage = $composer->getPackage();
|
$rootPackage = $composer->getPackage();
|
||||||
|
@ -449,7 +442,7 @@ EOT
|
||||||
* @param bool $sortPackages
|
* @param bool $sortPackages
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function updateFileCleanly(JsonFile $json, array $new, $requireKey, $removeKey, $sortPackages): bool
|
private function updateFileCleanly(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): bool
|
||||||
{
|
{
|
||||||
$contents = file_get_contents($json->getPath());
|
$contents = file_get_contents($json->getPath());
|
||||||
|
|
||||||
|
@ -480,7 +473,7 @@ EOT
|
||||||
* @param bool $hardExit
|
* @param bool $hardExit
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function revertComposerFile($hardExit = true)
|
public function revertComposerFile(bool $hardExit = true): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,10 @@ class ScriptAliasCommand extends BaseCommand
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
/**
|
public function __construct(string $script, ?string $description)
|
||||||
* @param string $script
|
|
||||||
* @param string $description
|
|
||||||
*/
|
|
||||||
public function __construct($script, $description)
|
|
||||||
{
|
{
|
||||||
$this->script = $script;
|
$this->script = $script;
|
||||||
$this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
|
$this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json.';
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,7 @@ TAGSPUBKEY
|
||||||
* @return int
|
* @return int
|
||||||
* @throws FilesystemException
|
* @throws FilesystemException
|
||||||
*/
|
*/
|
||||||
protected function rollback(OutputInterface $output, $rollbackDir, $localFilename): int
|
protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
|
||||||
{
|
{
|
||||||
$rollbackVersion = $this->getLastBackupVersion($rollbackDir);
|
$rollbackVersion = $this->getLastBackupVersion($rollbackDir);
|
||||||
if (!$rollbackVersion) {
|
if (!$rollbackVersion) {
|
||||||
|
@ -431,7 +431,7 @@ TAGSPUBKEY
|
||||||
* @throws FilesystemException If the file cannot be moved
|
* @throws FilesystemException If the file cannot be moved
|
||||||
* @return bool Whether the phar is valid and has been moved
|
* @return bool Whether the phar is valid and has been moved
|
||||||
*/
|
*/
|
||||||
protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null): bool
|
protected function setLocalPhar(string $localFilename, string $newFilename, string $backupTarget = null): bool
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
@chmod($newFilename, fileperms($localFilename));
|
@chmod($newFilename, fileperms($localFilename));
|
||||||
|
@ -483,7 +483,7 @@ TAGSPUBKEY
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function cleanBackups($rollbackDir, $except = null): void
|
protected function cleanBackups(string $rollbackDir, ?string $except = null): void
|
||||||
{
|
{
|
||||||
$finder = $this->getOldInstallationFinder($rollbackDir);
|
$finder = $this->getOldInstallationFinder($rollbackDir);
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
@ -503,7 +503,7 @@ TAGSPUBKEY
|
||||||
* @param string $rollbackDir
|
* @param string $rollbackDir
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
protected function getLastBackupVersion($rollbackDir)
|
protected function getLastBackupVersion(string $rollbackDir)
|
||||||
{
|
{
|
||||||
$finder = $this->getOldInstallationFinder($rollbackDir);
|
$finder = $this->getOldInstallationFinder($rollbackDir);
|
||||||
$finder->sortByName();
|
$finder->sortByName();
|
||||||
|
@ -520,7 +520,7 @@ TAGSPUBKEY
|
||||||
* @param string $rollbackDir
|
* @param string $rollbackDir
|
||||||
* @return Finder
|
* @return Finder
|
||||||
*/
|
*/
|
||||||
protected function getOldInstallationFinder($rollbackDir): Finder
|
protected function getOldInstallationFinder(string $rollbackDir): Finder
|
||||||
{
|
{
|
||||||
return Finder::create()
|
return Finder::create()
|
||||||
->depth(0)
|
->depth(0)
|
||||||
|
@ -541,7 +541,7 @@ TAGSPUBKEY
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @return bool If the operation succeeded
|
* @return bool If the operation succeeded
|
||||||
*/
|
*/
|
||||||
protected function validatePhar($pharFile, &$error): bool
|
protected function validatePhar(string $pharFile, ?string &$error): bool
|
||||||
{
|
{
|
||||||
if (ini_get('phar.readonly')) {
|
if (ini_get('phar.readonly')) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -590,7 +590,7 @@ TAGSPUBKEY
|
||||||
* @param string $newFilename The downloaded or backup phar
|
* @param string $newFilename The downloaded or backup phar
|
||||||
* @return bool Whether composer.phar has been updated
|
* @return bool Whether composer.phar has been updated
|
||||||
*/
|
*/
|
||||||
protected function tryAsWindowsAdmin($localFilename, $newFilename): bool
|
protected function tryAsWindowsAdmin(string $localFilename, string $newFilename): bool
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ EOT
|
||||||
|
|
||||||
if ($input->getOption('no-dev')) {
|
if ($input->getOption('no-dev')) {
|
||||||
$packages = $this->filterRequiredPackages($installedRepo, $rootPkg);
|
$packages = $this->filterRequiredPackages($installedRepo, $rootPkg);
|
||||||
$repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg): \Composer\Package\PackageInterface {
|
$repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg): PackageInterface {
|
||||||
return clone $pkg;
|
return clone $pkg;
|
||||||
}, $packages))));
|
}, $packages))));
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ EOT
|
||||||
if (
|
if (
|
||||||
$input->getOption('outdated')
|
$input->getOption('outdated')
|
||||||
&& $input->getOption('strict')
|
&& $input->getOption('strict')
|
||||||
&& $latestPackage
|
&& null !== $latestPackage
|
||||||
&& $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
|
&& $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
|
||||||
&& (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
|
&& (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
|
||||||
) {
|
) {
|
||||||
|
@ -415,7 +415,7 @@ EOT
|
||||||
foreach ($packages[$type] as $package) {
|
foreach ($packages[$type] as $package) {
|
||||||
if (is_object($package)) {
|
if (is_object($package)) {
|
||||||
$latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMinorOnly, $platformReqFilter);
|
$latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMinorOnly, $platformReqFilter);
|
||||||
if ($latestPackage === false) {
|
if ($latestPackage === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
protected function getRootRequires()
|
protected function getRootRequires(): array
|
||||||
{
|
{
|
||||||
$rootPackage = $this->requireComposer()->getPackage();
|
$rootPackage = $this->requireComposer()->getPackage();
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ EOT
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array{CompletePackageInterface|null, array<string, string>}
|
* @return array{CompletePackageInterface|null, array<string, string>}
|
||||||
*/
|
*/
|
||||||
protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, $name, $version = null)
|
protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, string $name, $version = null): array
|
||||||
{
|
{
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
$constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
|
$constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
|
||||||
|
@ -677,7 +677,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$io->write('<info>name</info> : ' . $package->getPrettyName());
|
$io->write('<info>name</info> : ' . $package->getPrettyName());
|
||||||
|
@ -773,7 +773,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo)
|
protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo): void
|
||||||
{
|
{
|
||||||
$versions = array_keys($versions);
|
$versions = array_keys($versions);
|
||||||
$versions = Semver::rsort($versions);
|
$versions = Semver::rsort($versions);
|
||||||
|
@ -802,7 +802,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
|
protected function printLinks(CompletePackageInterface $package, string $linkType, string $title = null): void
|
||||||
{
|
{
|
||||||
$title = $title ?: $linkType;
|
$title = $title ?: $linkType;
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
@ -820,7 +820,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printLicenses(CompletePackageInterface $package)
|
protected function printLicenses(CompletePackageInterface $package): void
|
||||||
{
|
{
|
||||||
$spdxLicenses = new SpdxLicenses();
|
$spdxLicenses = new SpdxLicenses();
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
|
||||||
{
|
{
|
||||||
$json = array(
|
$json = array(
|
||||||
'name' => $package->getPrettyName(),
|
'name' => $package->getPrettyName(),
|
||||||
|
@ -923,7 +923,7 @@ EOT
|
||||||
* @param array<string, string> $versions
|
* @param array<string, string> $versions
|
||||||
* @return array<string, string|string[]|null>
|
* @return array<string, string|string[]|null>
|
||||||
*/
|
*/
|
||||||
private function appendVersions($json, array $versions): array
|
private function appendVersions(array $json, array $versions): array
|
||||||
{
|
{
|
||||||
uasort($versions, 'version_compare');
|
uasort($versions, 'version_compare');
|
||||||
$versions = array_keys(array_reverse($versions));
|
$versions = array_keys(array_reverse($versions));
|
||||||
|
@ -936,7 +936,7 @@ EOT
|
||||||
* @param array<string, string|string[]|null> $json
|
* @param array<string, string|string[]|null> $json
|
||||||
* @return array<string, string|string[]|null>
|
* @return array<string, string|string[]|null>
|
||||||
*/
|
*/
|
||||||
private function appendLicenses($json, CompletePackageInterface $package): array
|
private function appendLicenses(array $json, CompletePackageInterface $package): array
|
||||||
{
|
{
|
||||||
if ($licenses = $package->getLicense()) {
|
if ($licenses = $package->getLicense()) {
|
||||||
$spdxLicenses = new SpdxLicenses();
|
$spdxLicenses = new SpdxLicenses();
|
||||||
|
@ -963,7 +963,7 @@ EOT
|
||||||
* @param array<string, string|string[]|null> $json
|
* @param array<string, string|string[]|null> $json
|
||||||
* @return array<string, string|string[]|null>
|
* @return array<string, string|string[]|null>
|
||||||
*/
|
*/
|
||||||
private function appendAutoload($json, CompletePackageInterface $package): array
|
private function appendAutoload(array $json, CompletePackageInterface $package): array
|
||||||
{
|
{
|
||||||
if ($package->getAutoload()) {
|
if ($package->getAutoload()) {
|
||||||
$autoload = array();
|
$autoload = array();
|
||||||
|
@ -996,7 +996,7 @@ EOT
|
||||||
* @param array<string, string|string[]|null> $json
|
* @param array<string, string|string[]|null> $json
|
||||||
* @return array<string, string|string[]|null>
|
* @return array<string, string|string[]|null>
|
||||||
*/
|
*/
|
||||||
private function appendLinks($json, CompletePackageInterface $package): array
|
private function appendLinks(array $json, CompletePackageInterface $package): array
|
||||||
{
|
{
|
||||||
foreach (Link::$TYPES as $linkType) {
|
foreach (Link::$TYPES as $linkType) {
|
||||||
$json = $this->appendLink($json, $package, $linkType);
|
$json = $this->appendLink($json, $package, $linkType);
|
||||||
|
@ -1010,7 +1010,7 @@ EOT
|
||||||
* @param string $linkType
|
* @param string $linkType
|
||||||
* @return array<string, string|string[]|null>
|
* @return array<string, string|string[]|null>
|
||||||
*/
|
*/
|
||||||
private function appendLink($json, CompletePackageInterface $package, $linkType): array
|
private function appendLink(array $json, CompletePackageInterface $package, string $linkType): array
|
||||||
{
|
{
|
||||||
$links = $package->{'get' . ucfirst($linkType)}();
|
$links = $package->{'get' . ucfirst($linkType)}();
|
||||||
|
|
||||||
|
@ -1030,7 +1030,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initStyles(OutputInterface $output)
|
protected function initStyles(OutputInterface $output): void
|
||||||
{
|
{
|
||||||
$this->colors = array(
|
$this->colors = array(
|
||||||
'green',
|
'green',
|
||||||
|
@ -1052,7 +1052,7 @@ EOT
|
||||||
* @param array<int, array<string, string|mixed[]>> $arrayTree
|
* @param array<int, array<string, string|mixed[]>> $arrayTree
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function displayPackageTree(array $arrayTree)
|
protected function displayPackageTree(array $arrayTree): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
foreach ($arrayTree as $package) {
|
foreach ($arrayTree as $package) {
|
||||||
|
@ -1101,7 +1101,7 @@ EOT
|
||||||
PackageInterface $package,
|
PackageInterface $package,
|
||||||
InstalledRepository $installedRepo,
|
InstalledRepository $installedRepo,
|
||||||
RepositoryInterface $remoteRepos
|
RepositoryInterface $remoteRepos
|
||||||
) {
|
): array {
|
||||||
$requires = $package->getRequires();
|
$requires = $package->getRequires();
|
||||||
ksort($requires);
|
ksort($requires);
|
||||||
$children = array();
|
$children = array();
|
||||||
|
@ -1147,9 +1147,9 @@ EOT
|
||||||
protected function displayTree(
|
protected function displayTree(
|
||||||
$package,
|
$package,
|
||||||
array $packagesInTree,
|
array $packagesInTree,
|
||||||
$previousTreeBar = '├',
|
string $previousTreeBar = '├',
|
||||||
$level = 1
|
int $level = 1
|
||||||
) {
|
): void {
|
||||||
$previousTreeBar = str_replace('├', '│', $previousTreeBar);
|
$previousTreeBar = str_replace('├', '│', $previousTreeBar);
|
||||||
if (is_array($package) && isset($package['requires'])) {
|
if (is_array($package) && isset($package['requires'])) {
|
||||||
$requires = $package['requires'];
|
$requires = $package['requires'];
|
||||||
|
@ -1197,12 +1197,12 @@ EOT
|
||||||
* @return array<int, array<string, array<int, array<string, string>>|string>>
|
* @return array<int, array<string, array<int, array<string, string>>|string>>
|
||||||
*/
|
*/
|
||||||
protected function addTree(
|
protected function addTree(
|
||||||
$name,
|
string $name,
|
||||||
Link $link,
|
Link $link,
|
||||||
InstalledRepository $installedRepo,
|
InstalledRepository $installedRepo,
|
||||||
RepositoryInterface $remoteRepos,
|
RepositoryInterface $remoteRepos,
|
||||||
array $packagesInTree
|
array $packagesInTree
|
||||||
) {
|
): array {
|
||||||
$children = array();
|
$children = array();
|
||||||
list($package) = $this->getPackage(
|
list($package) = $this->getPackage(
|
||||||
$installedRepo,
|
$installedRepo,
|
||||||
|
@ -1240,7 +1240,7 @@ EOT
|
||||||
* @param string $updateStatus
|
* @param string $updateStatus
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function updateStatusToVersionStyle($updateStatus): string
|
private function updateStatusToVersionStyle(string $updateStatus): string
|
||||||
{
|
{
|
||||||
// 'up-to-date' is printed green
|
// 'up-to-date' is printed green
|
||||||
// 'semver-safe-update' is printed red
|
// 'semver-safe-update' is printed red
|
||||||
|
@ -1275,7 +1275,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function writeTreeLine($line): void
|
private function writeTreeLine(string $line): void
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
if (!$io->isDecorated()) {
|
if (!$io->isDecorated()) {
|
||||||
|
@ -1287,10 +1287,8 @@ EOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a package, this finds the latest package matching it
|
* Given a package, this finds the latest package matching it
|
||||||
*
|
|
||||||
* @return PackageInterface|false
|
|
||||||
*/
|
*/
|
||||||
private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $minorOnly, PlatformRequirementFilterInterface $platformReqFilter)
|
private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $minorOnly, PlatformRequirementFilterInterface $platformReqFilter): ?PackageInterface
|
||||||
{
|
{
|
||||||
// find the latest version allowed in this repo set
|
// find the latest version allowed in this repo set
|
||||||
$name = $package->getName();
|
$name = $package->getName();
|
||||||
|
@ -1320,7 +1318,7 @@ EOT
|
||||||
$candidate = $candidate->getAliasOf();
|
$candidate = $candidate->getAliasOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $candidate;
|
return $candidate !== false ? $candidate : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1342,7 +1340,7 @@ EOT
|
||||||
* @param array<PackageInterface> $bucket
|
* @param array<PackageInterface> $bucket
|
||||||
* @return array<PackageInterface>
|
* @return array<PackageInterface>
|
||||||
*/
|
*/
|
||||||
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()): array
|
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, array $bucket = array()): array
|
||||||
{
|
{
|
||||||
$requires = $package->getRequires();
|
$requires = $package->getRequires();
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ EOT
|
||||||
* @param string $constraint
|
* @param string $constraint
|
||||||
* @return Link
|
* @return Link
|
||||||
*/
|
*/
|
||||||
private function appendConstraintToLink(Link $link, $constraint): Link
|
private function appendConstraintToLink(Link $link, string $constraint): Link
|
||||||
{
|
{
|
||||||
$parser = new VersionParser;
|
$parser = new VersionParser;
|
||||||
$oldPrettyString = $link->getConstraint()->getPrettyString();
|
$oldPrettyString = $link->getConstraint()->getPrettyString();
|
||||||
|
|
|
@ -169,7 +169,7 @@ EOT
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function outputResult(IOInterface $io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false): void
|
private function outputResult(IOInterface $io, string $name, array &$errors, array &$warnings, bool $checkPublish = false, array $publishErrors = array(), bool $checkLock = false, array $lockErrors = array(), bool $printSchemaUrl = false): void
|
||||||
{
|
{
|
||||||
$doPrintSchemaUrl = false;
|
$doPrintSchemaUrl = false;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Compiler
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
public function compile($pharFile = 'composer.phar'): void
|
public function compile(string $pharFile = 'composer.phar'): void
|
||||||
{
|
{
|
||||||
if (file_exists($pharFile)) {
|
if (file_exists($pharFile)) {
|
||||||
unlink($pharFile);
|
unlink($pharFile);
|
||||||
|
@ -201,7 +201,7 @@ class Compiler
|
||||||
* @param \SplFileInfo $file
|
* @param \SplFileInfo $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getRelativeFilePath($file): string
|
private function getRelativeFilePath(\SplFileInfo $file): string
|
||||||
{
|
{
|
||||||
$realPath = $file->getRealPath();
|
$realPath = $file->getRealPath();
|
||||||
$pathPrefix = dirname(__DIR__, 2).DIRECTORY_SEPARATOR;
|
$pathPrefix = dirname(__DIR__, 2).DIRECTORY_SEPARATOR;
|
||||||
|
@ -217,7 +217,7 @@ class Compiler
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function addFile(\Phar $phar, \SplFileInfo $file, $strip = true): void
|
private function addFile(\Phar $phar, \SplFileInfo $file, bool $strip = true): void
|
||||||
{
|
{
|
||||||
$path = $this->getRelativeFilePath($file);
|
$path = $this->getRelativeFilePath($file);
|
||||||
$content = file_get_contents($file);
|
$content = file_get_contents($file);
|
||||||
|
@ -258,7 +258,7 @@ class Compiler
|
||||||
* @param string $source A PHP string
|
* @param string $source A PHP string
|
||||||
* @return string The PHP string with the whitespace removed
|
* @return string The PHP string with the whitespace removed
|
||||||
*/
|
*/
|
||||||
private function stripWhitespace($source): string
|
private function stripWhitespace(string $source): string
|
||||||
{
|
{
|
||||||
if (!function_exists('token_get_all')) {
|
if (!function_exists('token_get_all')) {
|
||||||
return $source;
|
return $source;
|
||||||
|
|
|
@ -112,9 +112,9 @@ class Config
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
|
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
|
||||||
* @param string $baseDir Optional base directory of the config
|
* @param ?string $baseDir Optional base directory of the config
|
||||||
*/
|
*/
|
||||||
public function __construct($useEnvironment = true, $baseDir = null)
|
public function __construct(bool $useEnvironment = true, ?string $baseDir = null)
|
||||||
{
|
{
|
||||||
// load defaults
|
// load defaults
|
||||||
$this->config = static::$defaultConfig;
|
$this->config = static::$defaultConfig;
|
||||||
|
@ -126,7 +126,7 @@ class Config
|
||||||
|
|
||||||
$this->repositories = static::$defaultRepositories;
|
$this->repositories = static::$defaultRepositories;
|
||||||
$this->useEnvironment = (bool) $useEnvironment;
|
$this->useEnvironment = (bool) $useEnvironment;
|
||||||
$this->baseDir = $baseDir;
|
$this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
|
||||||
|
|
||||||
foreach ($this->config as $configKey => $configValue) {
|
foreach ($this->config as $configKey => $configValue) {
|
||||||
$this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
|
$this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
|
||||||
|
@ -177,7 +177,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function merge($config, $source = self::SOURCE_UNKNOWN): void
|
public function merge(array $config, string $source = self::SOURCE_UNKNOWN): void
|
||||||
{
|
{
|
||||||
// override defaults with given config
|
// override defaults with given config
|
||||||
if (!empty($config['config']) && is_array($config['config'])) {
|
if (!empty($config['config']) && is_array($config['config'])) {
|
||||||
|
@ -277,7 +277,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get($key, $flags = 0)
|
public function get(string $key, int $flags = 0)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
// strings/paths with env var and {$refs} support
|
// strings/paths with env var and {$refs} support
|
||||||
|
@ -441,7 +441,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return array<string, mixed[]>
|
* @return array<string, mixed[]>
|
||||||
*/
|
*/
|
||||||
public function all($flags = 0): array
|
public function all(int $flags = 0): array
|
||||||
{
|
{
|
||||||
$all = array(
|
$all = array(
|
||||||
'repositories' => $this->getRepositories(),
|
'repositories' => $this->getRepositories(),
|
||||||
|
@ -457,7 +457,7 @@ class Config
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSourceOfValue($key): string
|
public function getSourceOfValue(string $key): string
|
||||||
{
|
{
|
||||||
$this->get($key);
|
$this->get($key);
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function setSourceOfConfigValue($configValue, $path, $source): void
|
private function setSourceOfConfigValue($configValue, string $path, string $source): void
|
||||||
{
|
{
|
||||||
$this->sourceOfConfigValue[$path] = $source;
|
$this->sourceOfConfigValue[$path] = $source;
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ class Config
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($key): bool
|
public function has(string $key): bool
|
||||||
{
|
{
|
||||||
return array_key_exists($key, $this->config);
|
return array_key_exists($key, $this->config);
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return string|int|null
|
* @return string|int|null
|
||||||
*/
|
*/
|
||||||
private function process($value, $flags)
|
private function process($value, int $flags)
|
||||||
{
|
{
|
||||||
if (!is_string($value)) {
|
if (!is_string($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -531,9 +531,9 @@ class Config
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function realpath($path): string
|
private function realpath(string $path): string
|
||||||
{
|
{
|
||||||
if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
|
if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://|\\\\\\\\)}i', $path)) {
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ class Config
|
||||||
* @param string $var
|
* @param string $var
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
*/
|
*/
|
||||||
private function getComposerEnv($var)
|
private function getComposerEnv(string $var)
|
||||||
{
|
{
|
||||||
if ($this->useEnvironment) {
|
if ($this->useEnvironment) {
|
||||||
return Platform::getEnv($var);
|
return Platform::getEnv($var);
|
||||||
|
@ -563,7 +563,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function disableRepoByName($name): void
|
private function disableRepoByName(string $name): void
|
||||||
{
|
{
|
||||||
if (isset($this->repositories[$name])) {
|
if (isset($this->repositories[$name])) {
|
||||||
unset($this->repositories[$name]);
|
unset($this->repositories[$name]);
|
||||||
|
@ -580,7 +580,7 @@ class Config
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function prohibitUrlByConfig($url, IOInterface $io = null): void
|
public function prohibitUrlByConfig(string $url, IOInterface $io = null): void
|
||||||
{
|
{
|
||||||
// Return right away if the URL is malformed or custom (see issue #5173)
|
// Return right away if the URL is malformed or custom (see issue #5173)
|
||||||
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
|
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addRepository($name, $config, $append = true);
|
public function addRepository(string $name, $config, bool $append = true): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a repository
|
* Remove a repository
|
||||||
|
@ -38,7 +38,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeRepository($name);
|
public function removeRepository(string $name): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a config setting
|
* Add a config setting
|
||||||
|
@ -48,7 +48,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addConfigSetting($name, $value);
|
public function addConfigSetting(string $name, $value): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a config setting
|
* Remove a config setting
|
||||||
|
@ -57,7 +57,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeConfigSetting($name);
|
public function removeConfigSetting(string $name): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a property
|
* Add a property
|
||||||
|
@ -67,7 +67,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addProperty($name, $value);
|
public function addProperty(string $name, $value): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a property
|
* Remove a property
|
||||||
|
@ -76,7 +76,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeProperty($name);
|
public function removeProperty(string $name): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a package link
|
* Add a package link
|
||||||
|
@ -87,7 +87,7 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addLink($type, $name, $value);
|
public function addLink(string $type, string $name, string $value): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a package link
|
* Remove a package link
|
||||||
|
@ -97,12 +97,12 @@ interface ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeLink($type, $name);
|
public function removeLink(string $type, string $name): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives a user-friendly name to this source (file path or so)
|
* Gives a user-friendly name to this source (file path or so)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName();
|
public function getName(): string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
* @param JsonFile $file
|
* @param JsonFile $file
|
||||||
* @param bool $authConfig
|
* @param bool $authConfig
|
||||||
*/
|
*/
|
||||||
public function __construct(JsonFile $file, $authConfig = false)
|
public function __construct(JsonFile $file, bool $authConfig = false)
|
||||||
{
|
{
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
$this->authConfig = $authConfig;
|
$this->authConfig = $authConfig;
|
||||||
|
@ -52,7 +52,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return $this->file->getPath();
|
return $this->file->getPath();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function addRepository($name, $config, $append = true)
|
public function addRepository(string $name, $config, bool $append = true): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('addRepository', function (&$config, $repo, $repoConfig) use ($append): void {
|
$this->manipulateJson('addRepository', function (&$config, $repo, $repoConfig) use ($append): void {
|
||||||
// if converting from an array format to hashmap format, and there is a {"packagist.org":false} repo, we have
|
// if converting from an array format to hashmap format, and there is a {"packagist.org":false} repo, we have
|
||||||
|
@ -89,7 +89,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function removeRepository($name)
|
public function removeRepository(string $name): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('removeRepository', function (&$config, $repo): void {
|
$this->manipulateJson('removeRepository', function (&$config, $repo): void {
|
||||||
unset($config['repositories'][$repo]);
|
unset($config['repositories'][$repo]);
|
||||||
|
@ -99,7 +99,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function addConfigSetting($name, $value)
|
public function addConfigSetting(string $name, $value): void
|
||||||
{
|
{
|
||||||
$authConfig = $this->authConfig;
|
$authConfig = $this->authConfig;
|
||||||
$this->manipulateJson('addConfigSetting', function (&$config, $key, $val) use ($authConfig): void {
|
$this->manipulateJson('addConfigSetting', function (&$config, $key, $val) use ($authConfig): void {
|
||||||
|
@ -119,7 +119,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function removeConfigSetting($name)
|
public function removeConfigSetting(string $name): void
|
||||||
{
|
{
|
||||||
$authConfig = $this->authConfig;
|
$authConfig = $this->authConfig;
|
||||||
$this->manipulateJson('removeConfigSetting', function (&$config, $key) use ($authConfig): void {
|
$this->manipulateJson('removeConfigSetting', function (&$config, $key) use ($authConfig): void {
|
||||||
|
@ -139,7 +139,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function addProperty($name, $value)
|
public function addProperty(string $name, $value): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('addProperty', function (&$config, $key, $val): void {
|
$this->manipulateJson('addProperty', function (&$config, $key, $val): void {
|
||||||
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
||||||
|
@ -162,7 +162,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function removeProperty($name)
|
public function removeProperty(string $name): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('removeProperty', function (&$config, $key): void {
|
$this->manipulateJson('removeProperty', function (&$config, $key): void {
|
||||||
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
||||||
|
@ -185,7 +185,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function addLink($type, $name, $value)
|
public function addLink(string $type, string $name, string $value): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('addLink', function (&$config, $type, $name, $value): void {
|
$this->manipulateJson('addLink', function (&$config, $type, $name, $value): void {
|
||||||
$config[$type][$name] = $value;
|
$config[$type][$name] = $value;
|
||||||
|
@ -195,7 +195,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function removeLink($type, $name)
|
public function removeLink(string $type, string $name): void
|
||||||
{
|
{
|
||||||
$this->manipulateJson('removeSubNode', function (&$config, $type, $name): void {
|
$this->manipulateJson('removeSubNode', function (&$config, $type, $name): void {
|
||||||
unset($config[$type][$name]);
|
unset($config[$type][$name]);
|
||||||
|
@ -214,7 +214,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function manipulateJson($method, $fallback, ...$args): void
|
private function manipulateJson(string $method, callable $fallback, ...$args): void
|
||||||
{
|
{
|
||||||
if ($this->file->exists()) {
|
if ($this->file->exists()) {
|
||||||
if (!is_writable($this->file->getPath())) {
|
if (!is_writable($this->file->getPath())) {
|
||||||
|
@ -297,7 +297,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function arrayUnshiftRef(&$array, &$value): int
|
private function arrayUnshiftRef(array &$array, &$value): int
|
||||||
{
|
{
|
||||||
$return = array_unshift($array, '');
|
$return = array_unshift($array, '');
|
||||||
$array[0] = &$value;
|
$array[0] = &$value;
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Application extends BaseApplication
|
||||||
private $disableScriptsByDefault = false;
|
private $disableScriptsByDefault = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Store the initial working directory at startup time
|
* @var string|false Store the initial working directory at startup time
|
||||||
*/
|
*/
|
||||||
private $initialWorkingDirectory;
|
private $initialWorkingDirectory;
|
||||||
|
|
||||||
|
@ -151,10 +151,11 @@ class Application extends BaseApplication
|
||||||
|
|
||||||
// switch working dir
|
// switch working dir
|
||||||
if ($newWorkDir = $this->getNewWorkingDir($input)) {
|
if ($newWorkDir = $this->getNewWorkingDir($input)) {
|
||||||
$oldWorkingDir = getcwd();
|
$oldWorkingDir = Platform::getCwd(true);
|
||||||
chdir($newWorkDir);
|
chdir($newWorkDir);
|
||||||
$this->initialWorkingDirectory = $newWorkDir;
|
$this->initialWorkingDirectory = $newWorkDir;
|
||||||
$io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
|
$cwd = Platform::getCwd(true);
|
||||||
|
$io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine command name to be executed without including plugin commands
|
// determine command name to be executed without including plugin commands
|
||||||
|
@ -171,7 +172,7 @@ class Application extends BaseApplication
|
||||||
|
|
||||||
// prompt user for dir change if no composer.json is present in current dir
|
// prompt user for dir change if no composer.json is present in current dir
|
||||||
if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
|
if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
|
||||||
$dir = dirname(getcwd());
|
$dir = dirname(Platform::getCwd(true));
|
||||||
$home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
|
$home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
|
||||||
|
|
||||||
// abort when we reach the home dir or top of the filesystem
|
// abort when we reach the home dir or top of the filesystem
|
||||||
|
@ -183,7 +184,7 @@ class Application extends BaseApplication
|
||||||
} else {
|
} else {
|
||||||
$io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
|
$io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
|
||||||
}
|
}
|
||||||
$oldWorkingDir = getcwd();
|
$oldWorkingDir = Platform::getCwd(true);
|
||||||
chdir($dir);
|
chdir($dir);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -330,7 +331,7 @@ class Application extends BaseApplication
|
||||||
$result = parent::doRun($input, $output);
|
$result = parent::doRun($input, $output);
|
||||||
|
|
||||||
// chdir back to $oldWorkingDir if set
|
// chdir back to $oldWorkingDir if set
|
||||||
if (isset($oldWorkingDir)) {
|
if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
|
||||||
Silencer::call('chdir', $oldWorkingDir);
|
Silencer::call('chdir', $oldWorkingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,9 +423,9 @@ class Application extends BaseApplication
|
||||||
* @param bool|null $disableScripts
|
* @param bool|null $disableScripts
|
||||||
* @throws JsonValidationException
|
* @throws JsonValidationException
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return ?\Composer\Composer If $required is true then the return value is guaranteed
|
* @return ?Composer If $required is true then the return value is guaranteed
|
||||||
*/
|
*/
|
||||||
public function getComposer($required = true, $disablePlugins = null, $disableScripts = null)
|
public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
|
||||||
{
|
{
|
||||||
if (null === $disablePlugins) {
|
if (null === $disablePlugins) {
|
||||||
$disablePlugins = $this->disablePluginsByDefault;
|
$disablePlugins = $this->disablePluginsByDefault;
|
||||||
|
@ -459,7 +460,7 @@ class Application extends BaseApplication
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function resetComposer()
|
public function resetComposer(): void
|
||||||
{
|
{
|
||||||
$this->composer = null;
|
$this->composer = null;
|
||||||
if (method_exists($this->getIO(), 'resetAuthentications')) {
|
if (method_exists($this->getIO(), 'resetAuthentications')) {
|
||||||
|
@ -470,7 +471,7 @@ class Application extends BaseApplication
|
||||||
/**
|
/**
|
||||||
* @return IOInterface
|
* @return IOInterface
|
||||||
*/
|
*/
|
||||||
public function getIO()
|
public function getIO(): IOInterface
|
||||||
{
|
{
|
||||||
return $this->io;
|
return $this->io;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +586,7 @@ class Application extends BaseApplication
|
||||||
/**
|
/**
|
||||||
* Get the working directory at startup time
|
* Get the working directory at startup time
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function getInitialWorkingDirectory()
|
public function getInitialWorkingDirectory()
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ final class GithubActionError
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function emit($message, $file = null, $line = null): void
|
public function emit(string $message, ?string $file = null, ?int $line = null): void
|
||||||
{
|
{
|
||||||
if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
|
if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
|
||||||
$message = $this->escapeData($message);
|
$message = $this->escapeData($message);
|
||||||
|
@ -55,7 +55,7 @@ final class GithubActionError
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function escapeData($data): string
|
private function escapeData(string $data): string
|
||||||
{
|
{
|
||||||
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85
|
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85
|
||||||
$data = str_replace("%", '%25', $data);
|
$data = str_replace("%", '%25', $data);
|
||||||
|
@ -69,7 +69,7 @@ final class GithubActionError
|
||||||
* @param string $property
|
* @param string $property
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function escapeProperty($property): string
|
private function escapeProperty(string $property): string
|
||||||
{
|
{
|
||||||
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94
|
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94
|
||||||
$property = str_replace("%", '%25', $property);
|
$property = str_replace("%", '%25', $property);
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function decide($literal, $level, Rule $why): void
|
public function decide(int $literal, int $level, Rule $why): void
|
||||||
{
|
{
|
||||||
$this->addDecision($literal, $level);
|
$this->addDecision($literal, $level);
|
||||||
$this->decisionQueue[] = array(
|
$this->decisionQueue[] = array(
|
||||||
|
@ -56,7 +56,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literal
|
* @param int $literal
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function satisfy($literal): bool
|
public function satisfy(int $literal): bool
|
||||||
{
|
{
|
||||||
$packageId = abs($literal);
|
$packageId = abs($literal);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literal
|
* @param int $literal
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function conflict($literal): bool
|
public function conflict(int $literal): bool
|
||||||
{
|
{
|
||||||
$packageId = abs($literal);
|
$packageId = abs($literal);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literalOrPackageId
|
* @param int $literalOrPackageId
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function decided($literalOrPackageId): bool
|
public function decided(int $literalOrPackageId): bool
|
||||||
{
|
{
|
||||||
return !empty($this->decisionMap[abs($literalOrPackageId)]);
|
return !empty($this->decisionMap[abs($literalOrPackageId)]);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literalOrPackageId
|
* @param int $literalOrPackageId
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function undecided($literalOrPackageId): bool
|
public function undecided(int $literalOrPackageId): bool
|
||||||
{
|
{
|
||||||
return empty($this->decisionMap[abs($literalOrPackageId)]);
|
return empty($this->decisionMap[abs($literalOrPackageId)]);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literalOrPackageId
|
* @param int $literalOrPackageId
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function decidedInstall($literalOrPackageId): bool
|
public function decidedInstall(int $literalOrPackageId): bool
|
||||||
{
|
{
|
||||||
$packageId = abs($literalOrPackageId);
|
$packageId = abs($literalOrPackageId);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literalOrPackageId
|
* @param int $literalOrPackageId
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function decisionLevel($literalOrPackageId): int
|
public function decisionLevel(int $literalOrPackageId): int
|
||||||
{
|
{
|
||||||
$packageId = abs($literalOrPackageId);
|
$packageId = abs($literalOrPackageId);
|
||||||
if (isset($this->decisionMap[$packageId])) {
|
if (isset($this->decisionMap[$packageId])) {
|
||||||
|
@ -127,7 +127,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $literalOrPackageId
|
* @param int $literalOrPackageId
|
||||||
* @return Rule|null
|
* @return Rule|null
|
||||||
*/
|
*/
|
||||||
public function decisionRule($literalOrPackageId): ?Rule
|
public function decisionRule(int $literalOrPackageId): ?Rule
|
||||||
{
|
{
|
||||||
$packageId = abs($literalOrPackageId);
|
$packageId = abs($literalOrPackageId);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $queueOffset
|
* @param int $queueOffset
|
||||||
* @return array{0: int, 1: Rule} a literal and decision reason
|
* @return array{0: int, 1: Rule} a literal and decision reason
|
||||||
*/
|
*/
|
||||||
public function atOffset($queueOffset): array
|
public function atOffset(int $queueOffset): array
|
||||||
{
|
{
|
||||||
return $this->decisionQueue[$queueOffset];
|
return $this->decisionQueue[$queueOffset];
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $queueOffset
|
* @param int $queueOffset
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validOffset($queueOffset): bool
|
public function validOffset(int $queueOffset): bool
|
||||||
{
|
{
|
||||||
return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
|
return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function resetToOffset($offset): void
|
public function resetToOffset(int $offset): void
|
||||||
{
|
{
|
||||||
while (\count($this->decisionQueue) > $offset + 1) {
|
while (\count($this->decisionQueue) > $offset + 1) {
|
||||||
$decision = array_pop($this->decisionQueue);
|
$decision = array_pop($this->decisionQueue);
|
||||||
|
@ -252,7 +252,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function addDecision($literal, $level): void
|
protected function addDecision(int $literal, int $level): void
|
||||||
{
|
{
|
||||||
$packageId = abs($literal);
|
$packageId = abs($literal);
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ class Decisions implements \Iterator, \Countable
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return $this->toString();
|
return $this->toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class DefaultPolicy implements PolicyInterface
|
||||||
* @param bool $preferStable
|
* @param bool $preferStable
|
||||||
* @param bool $preferLowest
|
* @param bool $preferLowest
|
||||||
*/
|
*/
|
||||||
public function __construct($preferStable = false, $preferLowest = false)
|
public function __construct(bool $preferStable = false, bool $preferLowest = false)
|
||||||
{
|
{
|
||||||
$this->preferStable = $preferStable;
|
$this->preferStable = $preferStable;
|
||||||
$this->preferLowest = $preferLowest;
|
$this->preferLowest = $preferLowest;
|
||||||
|
@ -44,7 +44,7 @@ class DefaultPolicy implements PolicyInterface
|
||||||
*
|
*
|
||||||
* @phpstan-param Constraint::STR_OP_* $operator
|
* @phpstan-param Constraint::STR_OP_* $operator
|
||||||
*/
|
*/
|
||||||
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator): bool
|
public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool
|
||||||
{
|
{
|
||||||
if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
|
if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
|
||||||
return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
|
return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
|
||||||
|
@ -61,7 +61,7 @@ class DefaultPolicy implements PolicyInterface
|
||||||
* @param string $requiredPackage
|
* @param string $requiredPackage
|
||||||
* @return int[]
|
* @return int[]
|
||||||
*/
|
*/
|
||||||
public function selectPreferredPackages(Pool $pool, array $literals, $requiredPackage = null): array
|
public function selectPreferredPackages(Pool $pool, array $literals, string $requiredPackage = null): array
|
||||||
{
|
{
|
||||||
$packages = $this->groupLiteralsByName($pool, $literals);
|
$packages = $this->groupLiteralsByName($pool, $literals);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class DefaultPolicy implements PolicyInterface
|
||||||
* @param int[] $literals
|
* @param int[] $literals
|
||||||
* @return array<string, int[]>
|
* @return array<string, int[]>
|
||||||
*/
|
*/
|
||||||
protected function groupLiteralsByName(Pool $pool, $literals): array
|
protected function groupLiteralsByName(Pool $pool, array $literals): array
|
||||||
{
|
{
|
||||||
$packages = array();
|
$packages = array();
|
||||||
foreach ($literals as $literal) {
|
foreach ($literals as $literal) {
|
||||||
|
@ -107,11 +107,11 @@ class DefaultPolicy implements PolicyInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @param ?string $requiredPackage
|
* @param null|string $requiredPackage
|
||||||
* @param bool $ignoreReplace
|
* @param bool $ignoreReplace
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, $requiredPackage = null, $ignoreReplace = false): int
|
public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, ?string $requiredPackage = null, bool $ignoreReplace = false): int
|
||||||
{
|
{
|
||||||
// prefer aliases to the original package
|
// prefer aliases to the original package
|
||||||
if ($a->getName() === $b->getName()) {
|
if ($a->getName() === $b->getName()) {
|
||||||
|
@ -182,7 +182,7 @@ class DefaultPolicy implements PolicyInterface
|
||||||
* @param int[] $literals
|
* @param int[] $literals
|
||||||
* @return int[]
|
* @return int[]
|
||||||
*/
|
*/
|
||||||
protected function pruneToBestVersion(Pool $pool, $literals): array
|
protected function pruneToBestVersion(Pool $pool, array $literals): array
|
||||||
{
|
{
|
||||||
$operator = $this->preferLowest ? '<' : '>';
|
$operator = $this->preferLowest ? '<' : '>';
|
||||||
$bestLiterals = array($literals[0]);
|
$bestLiterals = array($literals[0]);
|
||||||
|
|
|
@ -77,7 +77,7 @@ class GenericRule extends Rule
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
$result = $this->isDisabled() ? 'disabled(' : '(';
|
$result = $this->isDisabled() ? 'disabled(' : '(';
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ class LockTransaction extends Transaction
|
||||||
* @param bool $updateMirrors
|
* @param bool $updateMirrors
|
||||||
* @return BasePackage[]
|
* @return BasePackage[]
|
||||||
*/
|
*/
|
||||||
public function getNewLockPackages($devMode, $updateMirrors = false): array
|
public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
|
||||||
{
|
{
|
||||||
$packages = array();
|
$packages = array();
|
||||||
foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
|
foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
|
||||||
|
@ -119,7 +119,7 @@ class LockTransaction extends Transaction
|
||||||
if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
|
if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
|
||||||
$package->setSourceDistReferences($presentPackage->getSourceReference());
|
$package->setSourceDistReferences($presentPackage->getSourceReference());
|
||||||
}
|
}
|
||||||
if ($presentPackage->getReleaseDate() && $package instanceof Package) {
|
if ($presentPackage->getReleaseDate() !== null && $package instanceof Package) {
|
||||||
$package->setReleaseDate($presentPackage->getReleaseDate());
|
$package->setReleaseDate($presentPackage->getReleaseDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ class LockTransaction extends Transaction
|
||||||
* @param array<array{package: string, version: string, alias: string, alias_normalized: string}> $aliases
|
* @param array<array{package: string, version: string, alias: string, alias_normalized: string}> $aliases
|
||||||
* @return array<array{package: string, version: string, alias: string, alias_normalized: string}>
|
* @return array<array{package: string, version: string, alias: string, alias_normalized: string}>
|
||||||
*/
|
*/
|
||||||
public function getAliases($aliases): array
|
public function getAliases(array $aliases): array
|
||||||
{
|
{
|
||||||
$usedAliases = array();
|
$usedAliases = array();
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class MultiConflictRule extends Rule
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
// TODO multi conflict?
|
// TODO multi conflict?
|
||||||
$result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
|
$result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
|
||||||
|
|
|
@ -38,7 +38,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
||||||
*
|
*
|
||||||
* @return PackageInterface
|
* @return PackageInterface
|
||||||
*/
|
*/
|
||||||
public function getPackage()
|
public function getPackage(): PackageInterface
|
||||||
{
|
{
|
||||||
return $this->package;
|
return $this->package;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function show($lock)
|
public function show($lock): string
|
||||||
{
|
{
|
||||||
return self::format($this->package, $lock);
|
return self::format($this->package, $lock);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
||||||
* @param bool $lock
|
* @param bool $lock
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function format(PackageInterface $package, $lock = false)
|
public static function format(PackageInterface $package, bool $lock = false): string
|
||||||
{
|
{
|
||||||
return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
|
return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ interface OperationInterface
|
||||||
* @param bool $lock Whether this is an operation on the lock file
|
* @param bool $lock Whether this is an operation on the lock file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function show($lock);
|
public function show(bool $lock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the operation in a human readable format
|
* Serializes the operation in a human readable format
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class SolverOperation implements OperationInterface
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOperationType()
|
public function getOperationType(): string
|
||||||
{
|
{
|
||||||
return static::TYPE;
|
return static::TYPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class UninstallOperation extends SolverOperation implements OperationInterface
|
||||||
* @param bool $lock
|
* @param bool $lock
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function format(PackageInterface $package, $lock = false): string
|
public static function format(PackageInterface $package, bool $lock = false): string
|
||||||
{
|
{
|
||||||
return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
|
return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class UpdateOperation extends SolverOperation implements OperationInterface
|
||||||
* @param bool $lock
|
* @param bool $lock
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, $lock = false): string
|
public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, bool $lock = false): string
|
||||||
{
|
{
|
||||||
$fromVersion = $initialPackage->getFullPrettyVersion();
|
$fromVersion = $initialPackage->getFullPrettyVersion();
|
||||||
$toVersion = $targetPackage->getFullPrettyVersion();
|
$toVersion = $targetPackage->getFullPrettyVersion();
|
||||||
|
|
|
@ -26,12 +26,12 @@ interface PolicyInterface
|
||||||
*
|
*
|
||||||
* @phpstan-param Constraint::STR_OP_* $operator
|
* @phpstan-param Constraint::STR_OP_* $operator
|
||||||
*/
|
*/
|
||||||
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator): bool;
|
public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int[] $literals
|
* @param int[] $literals
|
||||||
* @param ?string $requiredPackage
|
* @param null|string $requiredPackage
|
||||||
* @return int[]
|
* @return int[]
|
||||||
*/
|
*/
|
||||||
public function selectPreferredPackages(Pool $pool, array $literals, $requiredPackage = null): array;
|
public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class Pool implements \Countable
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function getRemovedVersions($name, ConstraintInterface $constraint): array
|
public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
|
||||||
{
|
{
|
||||||
if (!isset($this->removedVersions[$name])) {
|
if (!isset($this->removedVersions[$name])) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -80,7 +80,7 @@ class Pool implements \Countable
|
||||||
* @param string $objectHash
|
* @param string $objectHash
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function getRemovedVersionsByPackage($objectHash): array
|
public function getRemovedVersionsByPackage(string $objectHash): array
|
||||||
{
|
{
|
||||||
if (!isset($this->removedVersionsByPackage[$objectHash])) {
|
if (!isset($this->removedVersionsByPackage[$objectHash])) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -122,7 +122,7 @@ class Pool implements \Countable
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return BasePackage
|
* @return BasePackage
|
||||||
*/
|
*/
|
||||||
public function packageById($id): BasePackage
|
public function packageById(int $id): BasePackage
|
||||||
{
|
{
|
||||||
return $this->packages[$id - 1];
|
return $this->packages[$id - 1];
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class Pool implements \Countable
|
||||||
* packages must match or null to return all
|
* packages must match or null to return all
|
||||||
* @return BasePackage[] A set of packages
|
* @return BasePackage[] A set of packages
|
||||||
*/
|
*/
|
||||||
public function whatProvides($name, ConstraintInterface $constraint = null): array
|
public function whatProvides(string $name, ConstraintInterface $constraint = null): array
|
||||||
{
|
{
|
||||||
$key = (string) $constraint;
|
$key = (string) $constraint;
|
||||||
if (isset($this->providerCache[$name][$key])) {
|
if (isset($this->providerCache[$name][$key])) {
|
||||||
|
@ -159,7 +159,7 @@ class Pool implements \Countable
|
||||||
* packages must match or null to return all
|
* packages must match or null to return all
|
||||||
* @return BasePackage[]
|
* @return BasePackage[]
|
||||||
*/
|
*/
|
||||||
private function computeWhatProvides($name, ConstraintInterface $constraint = null): array
|
private function computeWhatProvides(string $name, ConstraintInterface $constraint = null): array
|
||||||
{
|
{
|
||||||
if (!isset($this->packageByName[$name])) {
|
if (!isset($this->packageByName[$name])) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -180,7 +180,7 @@ class Pool implements \Countable
|
||||||
* @param int $literal
|
* @param int $literal
|
||||||
* @return BasePackage
|
* @return BasePackage
|
||||||
*/
|
*/
|
||||||
public function literalToPackage($literal): BasePackage
|
public function literalToPackage(int $literal): BasePackage
|
||||||
{
|
{
|
||||||
$packageId = abs($literal);
|
$packageId = abs($literal);
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class Pool implements \Countable
|
||||||
* @param array<int, BasePackage> $installedMap
|
* @param array<int, BasePackage> $installedMap
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function literalToPrettyString($literal, $installedMap): string
|
public function literalToPrettyString(int $literal, array $installedMap): string
|
||||||
{
|
{
|
||||||
$package = $this->literalToPackage($literal);
|
$package = $this->literalToPackage($literal);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class Pool implements \Countable
|
||||||
* @param string $name Name of the package to be matched
|
* @param string $name Name of the package to be matched
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function match(BasePackage $candidate, $name, ConstraintInterface $constraint = null): bool
|
public function match(BasePackage $candidate, string $name, ConstraintInterface $constraint = null): bool
|
||||||
{
|
{
|
||||||
$candidateName = $candidate->getName();
|
$candidateName = $candidate->getName();
|
||||||
$candidateVersion = $candidate->getVersion();
|
$candidateVersion = $candidate->getVersion();
|
||||||
|
@ -268,7 +268,7 @@ class Pool implements \Countable
|
||||||
return $this->unacceptableFixedOrLockedPackages;
|
return $this->unacceptableFixedOrLockedPackages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
$str = "Pool:\n";
|
$str = "Pool:\n";
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ class PoolBuilder
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function markPackageNameForLoading(Request $request, $name, ConstraintInterface $constraint): void
|
private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint): void
|
||||||
{
|
{
|
||||||
// Skip platform requires at this stage
|
// Skip platform requires at this stage
|
||||||
if (PlatformRepository::isPlatformPackage($name)) {
|
if (PlatformRepository::isPlatformPackage($name)) {
|
||||||
|
@ -396,7 +396,7 @@ class PoolBuilder
|
||||||
* @param RepositoryInterface[] $repositories
|
* @param RepositoryInterface[] $repositories
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function loadPackage(Request $request, array $repositories, BasePackage $package, $propagateUpdate): void
|
private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
|
||||||
{
|
{
|
||||||
$index = $this->indexCounter++;
|
$index = $this->indexCounter++;
|
||||||
$this->packages[$index] = $package;
|
$this->packages[$index] = $package;
|
||||||
|
@ -501,7 +501,7 @@ class PoolBuilder
|
||||||
* @param string $name packageName
|
* @param string $name packageName
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function isRootRequire(Request $request, $name): bool
|
private function isRootRequire(Request $request, string $name): bool
|
||||||
{
|
{
|
||||||
$rootRequires = $request->getRequires();
|
$rootRequires = $request->getRequires();
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ class PoolBuilder
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function getSkippedRootRequires(Request $request, $name): array
|
private function getSkippedRootRequires(Request $request, string $name): array
|
||||||
{
|
{
|
||||||
if (!isset($this->skippedLoad[$name])) {
|
if (!isset($this->skippedLoad[$name])) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -602,7 +602,7 @@ class PoolBuilder
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function unlockPackage(Request $request, array $repositories, $name): void
|
private function unlockPackage(Request $request, array $repositories, string $name): void
|
||||||
{
|
{
|
||||||
foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
|
foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
|
||||||
// if we unfixed a replaced package name, we also need to unfix the replacer itself
|
// if we unfixed a replaced package name, we also need to unfix the replacer itself
|
||||||
|
@ -668,7 +668,7 @@ class PoolBuilder
|
||||||
* @param int $index
|
* @param int $index
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index): void
|
private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, int $index): void
|
||||||
{
|
{
|
||||||
$repoIndex = array_search($package->getRepository(), $repositories, true);
|
$repoIndex = array_search($package->getRepository(), $repositories, true);
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ class PoolOptimizer
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function markPackageForRemoval($id): void
|
private function markPackageForRemoval(int $id): void
|
||||||
{
|
{
|
||||||
// We are not allowed to remove packages if they have been marked as irremovable
|
// We are not allowed to remove packages if they have been marked as irremovable
|
||||||
if (isset($this->irremovablePackages[$id])) {
|
if (isset($this->irremovablePackages[$id])) {
|
||||||
|
@ -337,7 +337,7 @@ class PoolOptimizer
|
||||||
* @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup
|
* @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function keepPackage(BasePackage $package, $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup): void
|
private function keepPackage(BasePackage $package, array $identicalDefinitionsPerPackage, array $packageIdenticalDefinitionLookup): void
|
||||||
{
|
{
|
||||||
unset($this->packagesToRemove[$package->id]);
|
unset($this->packagesToRemove[$package->id]);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Problem
|
||||||
* @param array<Rule[]> $learnedPool
|
* @param array<Rule[]> $learnedPool
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
||||||
{
|
{
|
||||||
// TODO doesn't this entirely defeat the purpose of the problem sections? what's the point of sections?
|
// TODO doesn't this entirely defeat the purpose of the problem sections? what's the point of sections?
|
||||||
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
|
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
|
||||||
|
@ -117,7 +117,7 @@ class Problem
|
||||||
* @return string
|
* @return string
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public static function formatDeduplicatedRules($rules, $indent, RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
public static function formatDeduplicatedRules(array $rules, string $indent, RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
||||||
{
|
{
|
||||||
$messages = array();
|
$messages = array();
|
||||||
$templates = array();
|
$templates = array();
|
||||||
|
@ -185,7 +185,7 @@ class Problem
|
||||||
* @param Rule $reason The reason descriptor
|
* @param Rule $reason The reason descriptor
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function addReason($id, Rule $reason): void
|
protected function addReason(string $id, Rule $reason): void
|
||||||
{
|
{
|
||||||
// TODO: if a rule is part of a problem description in two sections, isn't this going to remove a message
|
// TODO: if a rule is part of a problem description in two sections, isn't this going to remove a message
|
||||||
// that is important to understand the issue?
|
// that is important to understand the issue?
|
||||||
|
@ -210,7 +210,7 @@ class Problem
|
||||||
* @param string $packageName
|
* @param string $packageName
|
||||||
* @return array{0: string, 1: string}
|
* @return array{0: string, 1: string}
|
||||||
*/
|
*/
|
||||||
public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, ConstraintInterface $constraint = null): array
|
public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, string $packageName, ConstraintInterface $constraint = null): array
|
||||||
{
|
{
|
||||||
if (PlatformRepository::isPlatformPackage($packageName)) {
|
if (PlatformRepository::isPlatformPackage($packageName)) {
|
||||||
// handle php/php-*/hhvm
|
// handle php/php-*/hhvm
|
||||||
|
@ -382,7 +382,7 @@ class Problem
|
||||||
* @param bool $useRemovedVersionGroup
|
* @param bool $useRemovedVersionGroup
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getPackageList(array $packages, $isVerbose, Pool $pool = null, ConstraintInterface $constraint = null, $useRemovedVersionGroup = false): string
|
public static function getPackageList(array $packages, bool $isVerbose, Pool $pool = null, ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
|
||||||
{
|
{
|
||||||
$prepared = array();
|
$prepared = array();
|
||||||
$hasDefaultBranch = array();
|
$hasDefaultBranch = array();
|
||||||
|
@ -427,7 +427,7 @@ class Problem
|
||||||
* @param string $version the effective runtime version of the platform package
|
* @param string $version the effective runtime version of the platform package
|
||||||
* @return ?string a version string or null if it appears the package was artificially disabled
|
* @return ?string a version string or null if it appears the package was artificially disabled
|
||||||
*/
|
*/
|
||||||
private static function getPlatformPackageVersion(Pool $pool, $packageName, $version): ?string
|
private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
|
||||||
{
|
{
|
||||||
$available = $pool->whatProvides($packageName);
|
$available = $pool->whatProvides($packageName);
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ class Problem
|
||||||
* @param int $maxDev
|
* @param int $maxDev
|
||||||
* @return list<string> a list of pretty versions and '...' where versions were removed
|
* @return list<string> a list of pretty versions and '...' where versions were removed
|
||||||
*/
|
*/
|
||||||
private static function condenseVersionList(array $versions, $max, $maxDev = 16): array
|
private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
|
||||||
{
|
{
|
||||||
if (count($versions) <= $max) {
|
if (count($versions) <= $max) {
|
||||||
return $versions;
|
return $versions;
|
||||||
|
@ -527,7 +527,7 @@ class Problem
|
||||||
* @param string $reason
|
* @param string $reason
|
||||||
* @return array{0: string, 1: string}
|
* @return array{0: string, 1: string}
|
||||||
*/
|
*/
|
||||||
private static function computeCheckForLowerPrioRepo(Pool $pool, $isVerbose, $packageName, array $higherRepoPackages, array $allReposPackages, $reason, ConstraintInterface $constraint = null): array
|
private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ConstraintInterface $constraint = null): array
|
||||||
{
|
{
|
||||||
$nextRepoPackages = array();
|
$nextRepoPackages = array();
|
||||||
$nextRepo = null;
|
$nextRepo = null;
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Request
|
||||||
* @param string $packageName
|
* @param string $packageName
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function requireName($packageName, ConstraintInterface $constraint = null): void
|
public function requireName(string $packageName, ConstraintInterface $constraint = null): void
|
||||||
{
|
{
|
||||||
$packageName = strtolower($packageName);
|
$packageName = strtolower($packageName);
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class Request
|
||||||
* @param false|self::UPDATE_* $updateAllowTransitiveDependencies
|
* @param false|self::UPDATE_* $updateAllowTransitiveDependencies
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies): void
|
public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
|
||||||
{
|
{
|
||||||
$this->updateAllowList = $updateAllowList;
|
$this->updateAllowList = $updateAllowList;
|
||||||
$this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
|
$this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
|
||||||
|
@ -222,7 +222,7 @@ class Request
|
||||||
* Some locked packages may not be in the pool,
|
* Some locked packages may not be in the pool,
|
||||||
* so they have a package->id of -1
|
* so they have a package->id of -1
|
||||||
*/
|
*/
|
||||||
public function getPresentMap($packageIds = false): array
|
public function getPresentMap(bool $packageIds = false): array
|
||||||
{
|
{
|
||||||
$presentMap = array();
|
$presentMap = array();
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ abstract class Rule
|
||||||
*/
|
*/
|
||||||
abstract public function getHash();
|
abstract public function getHash();
|
||||||
|
|
||||||
abstract public function __toString();
|
abstract public function __toString(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Rule $rule
|
* @param Rule $rule
|
||||||
|
@ -267,7 +267,7 @@ abstract class Rule
|
||||||
* @param array<Rule[]> $learnedPool
|
* @param array<Rule[]> $learnedPool
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
|
||||||
{
|
{
|
||||||
$literals = $this->getLiterals();
|
$literals = $this->getLiterals();
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ abstract class Rule
|
||||||
* @param bool $useRemovedVersionGroup
|
* @param bool $useRemovedVersionGroup
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function formatPackagesUnique(Pool $pool, array $packages, $isVerbose, ConstraintInterface $constraint = null, $useRemovedVersionGroup = false): string
|
protected function formatPackagesUnique(Pool $pool, array $packages, bool $isVerbose, ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
|
||||||
{
|
{
|
||||||
foreach ($packages as $index => $package) {
|
foreach ($packages as $index => $package) {
|
||||||
if (!\is_object($package)) {
|
if (!\is_object($package)) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Rule2Literals extends Rule
|
||||||
*
|
*
|
||||||
* @phpstan-param ReasonData $reasonData
|
* @phpstan-param ReasonData $reasonData
|
||||||
*/
|
*/
|
||||||
public function __construct($literal1, $literal2, $reason, $reasonData)
|
public function __construct(int $literal1, int $literal2, $reason, $reasonData)
|
||||||
{
|
{
|
||||||
parent::__construct($reason, $reasonData);
|
parent::__construct($reason, $reasonData);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class Rule2Literals extends Rule
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
$result = $this->isDisabled() ? 'disabled(' : '(';
|
$result = $this->isDisabled() ? 'disabled(' : '(';
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return Rule
|
* @return Rule
|
||||||
*/
|
*/
|
||||||
public function ruleById($id): Rule
|
public function ruleById(int $id): Rule
|
||||||
{
|
{
|
||||||
return $this->ruleById[$id];
|
return $this->ruleById[$id];
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
||||||
* @param bool $isVerbose
|
* @param bool $isVerbose
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPrettyString(RepositorySet $repositorySet = null, Request $request = null, Pool $pool = null, $isVerbose = false): string
|
public function getPrettyString(RepositorySet $repositorySet = null, Request $request = null, Pool $pool = null, bool $isVerbose = false): string
|
||||||
{
|
{
|
||||||
$string = "\n";
|
$string = "\n";
|
||||||
foreach ($this->rules as $type => $rules) {
|
foreach ($this->rules as $type => $rules) {
|
||||||
|
@ -195,7 +195,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return $this->getPrettyString();
|
return $this->getPrettyString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class RuleSetGenerator
|
||||||
* @param BasePackage[] $packages The set of packages to choose from
|
* @param BasePackage[] $packages The set of packages to choose from
|
||||||
* @param Rule::RULE_* $reason A RULE_* constant describing the reason for
|
* @param Rule::RULE_* $reason A RULE_* constant describing the reason for
|
||||||
* generating this rule
|
* generating this rule
|
||||||
* @param array $reasonData Additional data like the root require or fix request info
|
* @param mixed $reasonData Additional data like the root require or fix request info
|
||||||
* @return Rule The generated rule
|
* @return Rule The generated rule
|
||||||
*
|
*
|
||||||
* @phpstan-param ReasonData $reasonData
|
* @phpstan-param ReasonData $reasonData
|
||||||
|
|
|
@ -29,7 +29,7 @@ class RuleWatchChain extends \SplDoublyLinkedList
|
||||||
* @param int $offset The offset to seek to.
|
* @param int $offset The offset to seek to.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function seek($offset): void
|
public function seek(int $offset): void
|
||||||
{
|
{
|
||||||
$this->rewind();
|
$this->rewind();
|
||||||
for ($i = 0; $i < $offset; $i++, $this->next());
|
for ($i = 0; $i < $offset; $i++, $this->next());
|
||||||
|
|
|
@ -88,7 +88,7 @@ class RuleWatchGraph
|
||||||
* register decisions resulting from propagation
|
* register decisions resulting from propagation
|
||||||
* @return Rule|null If a conflict is found the conflicting rule is returned
|
* @return Rule|null If a conflict is found the conflicting rule is returned
|
||||||
*/
|
*/
|
||||||
public function propagateLiteral($decidedLiteral, $level, Decisions $decisions): ?Rule
|
public function propagateLiteral(int $decidedLiteral, int $level, Decisions $decisions): ?Rule
|
||||||
{
|
{
|
||||||
// we invert the decided literal here, example:
|
// we invert the decided literal here, example:
|
||||||
// A was decided => (-A|B) now requires B to be true, so we look for
|
// A was decided => (-A|B) now requires B to be true, so we look for
|
||||||
|
@ -156,7 +156,7 @@ class RuleWatchGraph
|
||||||
* @param RuleWatchNode $node The rule node to be moved
|
* @param RuleWatchNode $node The rule node to be moved
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function moveWatch($fromLiteral, $toLiteral, RuleWatchNode $node): void
|
protected function moveWatch(int $fromLiteral, int $toLiteral, RuleWatchNode $node): void
|
||||||
{
|
{
|
||||||
if (!isset($this->watchChains[$toLiteral])) {
|
if (!isset($this->watchChains[$toLiteral])) {
|
||||||
$this->watchChains[$toLiteral] = new RuleWatchChain;
|
$this->watchChains[$toLiteral] = new RuleWatchChain;
|
||||||
|
|
|
@ -91,7 +91,7 @@ class RuleWatchNode
|
||||||
* @param int $literal The watched literal that should not be returned
|
* @param int $literal The watched literal that should not be returned
|
||||||
* @return int A literal
|
* @return int A literal
|
||||||
*/
|
*/
|
||||||
public function getOtherWatch($literal): int
|
public function getOtherWatch(int $literal): int
|
||||||
{
|
{
|
||||||
if ($this->watch1 == $literal) {
|
if ($this->watch1 == $literal) {
|
||||||
return $this->watch2;
|
return $this->watch2;
|
||||||
|
@ -107,7 +107,7 @@ class RuleWatchNode
|
||||||
* @param int $to The literal to be watched now
|
* @param int $to The literal to be watched now
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function moveWatch($from, $to): void
|
public function moveWatch(int $from, int $to): void
|
||||||
{
|
{
|
||||||
if ($this->watch1 == $from) {
|
if ($this->watch1 == $from) {
|
||||||
$this->watch1 = $to;
|
$this->watch1 = $to;
|
||||||
|
|
|
@ -233,7 +233,7 @@ class Solver
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return Rule|null A rule on conflict, otherwise null.
|
* @return Rule|null A rule on conflict, otherwise null.
|
||||||
*/
|
*/
|
||||||
protected function propagate($level): ?Rule
|
protected function propagate(int $level): ?Rule
|
||||||
{
|
{
|
||||||
while ($this->decisions->validOffset($this->propagateIndex)) {
|
while ($this->decisions->validOffset($this->propagateIndex)) {
|
||||||
$decision = $this->decisions->atOffset($this->propagateIndex);
|
$decision = $this->decisions->atOffset($this->propagateIndex);
|
||||||
|
@ -261,7 +261,7 @@ class Solver
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function revert($level): void
|
private function revert(int $level): void
|
||||||
{
|
{
|
||||||
while (!$this->decisions->isEmpty()) {
|
while (!$this->decisions->isEmpty()) {
|
||||||
$literal = $this->decisions->lastLiteral();
|
$literal = $this->decisions->lastLiteral();
|
||||||
|
@ -302,7 +302,7 @@ class Solver
|
||||||
* @param string|int $literal
|
* @param string|int $literal
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function setPropagateLearn($level, $literal, Rule $rule): int
|
private function setPropagateLearn(int $level, $literal, Rule $rule): int
|
||||||
{
|
{
|
||||||
$level++;
|
$level++;
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ class Solver
|
||||||
* @param int[] $decisionQueue
|
* @param int[] $decisionQueue
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function selectAndInstall($level, array $decisionQueue, Rule $rule): int
|
private function selectAndInstall(int $level, array $decisionQueue, Rule $rule): int
|
||||||
{
|
{
|
||||||
// choose best package to install from decisionQueue
|
// choose best package to install from decisionQueue
|
||||||
$literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
|
$literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
|
||||||
|
@ -370,7 +370,7 @@ class Solver
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return array{int, int, GenericRule, int}
|
* @return array{int, int, GenericRule, int}
|
||||||
*/
|
*/
|
||||||
protected function analyze($level, Rule $rule): array
|
protected function analyze(int $level, Rule $rule): array
|
||||||
{
|
{
|
||||||
$analyzedRule = $rule;
|
$analyzedRule = $rule;
|
||||||
$ruleLevel = 1;
|
$ruleLevel = 1;
|
||||||
|
|
|
@ -20,7 +20,7 @@ class SolverBugException extends \RuntimeException
|
||||||
/**
|
/**
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
public function __construct($message)
|
public function __construct(string $message)
|
||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
$message."\nThis exception was most likely caused by a bug in Composer.\n".
|
$message."\nThis exception was most likely caused by a bug in Composer.\n".
|
||||||
|
|
|
@ -46,7 +46,7 @@ class SolverProblemsException extends \RuntimeException
|
||||||
* @param bool $isDevExtraction
|
* @param bool $isDevExtraction
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $isDevExtraction = false): string
|
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, bool $isDevExtraction = false): string
|
||||||
{
|
{
|
||||||
$installedMap = $request->getPresentMap(true);
|
$installedMap = $request->getPresentMap(true);
|
||||||
$missingExtensions = array();
|
$missingExtensions = array();
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Transaction
|
||||||
* @param PackageInterface[] $presentPackages
|
* @param PackageInterface[] $presentPackages
|
||||||
* @param PackageInterface[] $resultPackages
|
* @param PackageInterface[] $resultPackages
|
||||||
*/
|
*/
|
||||||
public function __construct($presentPackages, $resultPackages)
|
public function __construct(array $presentPackages, array $resultPackages)
|
||||||
{
|
{
|
||||||
$this->presentPackages = $presentPackages;
|
$this->presentPackages = $presentPackages;
|
||||||
$this->setResultPackageMaps($resultPackages);
|
$this->setResultPackageMaps($resultPackages);
|
||||||
|
@ -69,7 +69,7 @@ class Transaction
|
||||||
* @param PackageInterface[] $resultPackages
|
* @param PackageInterface[] $resultPackages
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function setResultPackageMaps($resultPackages): void
|
private function setResultPackageMaps(array $resultPackages): void
|
||||||
{
|
{
|
||||||
$packageSort = function (PackageInterface $a, PackageInterface $b): int {
|
$packageSort = function (PackageInterface $a, PackageInterface $b): int {
|
||||||
// sort alias packages by the same name behind their non alias version
|
// sort alias packages by the same name behind their non alias version
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Downloader;
|
namespace Composer\Downloader;
|
||||||
|
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use React\Promise\PromiseInterface;
|
use React\Promise\PromiseInterface;
|
||||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||||
|
@ -32,9 +33,9 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
protected $cleanupExecuted = array();
|
protected $cleanupExecuted = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
unset($this->cleanupExecuted[$package->getName()]);
|
unset($this->cleanupExecuted[$package->getName()]);
|
||||||
|
|
||||||
|
@ -42,9 +43,9 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
$this->cleanupExecuted[$package->getName()] = true;
|
$this->cleanupExecuted[$package->getName()] = true;
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @throws \UnexpectedValueException
|
* @throws \UnexpectedValueException
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $path, $output = true)
|
public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
|
$this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
|
||||||
|
@ -83,7 +84,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
$this->addCleanupPath($package, $temporaryDir);
|
$this->addCleanupPath($package, $temporaryDir);
|
||||||
// avoid cleaning up $path if installing in "." for eg create-project as we can not
|
// avoid cleaning up $path if installing in "." for eg create-project as we can not
|
||||||
// delete the directory we are currently in on windows
|
// delete the directory we are currently in on windows
|
||||||
if (!is_dir($path) || realpath($path) !== getcwd()) {
|
if (!is_dir($path) || realpath($path) !== Platform::getCwd()) {
|
||||||
$this->addCleanupPath($package, $path);
|
$this->addCleanupPath($package, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
$filesystem->removeDirectory($temporaryDir);
|
$filesystem->removeDirectory($temporaryDir);
|
||||||
if (is_dir($path) && realpath($path) !== getcwd()) {
|
if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
|
||||||
$filesystem->removeDirectory($path);
|
$filesystem->removeDirectory($path);
|
||||||
}
|
}
|
||||||
$this->removeCleanupPath($package, $temporaryDir);
|
$this->removeCleanupPath($package, $temporaryDir);
|
||||||
|
@ -112,10 +113,6 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$promise instanceof PromiseInterface) {
|
|
||||||
$promise = \React\Promise\resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
|
return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
|
||||||
$filesystem->unlink($fileName);
|
$filesystem->unlink($fileName);
|
||||||
|
|
||||||
|
@ -214,7 +211,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||||
{
|
{
|
||||||
return ': Extracting archive';
|
return ': Extracting archive';
|
||||||
}
|
}
|
||||||
|
@ -226,7 +223,6 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
* @param string $path Directory
|
* @param string $path Directory
|
||||||
*
|
*
|
||||||
* @throws \UnexpectedValueException If can not extract downloaded file to path
|
* @throws \UnexpectedValueException If can not extract downloaded file to path
|
||||||
* @return PromiseInterface|null
|
|
||||||
*/
|
*/
|
||||||
abstract protected function extract(PackageInterface $package, $file, $path);
|
abstract protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ interface ChangeReportInterface
|
||||||
* @param string $path package directory
|
* @param string $path package directory
|
||||||
* @return string|null changes or null
|
* @return string|null changes or null
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path);
|
public function getLocalChanges(PackageInterface $package, string $path): ?string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class DownloadManager
|
||||||
* @param bool $preferSource prefer downloading from source
|
* @param bool $preferSource prefer downloading from source
|
||||||
* @param Filesystem|null $filesystem custom Filesystem object
|
* @param Filesystem|null $filesystem custom Filesystem object
|
||||||
*/
|
*/
|
||||||
public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
|
public function __construct(IOInterface $io, bool $preferSource = false, Filesystem $filesystem = null)
|
||||||
{
|
{
|
||||||
$this->io = $io;
|
$this->io = $io;
|
||||||
$this->preferSource = $preferSource;
|
$this->preferSource = $preferSource;
|
||||||
|
@ -59,7 +59,7 @@ class DownloadManager
|
||||||
* @param bool $preferSource prefer downloading from source
|
* @param bool $preferSource prefer downloading from source
|
||||||
* @return DownloadManager
|
* @return DownloadManager
|
||||||
*/
|
*/
|
||||||
public function setPreferSource($preferSource): DownloadManager
|
public function setPreferSource(bool $preferSource): self
|
||||||
{
|
{
|
||||||
$this->preferSource = $preferSource;
|
$this->preferSource = $preferSource;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class DownloadManager
|
||||||
* @param bool $preferDist prefer downloading from dist
|
* @param bool $preferDist prefer downloading from dist
|
||||||
* @return DownloadManager
|
* @return DownloadManager
|
||||||
*/
|
*/
|
||||||
public function setPreferDist($preferDist): DownloadManager
|
public function setPreferDist(bool $preferDist): self
|
||||||
{
|
{
|
||||||
$this->preferDist = $preferDist;
|
$this->preferDist = $preferDist;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class DownloadManager
|
||||||
*
|
*
|
||||||
* @return DownloadManager
|
* @return DownloadManager
|
||||||
*/
|
*/
|
||||||
public function setPreferences(array $preferences): DownloadManager
|
public function setPreferences(array $preferences): self
|
||||||
{
|
{
|
||||||
$this->packagePreferences = $preferences;
|
$this->packagePreferences = $preferences;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class DownloadManager
|
||||||
* @param DownloaderInterface $downloader downloader instance
|
* @param DownloaderInterface $downloader downloader instance
|
||||||
* @return DownloadManager
|
* @return DownloadManager
|
||||||
*/
|
*/
|
||||||
public function setDownloader($type, DownloaderInterface $downloader): DownloadManager
|
public function setDownloader(string $type, DownloaderInterface $downloader): self
|
||||||
{
|
{
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
$this->downloaders[$type] = $downloader;
|
$this->downloaders[$type] = $downloader;
|
||||||
|
@ -115,7 +115,7 @@ class DownloadManager
|
||||||
* @throws \InvalidArgumentException if downloader for provided type is not registered
|
* @throws \InvalidArgumentException if downloader for provided type is not registered
|
||||||
* @return DownloaderInterface
|
* @return DownloaderInterface
|
||||||
*/
|
*/
|
||||||
public function getDownloader($type): DownloaderInterface
|
public function getDownloader(string $type): DownloaderInterface
|
||||||
{
|
{
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
if (!isset($this->downloaders[$type])) {
|
if (!isset($this->downloaders[$type])) {
|
||||||
|
@ -184,7 +184,7 @@ class DownloadManager
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return PromiseInterface
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $targetDir, PackageInterface $prevPackage = null): PromiseInterface
|
public function download(PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$this->filesystem->ensureDirectoryExists(dirname($targetDir));
|
$this->filesystem->ensureDirectoryExists(dirname($targetDir));
|
||||||
|
@ -229,9 +229,6 @@ class DownloadManager
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $handleError($e);
|
return $handleError($e);
|
||||||
}
|
}
|
||||||
if (!$result instanceof PromiseInterface) {
|
|
||||||
return \React\Promise\resolve($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = $result->then(function ($res) {
|
$res = $result->then(function ($res) {
|
||||||
return $res;
|
return $res;
|
||||||
|
@ -251,9 +248,9 @@ class DownloadManager
|
||||||
* @param string $targetDir target dir
|
* @param string $targetDir target dir
|
||||||
* @param PackageInterface|null $prevPackage previous package instance in case of updates
|
* @param PackageInterface|null $prevPackage previous package instance in case of updates
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, $targetDir, PackageInterface $prevPackage = null): ?PromiseInterface
|
public function prepare(string $type, PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$downloader = $this->getDownloaderForPackage($package);
|
$downloader = $this->getDownloaderForPackage($package);
|
||||||
|
@ -272,9 +269,9 @@ class DownloadManager
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException if package have no urls to download from
|
* @throws \InvalidArgumentException if package have no urls to download from
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $targetDir): ?PromiseInterface
|
public function install(PackageInterface $package, string $targetDir): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$downloader = $this->getDownloaderForPackage($package);
|
$downloader = $this->getDownloaderForPackage($package);
|
||||||
|
@ -293,9 +290,9 @@ class DownloadManager
|
||||||
* @param string $targetDir target dir
|
* @param string $targetDir target dir
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException if initial package is not installed
|
* @throws \InvalidArgumentException if initial package is not installed
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function update(PackageInterface $initial, PackageInterface $target, $targetDir): ?PromiseInterface
|
public function update(PackageInterface $initial, PackageInterface $target, string $targetDir): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$downloader = $this->getDownloaderForPackage($target);
|
$downloader = $this->getDownloaderForPackage($target);
|
||||||
|
@ -330,18 +327,10 @@ class DownloadManager
|
||||||
// if downloader type changed, or update failed and user asks for reinstall,
|
// if downloader type changed, or update failed and user asks for reinstall,
|
||||||
// we wipe the dir and do a new install instead of updating it
|
// we wipe the dir and do a new install instead of updating it
|
||||||
$promise = $initialDownloader->remove($initial, $targetDir);
|
$promise = $initialDownloader->remove($initial, $targetDir);
|
||||||
if ($promise instanceof PromiseInterface) {
|
|
||||||
return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
|
return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
|
||||||
$promise = $this->install($target, $targetDir);
|
|
||||||
if ($promise instanceof PromiseInterface) {
|
|
||||||
return $promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
return \React\Promise\resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->install($target, $targetDir);
|
return $this->install($target, $targetDir);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,9 +339,9 @@ class DownloadManager
|
||||||
* @param PackageInterface $package package instance
|
* @param PackageInterface $package package instance
|
||||||
* @param string $targetDir target dir
|
* @param string $targetDir target dir
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function remove(PackageInterface $package, $targetDir): ?PromiseInterface
|
public function remove(PackageInterface $package, string $targetDir): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$downloader = $this->getDownloaderForPackage($package);
|
$downloader = $this->getDownloaderForPackage($package);
|
||||||
|
@ -371,9 +360,9 @@ class DownloadManager
|
||||||
* @param string $targetDir target dir
|
* @param string $targetDir target dir
|
||||||
* @param PackageInterface|null $prevPackage previous package instance in case of updates
|
* @param PackageInterface|null $prevPackage previous package instance in case of updates
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, $targetDir, PackageInterface $prevPackage = null): ?PromiseInterface
|
public function cleanup(string $type, PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
$targetDir = $this->normalizeTargetDir($targetDir);
|
$targetDir = $this->normalizeTargetDir($targetDir);
|
||||||
$downloader = $this->getDownloaderForPackage($package);
|
$downloader = $this->getDownloaderForPackage($package);
|
||||||
|
@ -461,7 +450,7 @@ class DownloadManager
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function normalizeTargetDir($dir): string
|
private function normalizeTargetDir(string $dir): string
|
||||||
{
|
{
|
||||||
if ($dir === '\\' || $dir === '/') {
|
if ($dir === '\\' || $dir === '/') {
|
||||||
return $dir;
|
return $dir;
|
||||||
|
|
|
@ -28,15 +28,15 @@ interface DownloaderInterface
|
||||||
*
|
*
|
||||||
* @return string "source" or "dist"
|
* @return string "source" or "dist"
|
||||||
*/
|
*/
|
||||||
public function getInstallationSource();
|
public function getInstallationSource(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should do any network-related tasks to prepare for an upcoming install/update
|
* This should do any network-related tasks to prepare for an upcoming install/update
|
||||||
*
|
*
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null);
|
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do anything that needs to be done between all downloads have been completed and the actual operation is executed
|
* Do anything that needs to be done between all downloads have been completed and the actual operation is executed
|
||||||
|
@ -50,18 +50,18 @@ interface DownloaderInterface
|
||||||
* @param PackageInterface $package package instance
|
* @param PackageInterface $package package instance
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null);
|
public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs specific package into specific folder.
|
* Installs specific package into specific folder.
|
||||||
*
|
*
|
||||||
* @param PackageInterface $package package instance
|
* @param PackageInterface $package package instance
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $path);
|
public function install(PackageInterface $package, string $path): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates specific package in specific folder from initial to target version.
|
* Updates specific package in specific folder from initial to target version.
|
||||||
|
@ -69,18 +69,18 @@ interface DownloaderInterface
|
||||||
* @param PackageInterface $initial initial package
|
* @param PackageInterface $initial initial package
|
||||||
* @param PackageInterface $target updated package
|
* @param PackageInterface $target updated package
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function update(PackageInterface $initial, PackageInterface $target, $path);
|
public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes specific package from specific folder.
|
* Removes specific package from specific folder.
|
||||||
*
|
*
|
||||||
* @param PackageInterface $package package instance
|
* @param PackageInterface $package package instance
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function remove(PackageInterface $package, $path);
|
public function remove(PackageInterface $package, string $path): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do anything to cleanup changes applied in the prepare or install/update/uninstall steps
|
* Do anything to cleanup changes applied in the prepare or install/update/uninstall steps
|
||||||
|
@ -93,7 +93,7 @@ interface DownloaderInterface
|
||||||
* @param PackageInterface $package package instance
|
* @param PackageInterface $package package instance
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null);
|
public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ interface DvcsDownloaderInterface
|
||||||
* @param string $path package directory
|
* @param string $path package directory
|
||||||
* @return string|null changes or null
|
* @return string|null changes or null
|
||||||
*/
|
*/
|
||||||
public function getUnpushedChanges(PackageInterface $package, $path);
|
public function getUnpushedChanges(PackageInterface $package, string $path): ?string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Composer\Plugin\PostFileDownloadEvent;
|
||||||
use Composer\Plugin\PreFileDownloadEvent;
|
use Composer\Plugin\PreFileDownloadEvent;
|
||||||
use Composer\EventDispatcher\EventDispatcher;
|
use Composer\EventDispatcher\EventDispatcher;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Composer\Util\Silencer;
|
use Composer\Util\Silencer;
|
||||||
use Composer\Util\HttpDownloader;
|
use Composer\Util\HttpDownloader;
|
||||||
use Composer\Util\Url as UrlUtil;
|
use Composer\Util\Url as UrlUtil;
|
||||||
|
@ -65,11 +66,9 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
public static $downloadMetadata = array();
|
public static $downloadMetadata = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private this is only public for php 5.3 support in closures
|
|
||||||
*
|
|
||||||
* @var array<string, string> Map of package name to cache key
|
* @var array<string, string> Map of package name to cache key
|
||||||
*/
|
*/
|
||||||
public $lastCacheWrites = array();
|
private $lastCacheWrites = array();
|
||||||
/** @var array<string, string[]> Map of package name to list of paths */
|
/** @var array<string, string[]> Map of package name to list of paths */
|
||||||
private $additionalCleanupPaths = array();
|
private $additionalCleanupPaths = array();
|
||||||
|
|
||||||
|
@ -102,7 +101,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getInstallationSource()
|
public function getInstallationSource(): string
|
||||||
{
|
{
|
||||||
return 'dist';
|
return 'dist';
|
||||||
}
|
}
|
||||||
|
@ -112,7 +111,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
*
|
*
|
||||||
* @param bool $output
|
* @param bool $output
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null, $output = true)
|
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
if (!$package->getDistUrl()) {
|
if (!$package->getDistUrl()) {
|
||||||
throw new \InvalidArgumentException('The given package is missing url information');
|
throw new \InvalidArgumentException('The given package is missing url information');
|
||||||
|
@ -295,7 +294,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
return \React\Promise\resolve();
|
return \React\Promise\resolve();
|
||||||
}
|
}
|
||||||
|
@ -303,7 +302,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
$fileName = $this->getFileName($package, $path);
|
$fileName = $this->getFileName($package, $path);
|
||||||
if (file_exists($fileName)) {
|
if (file_exists($fileName)) {
|
||||||
|
@ -323,7 +322,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($dirsToCleanUp as $dir) {
|
foreach ($dirsToCleanUp as $dir) {
|
||||||
if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== getcwd()) {
|
if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
|
||||||
$this->filesystem->removeDirectoryPhp($dir);
|
$this->filesystem->removeDirectoryPhp($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +335,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
*
|
*
|
||||||
* @param bool $output
|
* @param bool $output
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $path, $output = true)
|
public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$this->io->writeError(" - " . InstallOperation::format($package));
|
$this->io->writeError(" - " . InstallOperation::format($package));
|
||||||
|
@ -362,7 +361,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function clearLastCacheWrite(PackageInterface $package)
|
protected function clearLastCacheWrite(PackageInterface $package): void
|
||||||
{
|
{
|
||||||
if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
|
if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
|
||||||
$this->cache->remove($this->lastCacheWrites[$package->getName()]);
|
$this->cache->remove($this->lastCacheWrites[$package->getName()]);
|
||||||
|
@ -375,7 +374,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function addCleanupPath(PackageInterface $package, $path)
|
protected function addCleanupPath(PackageInterface $package, string $path): void
|
||||||
{
|
{
|
||||||
$this->additionalCleanupPaths[$package->getName()][] = $path;
|
$this->additionalCleanupPaths[$package->getName()][] = $path;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +384,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function removeCleanupPath(PackageInterface $package, $path)
|
protected function removeCleanupPath(PackageInterface $package, string $path): void
|
||||||
{
|
{
|
||||||
if (isset($this->additionalCleanupPaths[$package->getName()])) {
|
if (isset($this->additionalCleanupPaths[$package->getName()])) {
|
||||||
$idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
|
$idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
|
||||||
|
@ -398,22 +397,14 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function update(PackageInterface $initial, PackageInterface $target, $path)
|
public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
|
$this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
|
||||||
|
|
||||||
$promise = $this->remove($initial, $path, false);
|
$promise = $this->remove($initial, $path, false);
|
||||||
if (!$promise instanceof PromiseInterface) {
|
|
||||||
$promise = \React\Promise\resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $promise->then(function () use ($target, $path): PromiseInterface {
|
return $promise->then(function () use ($target, $path): PromiseInterface {
|
||||||
$promise = $this->install($target, $path, false);
|
return $this->install($target, $path, false);
|
||||||
if ($promise instanceof PromiseInterface) {
|
|
||||||
return $promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
return \React\Promise\resolve();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +413,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
*
|
*
|
||||||
* @param bool $output
|
* @param bool $output
|
||||||
*/
|
*/
|
||||||
public function remove(PackageInterface $package, $path, $output = true)
|
public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$this->io->writeError(" - " . UninstallOperation::format($package));
|
$this->io->writeError(" - " . UninstallOperation::format($package));
|
||||||
|
@ -443,7 +434,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return string file name
|
* @return string file name
|
||||||
*/
|
*/
|
||||||
protected function getFileName(PackageInterface $package, $path)
|
protected function getFileName(PackageInterface $package, string $path): string
|
||||||
{
|
{
|
||||||
return rtrim($this->config->get('vendor-dir').'/composer/tmp-'.md5($package.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
|
return rtrim($this->config->get('vendor-dir').'/composer/tmp-'.md5($package.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
|
||||||
}
|
}
|
||||||
|
@ -455,7 +446,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -468,7 +459,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
* @throws \RuntimeException If any problem with the url
|
* @throws \RuntimeException If any problem with the url
|
||||||
* @return string url
|
* @return string url
|
||||||
*/
|
*/
|
||||||
protected function processUrl(PackageInterface $package, $url)
|
protected function processUrl(PackageInterface $package, string $url): string
|
||||||
{
|
{
|
||||||
if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
|
if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
|
||||||
throw new \RuntimeException('You must enable the openssl extension to download files via https');
|
throw new \RuntimeException('You must enable the openssl extension to download files via https');
|
||||||
|
@ -485,7 +476,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $targetDir)
|
public function getLocalChanges(PackageInterface $package, string $targetDir): ?string
|
||||||
{
|
{
|
||||||
$prevIO = $this->io;
|
$prevIO = $this->io;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class FilesystemException extends \Exception
|
||||||
* @param int $code
|
* @param int $code
|
||||||
* @param \Exception|null $previous
|
* @param \Exception|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct($message = '', $code = 0, \Exception $previous = null)
|
public function __construct(string $message = '', int $code = 0, \Exception $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct("Filesystem exception: \n".$message, $code, $previous);
|
parent::__construct("Filesystem exception: \n".$message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null): ?PromiseInterface
|
protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
return \React\Promise\resolve();
|
return \React\Promise\resolve();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doInstall(PackageInterface $package, $path, $url): ?PromiseInterface
|
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
// Ensure we are allowed to use this URL by config
|
// Ensure we are allowed to use this URL by config
|
||||||
$this->config->prohibitUrlByConfig($url, $this->io);
|
$this->config->prohibitUrlByConfig($url, $this->io);
|
||||||
|
@ -61,7 +61,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url): ?PromiseInterface
|
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
// Ensure we are allowed to use this URL by config
|
// Ensure we are allowed to use this URL by config
|
||||||
$this->config->prohibitUrlByConfig($url, $this->io);
|
$this->config->prohibitUrlByConfig($url, $this->io);
|
||||||
|
@ -84,7 +84,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path): ?string
|
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
if (!$this->hasMetadataRepository($path)) {
|
if (!$this->hasMetadataRepository($path)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -98,7 +98,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path): string
|
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||||
{
|
{
|
||||||
$command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
|
$command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class FossilDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function hasMetadataRepository($path): bool
|
protected function hasMetadataRepository(string $path): bool
|
||||||
{
|
{
|
||||||
return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
|
return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
|
protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doInstall(PackageInterface $package, $path, $url)
|
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
|
@ -114,7 +114,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
|
|
||||||
$this->io->writeError($msg);
|
$this->io->writeError($msg);
|
||||||
|
|
||||||
$commandCallable = function ($url) use ($path, $command, $cachePath): string {
|
$commandCallable = function (string $url) use ($path, $command, $cachePath): string {
|
||||||
return str_replace(
|
return str_replace(
|
||||||
array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
|
array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
|
||||||
array(
|
array(
|
||||||
|
@ -148,7 +148,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
|
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
|
@ -213,7 +213,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path)
|
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
if (!$this->hasMetadataRepository($path)) {
|
if (!$this->hasMetadataRepository($path)) {
|
||||||
|
@ -231,7 +231,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
public function getUnpushedChanges(PackageInterface $package, $path)
|
public function getUnpushedChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
|
@ -328,7 +328,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function cleanChanges(PackageInterface $package, $path, $update)
|
protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
|
||||||
{
|
{
|
||||||
GitUtil::cleanEnv();
|
GitUtil::cleanEnv();
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
|
@ -415,7 +415,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function reapplyChanges($path)
|
protected function reapplyChanges(string $path): void
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (!empty($this->hasStashedChanges[$path])) {
|
if (!empty($this->hasStashedChanges[$path])) {
|
||||||
|
@ -438,7 +438,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found
|
* @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found
|
||||||
*/
|
*/
|
||||||
protected function updateToCommit(PackageInterface $package, $path, $reference, $prettyVersion)
|
protected function updateToCommit(PackageInterface $package, string $path, string $reference, string $prettyVersion): ?string
|
||||||
{
|
{
|
||||||
$force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? '-f ' : '';
|
$force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? '-f ' : '';
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function updateOriginUrl($path, $url)
|
protected function updateOriginUrl(string $path, string $url): void
|
||||||
{
|
{
|
||||||
$this->process->execute(sprintf('git remote set-url origin -- %s', ProcessExecutor::escape($url)), $output, $path);
|
$this->process->execute(sprintf('git remote set-url origin -- %s', ProcessExecutor::escape($url)), $output, $path);
|
||||||
$this->setPushUrl($path, $url);
|
$this->setPushUrl($path, $url);
|
||||||
|
@ -517,7 +517,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setPushUrl($path, $url)
|
protected function setPushUrl(string $path, string $url): void
|
||||||
{
|
{
|
||||||
// set push url for github projects
|
// set push url for github projects
|
||||||
if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
|
if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
|
||||||
|
@ -534,7 +534,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path)
|
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
$command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
|
$command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
|
||||||
|
@ -553,7 +553,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function discardChanges($path)
|
protected function discardChanges(string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
|
if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
|
||||||
|
@ -572,7 +572,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function stashChanges($path)
|
protected function stashChanges(string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
|
if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
|
||||||
|
@ -591,7 +591,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function viewDiff($path)
|
protected function viewDiff(string $path): void
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
|
if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
|
||||||
|
@ -606,7 +606,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function normalizePath($path)
|
protected function normalizePath(string $path): string
|
||||||
{
|
{
|
||||||
if (Platform::isWindows() && strlen($path) > 0) {
|
if (Platform::isWindows() && strlen($path) > 0) {
|
||||||
$basePath = $path;
|
$basePath = $path;
|
||||||
|
@ -630,7 +630,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function hasMetadataRepository($path)
|
protected function hasMetadataRepository(string $path): bool
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
* @param string $reference
|
* @param string $reference
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getShortHash($reference)
|
protected function getShortHash(string $reference): string
|
||||||
{
|
{
|
||||||
if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
|
if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
|
||||||
return substr($reference, 0, 10);
|
return substr($reference, 0, 10);
|
||||||
|
|
|
@ -24,7 +24,7 @@ use Composer\Util\ProcessExecutor;
|
||||||
*/
|
*/
|
||||||
class GzipDownloader extends ArchiveDownloader
|
class GzipDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$filename = pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_FILENAME);
|
$filename = pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_FILENAME);
|
||||||
$targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
|
$targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
|
||||||
|
@ -60,7 +60,7 @@ class GzipDownloader extends ArchiveDownloader
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function extractUsingExt($file, $targetFilepath): void
|
private function extractUsingExt(string $file, string $targetFilepath): void
|
||||||
{
|
{
|
||||||
$archiveFile = gzopen($file, 'rb');
|
$archiveFile = gzopen($file, 'rb');
|
||||||
$targetFile = fopen($targetFilepath, 'wb');
|
$targetFile = fopen($targetFilepath, 'wb');
|
||||||
|
|
|
@ -25,7 +25,7 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null): ?PromiseInterface
|
protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
if (null === HgUtils::getVersion($this->process)) {
|
if (null === HgUtils::getVersion($this->process)) {
|
||||||
throw new \RuntimeException('hg was not found in your PATH, skipping source download');
|
throw new \RuntimeException('hg was not found in your PATH, skipping source download');
|
||||||
|
@ -37,11 +37,11 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doInstall(PackageInterface $package, $path, $url): ?PromiseInterface
|
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
$hgUtils = new HgUtils($this->io, $this->config, $this->process);
|
$hgUtils = new HgUtils($this->io, $this->config, $this->process);
|
||||||
|
|
||||||
$cloneCommand = function ($url) use ($path): string {
|
$cloneCommand = function (string $url) use ($path): string {
|
||||||
return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
|
return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url): ?PromiseInterface
|
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
$hgUtils = new HgUtils($this->io, $this->config, $this->process);
|
$hgUtils = new HgUtils($this->io, $this->config, $this->process);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path): ?string
|
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
if (!is_dir($path.'/.hg')) {
|
if (!is_dir($path.'/.hg')) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -96,7 +96,7 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path): string
|
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||||
{
|
{
|
||||||
$command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
|
$command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class HgDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function hasMetadataRepository($path): bool
|
protected function hasMetadataRepository(string $path): bool
|
||||||
{
|
{
|
||||||
return is_dir($path . '/.hg');
|
return is_dir($path . '/.hg');
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null, $output = true): ?PromiseInterface
|
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
$path = Filesystem::trimTrailingSlash($path);
|
$path = Filesystem::trimTrailingSlash($path);
|
||||||
$url = $package->getDistUrl();
|
$url = $package->getDistUrl();
|
||||||
|
@ -75,7 +75,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $path, $output = true): ?PromiseInterface
|
public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
$path = Filesystem::trimTrailingSlash($path);
|
$path = Filesystem::trimTrailingSlash($path);
|
||||||
$url = $package->getDistUrl();
|
$url = $package->getDistUrl();
|
||||||
|
@ -113,7 +113,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
} else {
|
} else {
|
||||||
$absolutePath = $path;
|
$absolutePath = $path;
|
||||||
if (!$this->filesystem->isAbsolutePath($absolutePath)) {
|
if (!$this->filesystem->isAbsolutePath($absolutePath)) {
|
||||||
$absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
|
$absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
|
||||||
}
|
}
|
||||||
$shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
|
$shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
|
||||||
$path = rtrim($path, "/");
|
$path = rtrim($path, "/");
|
||||||
|
@ -161,7 +161,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function remove(PackageInterface $package, $path, $output = true): ?PromiseInterface
|
public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
$path = Filesystem::trimTrailingSlash($path);
|
$path = Filesystem::trimTrailingSlash($path);
|
||||||
/**
|
/**
|
||||||
|
@ -190,8 +190,8 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
// not using realpath here as we do not want to resolve the symlink to the original dist url
|
// not using realpath here as we do not want to resolve the symlink to the original dist url
|
||||||
// it points to
|
// it points to
|
||||||
$fs = new Filesystem;
|
$fs = new Filesystem;
|
||||||
$absPath = $fs->isAbsolutePath($path) ? $path : getcwd() . '/' . $path;
|
$absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
|
||||||
$absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : getcwd() . '/' . $package->getDistUrl();
|
$absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : Platform::getCwd() . '/' . $package->getDistUrl();
|
||||||
if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
|
if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
|
$this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
|
||||||
|
@ -206,7 +206,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getVcsReference(PackageInterface $package, $path): ?string
|
public function getVcsReference(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
$path = Filesystem::trimTrailingSlash($path);
|
$path = Filesystem::trimTrailingSlash($path);
|
||||||
$parser = new VersionParser;
|
$parser = new VersionParser;
|
||||||
|
@ -224,7 +224,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getInstallOperationAppendix(PackageInterface $package, $path): string
|
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||||
{
|
{
|
||||||
$realUrl = realpath($package->getDistUrl());
|
$realUrl = realpath($package->getDistUrl());
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
||||||
*
|
*
|
||||||
* @phpstan-return array{self::STRATEGY_*, non-empty-list<self::STRATEGY_*>}
|
* @phpstan-return array{self::STRATEGY_*, non-empty-list<self::STRATEGY_*>}
|
||||||
*/
|
*/
|
||||||
private function computeAllowedStrategies(array $transportOptions)
|
private function computeAllowedStrategies(array $transportOptions): array
|
||||||
{
|
{
|
||||||
// When symlink transport option is null, both symlink and mirror are allowed
|
// When symlink transport option is null, both symlink and mirror are allowed
|
||||||
$currentStrategy = self::STRATEGY_SYMLINK;
|
$currentStrategy = self::STRATEGY_SYMLINK;
|
||||||
|
|
|
@ -28,7 +28,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null): ?PromiseInterface
|
protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
return \React\Promise\resolve();
|
return \React\Promise\resolve();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function doInstall(PackageInterface $package, $path, $url): ?PromiseInterface
|
public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
$ref = $package->getSourceReference();
|
$ref = $package->getSourceReference();
|
||||||
$label = $this->getLabelFromSourceReference((string) $ref);
|
$label = $this->getLabelFromSourceReference((string) $ref);
|
||||||
|
@ -58,7 +58,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function getLabelFromSourceReference($ref): ?string
|
private function getLabelFromSourceReference(string $ref): ?string
|
||||||
{
|
{
|
||||||
$pos = strpos($ref, '@');
|
$pos = strpos($ref, '@');
|
||||||
if (false !== $pos) {
|
if (false !== $pos) {
|
||||||
|
@ -74,7 +74,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initPerforce(PackageInterface $package, $path, $url): void
|
public function initPerforce(PackageInterface $package, string $path, string $url): void
|
||||||
{
|
{
|
||||||
if (!empty($this->perforce)) {
|
if (!empty($this->perforce)) {
|
||||||
$this->perforce->initializePath($path);
|
$this->perforce->initializePath($path);
|
||||||
|
@ -101,7 +101,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url): ?PromiseInterface
|
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
return $this->doInstall($target, $path, $url);
|
return $this->doInstall($target, $path, $url);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path): ?string
|
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
$this->io->writeError('Perforce driver does not check for local changes before overriding');
|
$this->io->writeError('Perforce driver does not check for local changes before overriding');
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path): string
|
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||||
{
|
{
|
||||||
return $this->perforce->getCommitLogs($fromReference, $toReference);
|
return $this->perforce->getCommitLogs($fromReference, $toReference);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function hasMetadataRepository($path): bool
|
protected function hasMetadataRepository(string $path): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class PharDownloader extends ArchiveDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
// Can throw an UnexpectedValueException
|
// Can throw an UnexpectedValueException
|
||||||
$archive = new \Phar($file);
|
$archive = new \Phar($file);
|
||||||
|
|
|
@ -28,7 +28,7 @@ use RarArchive;
|
||||||
*/
|
*/
|
||||||
class RarDownloader extends ArchiveDownloader
|
class RarDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$processError = null;
|
$processError = null;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
|
protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
SvnUtil::cleanEnv();
|
SvnUtil::cleanEnv();
|
||||||
$util = new SvnUtil($url, $this->io, $this->config, $this->process);
|
$util = new SvnUtil($url, $this->io, $this->config, $this->process);
|
||||||
|
@ -45,7 +45,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doInstall(PackageInterface $package, $path, $url)
|
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
SvnUtil::cleanEnv();
|
SvnUtil::cleanEnv();
|
||||||
$ref = $package->getSourceReference();
|
$ref = $package->getSourceReference();
|
||||||
|
@ -67,7 +67,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
|
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||||
{
|
{
|
||||||
SvnUtil::cleanEnv();
|
SvnUtil::cleanEnv();
|
||||||
$ref = $target->getSourceReference();
|
$ref = $target->getSourceReference();
|
||||||
|
@ -91,7 +91,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLocalChanges(PackageInterface $package, $path)
|
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
if (!$this->hasMetadataRepository($path)) {
|
if (!$this->hasMetadataRepository($path)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -114,7 +114,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function execute(PackageInterface $package, $baseUrl, $command, $url, $cwd = null, $path = null)
|
protected function execute(PackageInterface $package, string $baseUrl, string $command, string $url, string $cwd = null, string $path = null): string
|
||||||
{
|
{
|
||||||
$util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
|
$util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
|
||||||
$util->setCacheCredentials($this->cacheCredentials);
|
$util->setCacheCredentials($this->cacheCredentials);
|
||||||
|
@ -130,7 +130,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function cleanChanges(PackageInterface $package, $path, $update)
|
protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
|
||||||
{
|
{
|
||||||
if (!$changes = $this->getLocalChanges($package, $path)) {
|
if (!$changes = $this->getLocalChanges($package, $path)) {
|
||||||
return \React\Promise\resolve();
|
return \React\Promise\resolve();
|
||||||
|
@ -191,7 +191,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path)
|
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||||
{
|
{
|
||||||
if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
|
if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
|
||||||
// retrieve the svn base url from the checkout folder
|
// retrieve the svn base url from the checkout folder
|
||||||
|
@ -236,7 +236,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
*
|
*
|
||||||
* @return PromiseInterface
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
protected function discardChanges($path)
|
protected function discardChanges(string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
|
if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
|
||||||
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
|
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
|
||||||
|
@ -248,7 +248,7 @@ class SvnDownloader extends VcsDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function hasMetadataRepository($path)
|
protected function hasMetadataRepository(string $path): bool
|
||||||
{
|
{
|
||||||
return is_dir($path.'/.svn');
|
return is_dir($path.'/.svn');
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Downloader;
|
namespace Composer\Downloader;
|
||||||
|
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
use React\Promise\PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloader for tar files: tar, tar.gz or tar.bz2
|
* Downloader for tar files: tar, tar.gz or tar.bz2
|
||||||
|
@ -24,7 +25,7 @@ class TarDownloader extends ArchiveDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
protected function extract(PackageInterface $package, $file, $path)
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
// Can throw an UnexpectedValueException
|
// Can throw an UnexpectedValueException
|
||||||
$archive = new \PharData($file);
|
$archive = new \PharData($file);
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TransportException extends \RuntimeException
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setHeaders($headers): void
|
public function setHeaders(array $headers): void
|
||||||
{
|
{
|
||||||
$this->headers = $headers;
|
$this->headers = $headers;
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ class TransportException extends \RuntimeException
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ?string $response
|
* @param null|string $response
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setResponse($response): void
|
public function setResponse(?string $response): void
|
||||||
{
|
{
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ interface VcsCapableDownloaderInterface
|
||||||
* @param string $path package directory
|
* @param string $path package directory
|
||||||
* @return string|null reference or null
|
* @return string|null reference or null
|
||||||
*/
|
*/
|
||||||
public function getVcsReference(PackageInterface $package, $path);
|
public function getVcsReference(PackageInterface $package, string $path): ?string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getInstallationSource()
|
public function getInstallationSource(): string
|
||||||
{
|
{
|
||||||
return 'source';
|
return 'source';
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
if (!$package->getSourceReference()) {
|
if (!$package->getSourceReference()) {
|
||||||
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
||||||
|
@ -93,7 +93,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
if ($type === 'update') {
|
if ($type === 'update') {
|
||||||
$this->cleanChanges($prevPackage, $path, true);
|
$this->cleanChanges($prevPackage, $path, true);
|
||||||
|
@ -110,7 +110,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||||
{
|
{
|
||||||
if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
|
if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
|
||||||
$this->reapplyChanges($path);
|
$this->reapplyChanges($path);
|
||||||
|
@ -123,7 +123,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function install(PackageInterface $package, $path)
|
public function install(PackageInterface $package, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
if (!$package->getSourceReference()) {
|
if (!$package->getSourceReference()) {
|
||||||
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
||||||
|
@ -158,7 +158,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function update(PackageInterface $initial, PackageInterface $target, $path)
|
public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
if (!$target->getSourceReference()) {
|
if (!$target->getSourceReference()) {
|
||||||
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
|
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
|
||||||
|
@ -194,12 +194,12 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
$message = 'Pulling in changes:';
|
$message = 'Pulling in changes:';
|
||||||
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
|
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
|
||||||
|
|
||||||
if (!trim($logs)) {
|
if ('' === trim($logs)) {
|
||||||
$message = 'Rolling back changes:';
|
$message = 'Rolling back changes:';
|
||||||
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
|
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($logs)) {
|
if ('' !== trim($logs)) {
|
||||||
$logs = implode("\n", array_map(function ($line): string {
|
$logs = implode("\n", array_map(function ($line): string {
|
||||||
return ' ' . $line;
|
return ' ' . $line;
|
||||||
}, explode("\n", $logs)));
|
}, explode("\n", $logs)));
|
||||||
|
@ -222,13 +222,13 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function remove(PackageInterface $package, $path)
|
public function remove(PackageInterface $package, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$this->io->writeError(" - " . UninstallOperation::format($package));
|
$this->io->writeError(" - " . UninstallOperation::format($package));
|
||||||
|
|
||||||
$promise = $this->filesystem->removeDirectoryAsync($path);
|
$promise = $this->filesystem->removeDirectoryAsync($path);
|
||||||
|
|
||||||
return $promise->then(function ($result) use ($path) {
|
return $promise->then(function (bool $result) use ($path) {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
|
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getVcsReference(PackageInterface $package, $path)
|
public function getVcsReference(PackageInterface $package, string $path): ?string
|
||||||
{
|
{
|
||||||
$parser = new VersionParser;
|
$parser = new VersionParser;
|
||||||
$guesser = new VersionGuesser($this->config, $this->process, $parser);
|
$guesser = new VersionGuesser($this->config, $this->process, $parser);
|
||||||
|
@ -264,7 +264,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException in case the operation must be aborted
|
* @throws \RuntimeException in case the operation must be aborted
|
||||||
*/
|
*/
|
||||||
protected function cleanChanges(PackageInterface $package, $path, $update)
|
protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
|
||||||
{
|
{
|
||||||
// the default implementation just fails if there are any changes, override in child classes to provide stash-ability
|
// the default implementation just fails if there are any changes, override in child classes to provide stash-ability
|
||||||
if (null !== $this->getLocalChanges($package, $path)) {
|
if (null !== $this->getLocalChanges($package, $path)) {
|
||||||
|
@ -283,7 +283,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException in case the operation must be aborted or the patch does not apply cleanly
|
* @throws \RuntimeException in case the operation must be aborted or the patch does not apply cleanly
|
||||||
*/
|
*/
|
||||||
protected function reapplyChanges($path)
|
protected function reapplyChanges(string $path): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,9 +295,9 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
* @param string $url package url
|
* @param string $url package url
|
||||||
* @param PackageInterface|null $prevPackage previous package (in case of an update)
|
* @param PackageInterface|null $prevPackage previous package (in case of an update)
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
abstract protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null);
|
abstract protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads specific package into specific folder.
|
* Downloads specific package into specific folder.
|
||||||
|
@ -306,9 +306,9 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @param string $url package url
|
* @param string $url package url
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
abstract protected function doInstall(PackageInterface $package, $path, $url);
|
abstract protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates specific package in specific folder from initial to target version.
|
* Updates specific package in specific folder from initial to target version.
|
||||||
|
@ -318,9 +318,9 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
* @param string $path download path
|
* @param string $path download path
|
||||||
* @param string $url package url
|
* @param string $url package url
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
|
abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the commit logs between two commits
|
* Fetches the commit logs between two commits
|
||||||
|
@ -330,7 +330,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
* @param string $path the package path
|
* @param string $path the package path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract protected function getCommitLogs($fromReference, $toReference, $path);
|
abstract protected function getCommitLogs(string $fromReference, string $toReference, string $path): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if VCS metadata repository has been initialized
|
* Checks if VCS metadata repository has been initialized
|
||||||
|
@ -339,7 +339,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
abstract protected function hasMetadataRepository($path);
|
abstract protected function hasMetadataRepository(string $path): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string[] $urls
|
* @param string[] $urls
|
||||||
|
|
|
@ -24,7 +24,7 @@ use Composer\Util\ProcessExecutor;
|
||||||
*/
|
*/
|
||||||
class XzDownloader extends ArchiveDownloader
|
class XzDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
|
$command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Composer\Util\IniHelper;
|
||||||
use Composer\Util\Platform;
|
use Composer\Util\Platform;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
use Symfony\Component\Process\ExecutableFinder;
|
use Symfony\Component\Process\ExecutableFinder;
|
||||||
|
use Symfony\Component\Process\Process;
|
||||||
use React\Promise\PromiseInterface;
|
use React\Promise\PromiseInterface;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null, $output = true)
|
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
|
||||||
{
|
{
|
||||||
if (null === self::$unzipCommands) {
|
if (null === self::$unzipCommands) {
|
||||||
self::$unzipCommands = array();
|
self::$unzipCommands = array();
|
||||||
|
@ -105,7 +106,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
* @param string $path Path where to extract file
|
* @param string $path Path where to extract file
|
||||||
* @return PromiseInterface
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
private function extractWithSystemUnzip(PackageInterface $package, $file, $path): PromiseInterface
|
private function extractWithSystemUnzip(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
// Force Exception throwing if the other alternative extraction method is not available
|
// Force Exception throwing if the other alternative extraction method is not available
|
||||||
$isLastChance = !self::$hasZipArchive;
|
$isLastChance = !self::$hasZipArchive;
|
||||||
|
@ -127,7 +128,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
$executable = $commandSpec[0];
|
$executable = $commandSpec[0];
|
||||||
|
|
||||||
$io = $this->io;
|
$io = $this->io;
|
||||||
$tryFallback = function ($processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
|
$tryFallback = function (\Throwable $processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
|
||||||
if ($isLastChance) {
|
if ($isLastChance) {
|
||||||
throw $processError;
|
throw $processError;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +149,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
try {
|
try {
|
||||||
$promise = $this->process->executeAsync($command);
|
$promise = $this->process->executeAsync($command);
|
||||||
|
|
||||||
return $promise->then(function ($process) use ($tryFallback, $command, $package, $file) {
|
return $promise->then(function (Process $process) use ($tryFallback, $command, $package, $file) {
|
||||||
if (!$process->isSuccessful()) {
|
if (!$process->isSuccessful()) {
|
||||||
if (isset($this->cleanupExecuted[$package->getName()])) {
|
if (isset($this->cleanupExecuted[$package->getName()])) {
|
||||||
throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
|
throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
|
||||||
|
@ -172,7 +173,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
* @param string $path Path where to extract file
|
* @param string $path Path where to extract file
|
||||||
* @return PromiseInterface
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
private function extractWithZipArchive(PackageInterface $package, $file, $path): PromiseInterface
|
private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
$processError = null;
|
$processError = null;
|
||||||
$zipArchive = $this->zipArchiveObject ?: new ZipArchive();
|
$zipArchive = $this->zipArchiveObject ?: new ZipArchive();
|
||||||
|
@ -205,9 +206,9 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
*
|
*
|
||||||
* @param string $file File to extract
|
* @param string $file File to extract
|
||||||
* @param string $path Path where to extract file
|
* @param string $path Path where to extract file
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface
|
||||||
*/
|
*/
|
||||||
protected function extract(PackageInterface $package, $file, $path)
|
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||||
{
|
{
|
||||||
return $this->extractWithSystemUnzip($package, $file, $path);
|
return $this->extractWithSystemUnzip($package, $file, $path);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +220,7 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getErrorMessage($retval, $file)
|
protected function getErrorMessage(int $retval, string $file): string
|
||||||
{
|
{
|
||||||
switch ($retval) {
|
switch ($retval) {
|
||||||
case ZipArchive::ER_EXISTS:
|
case ZipArchive::ER_EXISTS:
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Event
|
||||||
* @param string[] $args Arguments passed by the user
|
* @param string[] $args Arguments passed by the user
|
||||||
* @param mixed[] $flags Optional flags to pass data not as argument
|
* @param mixed[] $flags Optional flags to pass data not as argument
|
||||||
*/
|
*/
|
||||||
public function __construct($name, array $args = array(), array $flags = array())
|
public function __construct(string $name, array $args = array(), array $flags = array())
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
|
@ -58,7 +58,7 @@ class Event
|
||||||
*
|
*
|
||||||
* @return string The event name
|
* @return string The event name
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class Event
|
||||||
*
|
*
|
||||||
* @return string[] The event arguments
|
* @return string[] The event arguments
|
||||||
*/
|
*/
|
||||||
public function getArguments()
|
public function getArguments(): array
|
||||||
{
|
{
|
||||||
return $this->args;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class Event
|
||||||
*
|
*
|
||||||
* @return mixed[] The event flags
|
* @return mixed[] The event flags
|
||||||
*/
|
*/
|
||||||
public function getFlags()
|
public function getFlags(): array
|
||||||
{
|
{
|
||||||
return $this->flags;
|
return $this->flags;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class Event
|
||||||
*
|
*
|
||||||
* @return bool Whether propagation has been stopped
|
* @return bool Whether propagation has been stopped
|
||||||
*/
|
*/
|
||||||
public function isPropagationStopped()
|
public function isPropagationStopped(): bool
|
||||||
{
|
{
|
||||||
return $this->propagationStopped;
|
return $this->propagationStopped;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class Event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function stopPropagation()
|
public function stopPropagation(): void
|
||||||
{
|
{
|
||||||
$this->propagationStopped = true;
|
$this->propagationStopped = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\EventDispatcher;
|
namespace Composer\EventDispatcher;
|
||||||
|
|
||||||
use Composer\Autoload\AutoloadGenerator;
|
|
||||||
use Composer\DependencyResolver\Transaction;
|
use Composer\DependencyResolver\Transaction;
|
||||||
use Composer\Installer\InstallerEvent;
|
use Composer\Installer\InstallerEvent;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
|
@ -82,7 +81,7 @@ class EventDispatcher
|
||||||
* @param bool $runScripts
|
* @param bool $runScripts
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setRunScripts($runScripts = true)
|
public function setRunScripts(bool $runScripts = true): self
|
||||||
{
|
{
|
||||||
$this->runScripts = (bool) $runScripts;
|
$this->runScripts = (bool) $runScripts;
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ class EventDispatcher
|
||||||
* @return int return code of the executed script if any, for php scripts a false return
|
* @return int return code of the executed script if any, for php scripts a false return
|
||||||
* value is changed to 1, anything else to 0
|
* value is changed to 1, anything else to 0
|
||||||
*/
|
*/
|
||||||
public function dispatch($eventName, Event $event = null)
|
public function dispatch(string $eventName, Event $event = null): int
|
||||||
{
|
{
|
||||||
if (null === $event) {
|
if (null === $event) {
|
||||||
$event = new Event($eventName);
|
$event = new Event($eventName);
|
||||||
|
@ -116,7 +115,7 @@ class EventDispatcher
|
||||||
* @return int return code of the executed script if any, for php scripts a false return
|
* @return int return code of the executed script if any, for php scripts a false return
|
||||||
* value is changed to 1, anything else to 0
|
* value is changed to 1, anything else to 0
|
||||||
*/
|
*/
|
||||||
public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
|
public function dispatchScript(string $eventName, bool $devMode = false, array $additionalArgs = array(), array $flags = array()): int
|
||||||
{
|
{
|
||||||
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ class EventDispatcher
|
||||||
* @return int return code of the executed script if any, for php scripts a false return
|
* @return int return code of the executed script if any, for php scripts a false return
|
||||||
* value is changed to 1, anything else to 0
|
* value is changed to 1, anything else to 0
|
||||||
*/
|
*/
|
||||||
public function dispatchPackageEvent($eventName, $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
|
public function dispatchPackageEvent(string $eventName, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation): int
|
||||||
{
|
{
|
||||||
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
||||||
|
|
||||||
|
@ -153,7 +152,7 @@ class EventDispatcher
|
||||||
* @return int return code of the executed script if any, for php scripts a false return
|
* @return int return code of the executed script if any, for php scripts a false return
|
||||||
* value is changed to 1, anything else to 0
|
* value is changed to 1, anything else to 0
|
||||||
*/
|
*/
|
||||||
public function dispatchInstallerEvent($eventName, $devMode, $executeOperations, Transaction $transaction)
|
public function dispatchInstallerEvent(string $eventName, bool $devMode, bool $executeOperations, Transaction $transaction): int
|
||||||
{
|
{
|
||||||
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
|
||||||
|
|
||||||
|
@ -343,7 +342,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function executeTty($exec)
|
protected function executeTty(string $exec): int
|
||||||
{
|
{
|
||||||
if ($this->io->isInteractive()) {
|
if ($this->io->isInteractive()) {
|
||||||
return $this->process->executeTty($exec);
|
return $this->process->executeTty($exec);
|
||||||
|
@ -355,7 +354,7 @@ class EventDispatcher
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getPhpExecCommand()
|
protected function getPhpExecCommand(): string
|
||||||
{
|
{
|
||||||
$finder = new PhpExecutableFinder();
|
$finder = new PhpExecutableFinder();
|
||||||
$phpPath = $finder->find(false);
|
$phpPath = $finder->find(false);
|
||||||
|
@ -378,7 +377,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function executeEventPhpScript($className, $methodName, Event $event)
|
protected function executeEventPhpScript(string $className, string $methodName, Event $event)
|
||||||
{
|
{
|
||||||
if ($this->io->isVerbose()) {
|
if ($this->io->isVerbose()) {
|
||||||
$this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
|
$this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
|
||||||
|
@ -398,7 +397,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addListener($eventName, $listener, $priority = 0)
|
public function addListener(string $eventName, callable $listener, int $priority = 0): void
|
||||||
{
|
{
|
||||||
$this->listeners[$eventName][$priority][] = $listener;
|
$this->listeners[$eventName][$priority][] = $listener;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +407,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeListener($listener)
|
public function removeListener($listener): void
|
||||||
{
|
{
|
||||||
foreach ($this->listeners as $eventName => $priorities) {
|
foreach ($this->listeners as $eventName => $priorities) {
|
||||||
foreach ($priorities as $priority => $listeners) {
|
foreach ($priorities as $priority => $listeners) {
|
||||||
|
@ -430,7 +429,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addSubscriber(EventSubscriberInterface $subscriber)
|
public function addSubscriber(EventSubscriberInterface $subscriber): void
|
||||||
{
|
{
|
||||||
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
||||||
if (is_string($params)) {
|
if (is_string($params)) {
|
||||||
|
@ -451,7 +450,7 @@ class EventDispatcher
|
||||||
* @param Event $event
|
* @param Event $event
|
||||||
* @return array<callable|string> All listeners: callables and scripts
|
* @return array<callable|string> All listeners: callables and scripts
|
||||||
*/
|
*/
|
||||||
protected function getListeners(Event $event)
|
protected function getListeners(Event $event): array
|
||||||
{
|
{
|
||||||
$scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : array();
|
$scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : array();
|
||||||
|
|
||||||
|
@ -472,7 +471,7 @@ class EventDispatcher
|
||||||
* @param Event $event
|
* @param Event $event
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasEventListeners(Event $event)
|
public function hasEventListeners(Event $event): bool
|
||||||
{
|
{
|
||||||
$listeners = $this->getListeners($event);
|
$listeners = $this->getListeners($event);
|
||||||
|
|
||||||
|
@ -485,7 +484,7 @@ class EventDispatcher
|
||||||
* @param Event $event Event object
|
* @param Event $event Event object
|
||||||
* @return string[] Listeners
|
* @return string[] Listeners
|
||||||
*/
|
*/
|
||||||
protected function getScriptListeners(Event $event)
|
protected function getScriptListeners(Event $event): array
|
||||||
{
|
{
|
||||||
$package = $this->composer->getPackage();
|
$package = $this->composer->getPackage();
|
||||||
$scripts = $package->getScripts();
|
$scripts = $package->getScripts();
|
||||||
|
@ -520,7 +519,7 @@ class EventDispatcher
|
||||||
* @param string $callable
|
* @param string $callable
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isPhpScript($callable)
|
protected function isPhpScript(string $callable): bool
|
||||||
{
|
{
|
||||||
return false === strpos($callable, ' ') && false !== strpos($callable, '::');
|
return false === strpos($callable, ' ') && false !== strpos($callable, '::');
|
||||||
}
|
}
|
||||||
|
@ -531,7 +530,7 @@ class EventDispatcher
|
||||||
* @param string $callable
|
* @param string $callable
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isComposerScript($callable)
|
protected function isComposerScript(string $callable): bool
|
||||||
{
|
{
|
||||||
return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
|
return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
|
||||||
}
|
}
|
||||||
|
@ -543,7 +542,7 @@ class EventDispatcher
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function pushEvent(Event $event)
|
protected function pushEvent(Event $event): int
|
||||||
{
|
{
|
||||||
$eventName = $event->getName();
|
$eventName = $event->getName();
|
||||||
if (in_array($eventName, $this->eventStack)) {
|
if (in_array($eventName, $this->eventStack)) {
|
||||||
|
@ -558,7 +557,7 @@ class EventDispatcher
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
protected function popEvent()
|
protected function popEvent(): ?string
|
||||||
{
|
{
|
||||||
return array_pop($this->eventStack);
|
return array_pop($this->eventStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ class Factory
|
||||||
|
|
||||||
public static function createConfig(IOInterface $io = null, ?string $cwd = null): Config
|
public static function createConfig(IOInterface $io = null, ?string $cwd = null): Config
|
||||||
{
|
{
|
||||||
$cwd = $cwd ?: (string) getcwd();
|
$cwd = $cwd ?? Platform::getCwd(true);
|
||||||
|
|
||||||
$config = new Config(true, $cwd);
|
$config = new Config(true, $cwd);
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ class Factory
|
||||||
*/
|
*/
|
||||||
public function createComposer(IOInterface $io, $localConfig = null, bool $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
|
public function createComposer(IOInterface $io, $localConfig = null, bool $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
|
||||||
{
|
{
|
||||||
$cwd = $cwd ?: (string) getcwd();
|
$cwd = $cwd ?? Platform::getCwd(true);
|
||||||
|
|
||||||
// load Composer configuration
|
// load Composer configuration
|
||||||
if (null === $localConfig) {
|
if (null === $localConfig) {
|
||||||
|
@ -454,7 +454,7 @@ class Factory
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir, RootPackageInterface $rootPackage, ProcessExecutor $process = null): void
|
protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, string $vendorDir, RootPackageInterface $rootPackage, ProcessExecutor $process = null): void
|
||||||
{
|
{
|
||||||
$fs = null;
|
$fs = null;
|
||||||
if ($process) {
|
if ($process) {
|
||||||
|
@ -621,7 +621,7 @@ class Factory
|
||||||
* @param mixed[] $options Array of options passed directly to HttpDownloader constructor
|
* @param mixed[] $options Array of options passed directly to HttpDownloader constructor
|
||||||
* @return HttpDownloader
|
* @return HttpDownloader
|
||||||
*/
|
*/
|
||||||
public static function createHttpDownloader(IOInterface $io, Config $config, $options = array()): HttpDownloader
|
public static function createHttpDownloader(IOInterface $io, Config $config, array $options = array()): HttpDownloader
|
||||||
{
|
{
|
||||||
static $warned = false;
|
static $warned = false;
|
||||||
$disableTls = false;
|
$disableTls = false;
|
||||||
|
|
|
@ -20,7 +20,7 @@ final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFil
|
||||||
* @param string $req
|
* @param string $req
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isIgnored($req): bool
|
public function isIgnored(string $req): bool
|
||||||
{
|
{
|
||||||
return PlatformRepository::isPlatformPackage($req);
|
return PlatformRepository::isPlatformPackage($req);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
|
||||||
* @param string $req
|
* @param string $req
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isIgnored($req): bool
|
public function isIgnored(string $req): bool
|
||||||
{
|
{
|
||||||
if (!PlatformRepository::isPlatformPackage($req)) {
|
if (!PlatformRepository::isPlatformPackage($req)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +68,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
|
||||||
* @param string $req
|
* @param string $req
|
||||||
* @return ConstraintInterface
|
* @return ConstraintInterface
|
||||||
*/
|
*/
|
||||||
public function filterConstraint($req, ConstraintInterface $constraint): ConstraintInterface
|
public function filterConstraint(string $req, ConstraintInterface $constraint): ConstraintInterface
|
||||||
{
|
{
|
||||||
if (!PlatformRepository::isPlatformPackage($req)) {
|
if (!PlatformRepository::isPlatformPackage($req)) {
|
||||||
return $constraint;
|
return $constraint;
|
||||||
|
|
|
@ -18,7 +18,7 @@ final class IgnoreNothingPlatformRequirementFilter implements PlatformRequiremen
|
||||||
* @param string $req
|
* @param string $req
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
public function isIgnored($req): bool
|
public function isIgnored(string $req): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,5 @@ interface PlatformRequirementFilterInterface
|
||||||
* @param string $req
|
* @param string $req
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isIgnored($req): bool;
|
public function isIgnored(string $req): bool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ abstract class BaseIO implements IOInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
|
public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->write($messages, $newline, $verbosity);
|
$this->write($messages, $newline, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ abstract class BaseIO implements IOInterface
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
|
public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->writeError($messages, $newline, $verbosity);
|
$this->writeError($messages, $newline, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ abstract class BaseIO implements IOInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
|
protected function checkAndSetAuthentication(string $repositoryName, string $username, string $password = null)
|
||||||
{
|
{
|
||||||
if ($this->hasAuthentication($repositoryName)) {
|
if ($this->hasAuthentication($repositoryName)) {
|
||||||
$auth = $this->getAuthentication($repositoryName);
|
$auth = $this->getAuthentication($repositoryName);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class BufferIO extends ConsoleIO
|
||||||
* @param int $verbosity
|
* @param int $verbosity
|
||||||
* @param OutputFormatterInterface|null $formatter
|
* @param OutputFormatterInterface|null $formatter
|
||||||
*/
|
*/
|
||||||
public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
|
public function __construct(string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
|
||||||
{
|
{
|
||||||
$input = new StringInput($input);
|
$input = new StringInput($input);
|
||||||
$input->setInteractive(false);
|
$input->setInteractive(false);
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ConsoleIO extends BaseIO
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function enableDebugging($startTime)
|
public function enableDebugging(float $startTime)
|
||||||
{
|
{
|
||||||
$this->startTime = $startTime;
|
$this->startTime = $startTime;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function write($messages, $newline = true, $verbosity = self::NORMAL)
|
public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doWrite($messages, $newline, false, $verbosity);
|
$this->doWrite($messages, $newline, false, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
|
public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doWrite($messages, $newline, true, $verbosity);
|
$this->doWrite($messages, $newline, true, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
|
public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doWrite($messages, $newline, false, $verbosity, true);
|
$this->doWrite($messages, $newline, false, $verbosity, true);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
|
public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doWrite($messages, $newline, true, $verbosity, true);
|
$this->doWrite($messages, $newline, true, $verbosity, true);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ class ConsoleIO extends BaseIO
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false): void
|
private function doWrite($messages, bool $newline, bool $stderr, int $verbosity, bool $raw = false): void
|
||||||
{
|
{
|
||||||
$sfVerbosity = $this->verbosityMap[$verbosity];
|
$sfVerbosity = $this->verbosityMap[$verbosity];
|
||||||
if ($sfVerbosity > $this->output->getVerbosity()) {
|
if ($sfVerbosity > $this->output->getVerbosity()) {
|
||||||
|
@ -194,7 +194,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
|
public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doOverwrite($messages, $newline, $size, false, $verbosity);
|
$this->doOverwrite($messages, $newline, $size, false, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ class ConsoleIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
|
public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
|
||||||
{
|
{
|
||||||
$this->doOverwrite($messages, $newline, $size, true, $verbosity);
|
$this->doOverwrite($messages, $newline, $size, true, $verbosity);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ class ConsoleIO extends BaseIO
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function doOverwrite($messages, $newline, $size, $stderr, $verbosity): void
|
private function doOverwrite($messages, bool $newline, ?int $size, bool $stderr, int $verbosity): void
|
||||||
{
|
{
|
||||||
// messages can be an array, let's convert it to string anyway
|
// messages can be an array, let's convert it to string anyway
|
||||||
$messages = implode($newline ? "\n" : '', (array) $messages);
|
$messages = implode($newline ? "\n" : '', (array) $messages);
|
||||||
|
@ -258,7 +258,7 @@ class ConsoleIO extends BaseIO
|
||||||
* @param int $max
|
* @param int $max
|
||||||
* @return ProgressBar
|
* @return ProgressBar
|
||||||
*/
|
*/
|
||||||
public function getProgressBar($max = 0)
|
public function getProgressBar(int $max = 0)
|
||||||
{
|
{
|
||||||
return new ProgressBar($this->getErrorOutput(), $max);
|
return new ProgressBar($this->getErrorOutput(), $max);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function write($messages, $newline = true, $verbosity = self::NORMAL);
|
public function write($messages, bool $newline = true, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a message to the error output.
|
* Writes a message to the error output.
|
||||||
|
@ -83,7 +83,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
|
public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a message to the output, without formatting it.
|
* Writes a message to the output, without formatting it.
|
||||||
|
@ -94,7 +94,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL);
|
public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a message to the error output, without formatting it.
|
* Writes a message to the error output, without formatting it.
|
||||||
|
@ -105,7 +105,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL);
|
public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites a previous message to the output.
|
* Overwrites a previous message to the output.
|
||||||
|
@ -117,7 +117,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
|
public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites a previous message to the error output.
|
* Overwrites a previous message to the error output.
|
||||||
|
@ -129,7 +129,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
|
public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks a question to the user.
|
* Asks a question to the user.
|
||||||
|
@ -140,7 +140,7 @@ interface IOInterface extends LoggerInterface
|
||||||
* @throws \RuntimeException If there is no data to read in the input stream
|
* @throws \RuntimeException If there is no data to read in the input stream
|
||||||
* @return mixed The user answer
|
* @return mixed The user answer
|
||||||
*/
|
*/
|
||||||
public function ask($question, $default = null);
|
public function ask(string $question, $default = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks a confirmation to the user.
|
* Asks a confirmation to the user.
|
||||||
|
@ -152,7 +152,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return bool true if the user has confirmed, false otherwise
|
* @return bool true if the user has confirmed, false otherwise
|
||||||
*/
|
*/
|
||||||
public function askConfirmation($question, $default = true);
|
public function askConfirmation(string $question, bool $default = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks for a value and validates the response.
|
* Asks for a value and validates the response.
|
||||||
|
@ -169,7 +169,7 @@ interface IOInterface extends LoggerInterface
|
||||||
* @throws \Exception When any of the validators return an error
|
* @throws \Exception When any of the validators return an error
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function askAndValidate($question, $validator, $attempts = null, $default = null);
|
public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks a question to the user and hide the answer.
|
* Asks a question to the user and hide the answer.
|
||||||
|
@ -178,7 +178,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return string|null The answer
|
* @return string|null The answer
|
||||||
*/
|
*/
|
||||||
public function askAndHideAnswer($question);
|
public function askAndHideAnswer(string $question);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asks the user to select a value.
|
* Asks the user to select a value.
|
||||||
|
@ -193,7 +193,7 @@ interface IOInterface extends LoggerInterface
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return int|string|string[]|bool The selected value or values (the key of the choices array)
|
* @return int|string|string[]|bool The selected value or values (the key of the choices array)
|
||||||
*/
|
*/
|
||||||
public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
|
public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all authentication information entered.
|
* Get all authentication information entered.
|
||||||
|
@ -209,7 +209,7 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasAuthentication($repositoryName);
|
public function hasAuthentication(string $repositoryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username and password of repository.
|
* Get the username and password of repository.
|
||||||
|
@ -218,18 +218,18 @@ interface IOInterface extends LoggerInterface
|
||||||
*
|
*
|
||||||
* @return array{username: string|null, password: string|null}
|
* @return array{username: string|null, password: string|null}
|
||||||
*/
|
*/
|
||||||
public function getAuthentication($repositoryName);
|
public function getAuthentication(string $repositoryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the authentication information for the repository.
|
* Set the authentication information for the repository.
|
||||||
*
|
*
|
||||||
* @param string $repositoryName The unique name of repository
|
* @param string $repositoryName The unique name of repository
|
||||||
* @param string $username The username
|
* @param string $username The username
|
||||||
* @param ?string $password The password
|
* @param null|string $password The password
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setAuthentication($repositoryName, $username, $password = null);
|
public function setAuthentication(string $repositoryName, string $username, ?string $password = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads authentications from a config instance
|
* Loads authentications from a config instance
|
||||||
|
|
|
@ -62,28 +62,28 @@ class NullIO extends BaseIO
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function write($messages, $newline = true, $verbosity = self::NORMAL): void
|
public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function writeError($messages, $newline = true, $verbosity = self::NORMAL): void
|
public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL): void
|
public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL): void
|
public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ use Composer\Semver\VersionParser;
|
||||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||||
*
|
*
|
||||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||||
|
*
|
||||||
|
* @final
|
||||||
*/
|
*/
|
||||||
class InstalledVersions
|
class InstalledVersions
|
||||||
{
|
{
|
||||||
|
|
|
@ -386,7 +386,7 @@ class Installer
|
||||||
* @return int
|
* @return int
|
||||||
* @phpstan-return self::ERROR_*
|
* @phpstan-return self::ERROR_*
|
||||||
*/
|
*/
|
||||||
protected function doUpdate(InstalledRepositoryInterface $localRepo, $doInstall): int
|
protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
|
||||||
{
|
{
|
||||||
$platformRepo = $this->createPlatformRepo(true);
|
$platformRepo = $this->createPlatformRepo(true);
|
||||||
$aliases = $this->getRootAliases(true);
|
$aliases = $this->getRootAliases(true);
|
||||||
|
@ -648,7 +648,7 @@ class Installer
|
||||||
* @return int exit code
|
* @return int exit code
|
||||||
* @phpstan-return self::ERROR_*
|
* @phpstan-return self::ERROR_*
|
||||||
*/
|
*/
|
||||||
protected function doInstall(InstalledRepositoryInterface $localRepo, $alreadySolved = false): int
|
protected function doInstall(InstalledRepositoryInterface $localRepo, bool $alreadySolved = false): int
|
||||||
{
|
{
|
||||||
$this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
|
$this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @return PlatformRepository
|
* @return PlatformRepository
|
||||||
*/
|
*/
|
||||||
protected function createPlatformRepo($forUpdate): PlatformRepository
|
protected function createPlatformRepo(bool $forUpdate): PlatformRepository
|
||||||
{
|
{
|
||||||
if ($forUpdate) {
|
if ($forUpdate) {
|
||||||
$platformOverrides = $this->config->get('platform') ?: array();
|
$platformOverrides = $this->config->get('platform') ?: array();
|
||||||
|
@ -789,7 +789,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases
|
* @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases
|
||||||
*/
|
*/
|
||||||
private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null): RepositorySet
|
private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), ?RepositoryInterface $lockedRepository = null): RepositorySet
|
||||||
{
|
{
|
||||||
if ($forUpdate) {
|
if ($forUpdate) {
|
||||||
$minimumStability = $this->package->getMinimumStability();
|
$minimumStability = $this->package->getMinimumStability();
|
||||||
|
@ -858,7 +858,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @return DefaultPolicy
|
* @return DefaultPolicy
|
||||||
*/
|
*/
|
||||||
private function createPolicy($forUpdate): DefaultPolicy
|
private function createPolicy(bool $forUpdate): DefaultPolicy
|
||||||
{
|
{
|
||||||
$preferStable = null;
|
$preferStable = null;
|
||||||
$preferLowest = null;
|
$preferLowest = null;
|
||||||
|
@ -919,7 +919,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function requirePackagesForUpdate(Request $request, LockArrayRepository $lockedRepository = null, $includeDevRequires = true): void
|
private function requirePackagesForUpdate(Request $request, LockArrayRepository $lockedRepository = null, bool $includeDevRequires = true): void
|
||||||
{
|
{
|
||||||
// if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata
|
// if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata
|
||||||
if ($this->updateMirrors) {
|
if ($this->updateMirrors) {
|
||||||
|
@ -953,7 +953,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @phpstan-return list<array{package: string, version: string, alias: string, alias_normalized: string}>
|
* @phpstan-return list<array{package: string, version: string, alias: string, alias_normalized: string}>
|
||||||
*/
|
*/
|
||||||
private function getRootAliases($forUpdate): array
|
private function getRootAliases(bool $forUpdate): array
|
||||||
{
|
{
|
||||||
if ($forUpdate) {
|
if ($forUpdate) {
|
||||||
$aliases = $this->package->getAliases();
|
$aliases = $this->package->getAliases();
|
||||||
|
@ -1030,7 +1030,7 @@ class Installer
|
||||||
* @param Composer $composer
|
* @param Composer $composer
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public static function create(IOInterface $io, Composer $composer): Installer
|
public static function create(IOInterface $io, Composer $composer): self
|
||||||
{
|
{
|
||||||
return new static(
|
return new static(
|
||||||
$io,
|
$io,
|
||||||
|
@ -1049,7 +1049,7 @@ class Installer
|
||||||
* @param RepositoryInterface $additionalFixedRepository
|
* @param RepositoryInterface $additionalFixedRepository
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository)
|
public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
|
||||||
{
|
{
|
||||||
$this->additionalFixedRepository = $additionalFixedRepository;
|
$this->additionalFixedRepository = $additionalFixedRepository;
|
||||||
|
|
||||||
|
@ -1062,7 +1062,7 @@ class Installer
|
||||||
* @param bool $dryRun
|
* @param bool $dryRun
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setDryRun($dryRun = true): Installer
|
public function setDryRun(bool $dryRun = true): self
|
||||||
{
|
{
|
||||||
$this->dryRun = (bool) $dryRun;
|
$this->dryRun = (bool) $dryRun;
|
||||||
|
|
||||||
|
@ -1085,7 +1085,7 @@ class Installer
|
||||||
* @param bool $preferSource
|
* @param bool $preferSource
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setPreferSource($preferSource = true): Installer
|
public function setPreferSource(bool $preferSource = true): self
|
||||||
{
|
{
|
||||||
$this->preferSource = (bool) $preferSource;
|
$this->preferSource = (bool) $preferSource;
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ class Installer
|
||||||
* @param bool $preferDist
|
* @param bool $preferDist
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setPreferDist($preferDist = true): Installer
|
public function setPreferDist(bool $preferDist = true): self
|
||||||
{
|
{
|
||||||
$this->preferDist = (bool) $preferDist;
|
$this->preferDist = (bool) $preferDist;
|
||||||
|
|
||||||
|
@ -1111,7 +1111,7 @@ class Installer
|
||||||
* @param bool $optimizeAutoloader
|
* @param bool $optimizeAutoloader
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setOptimizeAutoloader($optimizeAutoloader): Installer
|
public function setOptimizeAutoloader(bool $optimizeAutoloader): self
|
||||||
{
|
{
|
||||||
$this->optimizeAutoloader = (bool) $optimizeAutoloader;
|
$this->optimizeAutoloader = (bool) $optimizeAutoloader;
|
||||||
if (!$this->optimizeAutoloader) {
|
if (!$this->optimizeAutoloader) {
|
||||||
|
@ -1130,7 +1130,7 @@ class Installer
|
||||||
* @param bool $classMapAuthoritative
|
* @param bool $classMapAuthoritative
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setClassMapAuthoritative($classMapAuthoritative): Installer
|
public function setClassMapAuthoritative(bool $classMapAuthoritative): self
|
||||||
{
|
{
|
||||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||||
if ($this->classMapAuthoritative) {
|
if ($this->classMapAuthoritative) {
|
||||||
|
@ -1148,7 +1148,7 @@ class Installer
|
||||||
* @param string|null $apcuAutoloaderPrefix
|
* @param string|null $apcuAutoloaderPrefix
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setApcuAutoloader($apcuAutoloader, $apcuAutoloaderPrefix = null): Installer
|
public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
|
||||||
{
|
{
|
||||||
$this->apcuAutoloader = $apcuAutoloader;
|
$this->apcuAutoloader = $apcuAutoloader;
|
||||||
$this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
|
$this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
|
||||||
|
@ -1162,7 +1162,7 @@ class Installer
|
||||||
* @param bool $update
|
* @param bool $update
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setUpdate($update): Installer
|
public function setUpdate(bool $update): self
|
||||||
{
|
{
|
||||||
$this->update = (bool) $update;
|
$this->update = (bool) $update;
|
||||||
|
|
||||||
|
@ -1175,7 +1175,7 @@ class Installer
|
||||||
* @param bool $install
|
* @param bool $install
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setInstall($install): Installer
|
public function setInstall(bool $install): self
|
||||||
{
|
{
|
||||||
$this->install = (bool) $install;
|
$this->install = (bool) $install;
|
||||||
|
|
||||||
|
@ -1188,7 +1188,7 @@ class Installer
|
||||||
* @param bool $devMode
|
* @param bool $devMode
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setDevMode($devMode = true): Installer
|
public function setDevMode(bool $devMode = true): self
|
||||||
{
|
{
|
||||||
$this->devMode = (bool) $devMode;
|
$this->devMode = (bool) $devMode;
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ class Installer
|
||||||
* @param bool $dumpAutoloader
|
* @param bool $dumpAutoloader
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setDumpAutoloader($dumpAutoloader = true): Installer
|
public function setDumpAutoloader(bool $dumpAutoloader = true): self
|
||||||
{
|
{
|
||||||
$this->dumpAutoloader = (bool) $dumpAutoloader;
|
$this->dumpAutoloader = (bool) $dumpAutoloader;
|
||||||
|
|
||||||
|
@ -1219,7 +1219,7 @@ class Installer
|
||||||
* @return Installer
|
* @return Installer
|
||||||
* @deprecated Use setRunScripts(false) on the EventDispatcher instance being injected instead
|
* @deprecated Use setRunScripts(false) on the EventDispatcher instance being injected instead
|
||||||
*/
|
*/
|
||||||
public function setRunScripts($runScripts = true): Installer
|
public function setRunScripts(bool $runScripts = true): self
|
||||||
{
|
{
|
||||||
$this->runScripts = (bool) $runScripts;
|
$this->runScripts = (bool) $runScripts;
|
||||||
|
|
||||||
|
@ -1232,7 +1232,7 @@ class Installer
|
||||||
* @param Config $config
|
* @param Config $config
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setConfig(Config $config): Installer
|
public function setConfig(Config $config): self
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
||||||
|
@ -1245,7 +1245,7 @@ class Installer
|
||||||
* @param bool $verbose
|
* @param bool $verbose
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setVerbose($verbose = true): Installer
|
public function setVerbose(bool $verbose = true): self
|
||||||
{
|
{
|
||||||
$this->verbose = (bool) $verbose;
|
$this->verbose = (bool) $verbose;
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @deprecated use setPlatformRequirementFilter instead
|
* @deprecated use setPlatformRequirementFilter instead
|
||||||
*/
|
*/
|
||||||
public function setIgnorePlatformRequirements($ignorePlatformReqs): Installer
|
public function setIgnorePlatformRequirements($ignorePlatformReqs): self
|
||||||
{
|
{
|
||||||
trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
|
trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
@ -1286,7 +1286,7 @@ class Installer
|
||||||
* @param PlatformRequirementFilterInterface $platformRequirementFilter
|
* @param PlatformRequirementFilterInterface $platformRequirementFilter
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): Installer
|
public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
|
||||||
{
|
{
|
||||||
$this->platformRequirementFilter = $platformRequirementFilter;
|
$this->platformRequirementFilter = $platformRequirementFilter;
|
||||||
|
|
||||||
|
@ -1299,7 +1299,7 @@ class Installer
|
||||||
* @param bool $updateMirrors
|
* @param bool $updateMirrors
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setUpdateMirrors($updateMirrors): Installer
|
public function setUpdateMirrors(bool $updateMirrors): self
|
||||||
{
|
{
|
||||||
$this->updateMirrors = $updateMirrors;
|
$this->updateMirrors = $updateMirrors;
|
||||||
|
|
||||||
|
@ -1314,7 +1314,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setUpdateAllowList(array $packages): Installer
|
public function setUpdateAllowList(array $packages): self
|
||||||
{
|
{
|
||||||
$this->updateAllowList = array_flip(array_map('strtolower', $packages));
|
$this->updateAllowList = array_flip(array_map('strtolower', $packages));
|
||||||
|
|
||||||
|
@ -1330,7 +1330,7 @@ class Installer
|
||||||
* @param int $updateAllowTransitiveDependencies One of the UPDATE_ constants on the Request class
|
* @param int $updateAllowTransitiveDependencies One of the UPDATE_ constants on the Request class
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies): Installer
|
public function setUpdateAllowTransitiveDependencies(int $updateAllowTransitiveDependencies): self
|
||||||
{
|
{
|
||||||
if (!in_array($updateAllowTransitiveDependencies, array(Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS), true)) {
|
if (!in_array($updateAllowTransitiveDependencies, array(Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS), true)) {
|
||||||
throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
|
throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
|
||||||
|
@ -1347,7 +1347,7 @@ class Installer
|
||||||
* @param bool $preferStable
|
* @param bool $preferStable
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setPreferStable($preferStable = true): Installer
|
public function setPreferStable(bool $preferStable = true): self
|
||||||
{
|
{
|
||||||
$this->preferStable = (bool) $preferStable;
|
$this->preferStable = (bool) $preferStable;
|
||||||
|
|
||||||
|
@ -1360,7 +1360,7 @@ class Installer
|
||||||
* @param bool $preferLowest
|
* @param bool $preferLowest
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setPreferLowest($preferLowest = true): Installer
|
public function setPreferLowest(bool $preferLowest = true): self
|
||||||
{
|
{
|
||||||
$this->preferLowest = (bool) $preferLowest;
|
$this->preferLowest = (bool) $preferLowest;
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ class Installer
|
||||||
* @param bool $writeLock
|
* @param bool $writeLock
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setWriteLock($writeLock = true): Installer
|
public function setWriteLock(bool $writeLock = true): self
|
||||||
{
|
{
|
||||||
$this->writeLock = (bool) $writeLock;
|
$this->writeLock = (bool) $writeLock;
|
||||||
|
|
||||||
|
@ -1390,7 +1390,7 @@ class Installer
|
||||||
* @param bool $executeOperations
|
* @param bool $executeOperations
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setExecuteOperations($executeOperations = true): Installer
|
public function setExecuteOperations(bool $executeOperations = true): self
|
||||||
{
|
{
|
||||||
$this->executeOperations = (bool) $executeOperations;
|
$this->executeOperations = (bool) $executeOperations;
|
||||||
|
|
||||||
|
@ -1406,7 +1406,7 @@ class Installer
|
||||||
*
|
*
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function disablePlugins(): Installer
|
public function disablePlugins(): self
|
||||||
{
|
{
|
||||||
$this->installationManager->disablePlugins();
|
$this->installationManager->disablePlugins();
|
||||||
|
|
||||||
|
@ -1417,7 +1417,7 @@ class Installer
|
||||||
* @param SuggestedPackagesReporter $suggestedPackagesReporter
|
* @param SuggestedPackagesReporter $suggestedPackagesReporter
|
||||||
* @return Installer
|
* @return Installer
|
||||||
*/
|
*/
|
||||||
public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): Installer
|
public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
|
||||||
{
|
{
|
||||||
$this->suggestedPackagesReporter = $suggestedPackagesReporter;
|
$this->suggestedPackagesReporter = $suggestedPackagesReporter;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class BinaryInstaller
|
||||||
* @param Filesystem $filesystem
|
* @param Filesystem $filesystem
|
||||||
* @param string|null $vendorDir
|
* @param string|null $vendorDir
|
||||||
*/
|
*/
|
||||||
public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null, $vendorDir = null)
|
public function __construct(IOInterface $io, string $binDir, string $binCompat, Filesystem $filesystem = null, ?string $vendorDir = null)
|
||||||
{
|
{
|
||||||
$this->binDir = $binDir;
|
$this->binDir = $binDir;
|
||||||
$this->binCompat = $binCompat;
|
$this->binCompat = $binCompat;
|
||||||
|
@ -62,7 +62,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true): void
|
public function installBinaries(PackageInterface $package, string $installPath, bool $warnOnOverwrite = true): void
|
||||||
{
|
{
|
||||||
$binaries = $this->getBinaries($package);
|
$binaries = $this->getBinaries($package);
|
||||||
if (!$binaries) {
|
if (!$binaries) {
|
||||||
|
@ -149,7 +149,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function determineBinaryCaller($bin): string
|
public static function determineBinaryCaller(string $bin): string
|
||||||
{
|
{
|
||||||
if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
|
if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
|
||||||
return 'call';
|
return 'call';
|
||||||
|
@ -180,7 +180,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package): void
|
protected function installFullBinaries(string $binPath, string $link, string $bin, PackageInterface $package): void
|
||||||
{
|
{
|
||||||
// add unixy support for cygwin and similar environments
|
// add unixy support for cygwin and similar environments
|
||||||
if ('.bat' !== substr($binPath, -4)) {
|
if ('.bat' !== substr($binPath, -4)) {
|
||||||
|
@ -202,7 +202,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function installUnixyProxyBinaries($binPath, $link): void
|
protected function installUnixyProxyBinaries(string $binPath, string $link): void
|
||||||
{
|
{
|
||||||
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
|
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
|
||||||
Silencer::call('chmod', $link, 0777 & ~umask());
|
Silencer::call('chmod', $link, 0777 & ~umask());
|
||||||
|
@ -223,7 +223,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function generateWindowsProxyCode($bin, $link): string
|
protected function generateWindowsProxyCode(string $bin, string $link): string
|
||||||
{
|
{
|
||||||
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
||||||
$caller = self::determineBinaryCaller($bin);
|
$caller = self::determineBinaryCaller($bin);
|
||||||
|
@ -252,7 +252,7 @@ class BinaryInstaller
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function generateUnixyProxyCode($bin, $link): string
|
protected function generateUnixyProxyCode(string $bin, string $link): string
|
||||||
{
|
{
|
||||||
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class InstallationManager
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function reset()
|
public function reset(): void
|
||||||
{
|
{
|
||||||
$this->notifiablePackages = array();
|
$this->notifiablePackages = array();
|
||||||
FileDownloader::$downloadMetadata = array();
|
FileDownloader::$downloadMetadata = array();
|
||||||
|
@ -76,7 +76,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addInstaller(InstallerInterface $installer)
|
public function addInstaller(InstallerInterface $installer): void
|
||||||
{
|
{
|
||||||
array_unshift($this->installers, $installer);
|
array_unshift($this->installers, $installer);
|
||||||
$this->cache = array();
|
$this->cache = array();
|
||||||
|
@ -89,7 +89,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function removeInstaller(InstallerInterface $installer)
|
public function removeInstaller(InstallerInterface $installer): void
|
||||||
{
|
{
|
||||||
if (false !== ($key = array_search($installer, $this->installers, true))) {
|
if (false !== ($key = array_search($installer, $this->installers, true))) {
|
||||||
array_splice($this->installers, $key, 1);
|
array_splice($this->installers, $key, 1);
|
||||||
|
@ -106,7 +106,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function disablePlugins()
|
public function disablePlugins(): void
|
||||||
{
|
{
|
||||||
foreach ($this->installers as $i => $installer) {
|
foreach ($this->installers as $i => $installer) {
|
||||||
if (!$installer instanceof PluginInstaller) {
|
if (!$installer instanceof PluginInstaller) {
|
||||||
|
@ -125,7 +125,7 @@ class InstallationManager
|
||||||
* @throws \InvalidArgumentException if installer for provided type is not registered
|
* @throws \InvalidArgumentException if installer for provided type is not registered
|
||||||
* @return InstallerInterface
|
* @return InstallerInterface
|
||||||
*/
|
*/
|
||||||
public function getInstaller($type)
|
public function getInstaller(string $type): InstallerInterface
|
||||||
{
|
{
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
|
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
|
||||||
{
|
{
|
||||||
if ($package instanceof AliasPackage) {
|
if ($package instanceof AliasPackage) {
|
||||||
return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
|
return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
|
||||||
|
@ -167,7 +167,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function ensureBinariesPresence(PackageInterface $package)
|
public function ensureBinariesPresence(PackageInterface $package): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
|
@ -192,7 +192,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function execute(InstalledRepositoryInterface $repo, array $operations, $devMode = true, $runScripts = true)
|
public function execute(InstalledRepositoryInterface $repo, array $operations, bool $devMode = true, bool $runScripts = true): void
|
||||||
{
|
{
|
||||||
/** @var PromiseInterface[] */
|
/** @var PromiseInterface[] */
|
||||||
$cleanupPromises = array();
|
$cleanupPromises = array();
|
||||||
|
@ -316,7 +316,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, $devMode, $runScripts, array $allOperations): void
|
private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
|
||||||
{
|
{
|
||||||
$promises = array();
|
$promises = array();
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts, array $allOperations): void
|
private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
|
||||||
{
|
{
|
||||||
$promises = array();
|
$promises = array();
|
||||||
$postExecCallbacks = array();
|
$postExecCallbacks = array();
|
||||||
|
@ -511,7 +511,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface|null
|
||||||
*/
|
*/
|
||||||
public function install(InstalledRepositoryInterface $repo, InstallOperation $operation)
|
public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
|
||||||
{
|
{
|
||||||
$package = $operation->getPackage();
|
$package = $operation->getPackage();
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
|
@ -529,7 +529,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface|null
|
||||||
*/
|
*/
|
||||||
public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation)
|
public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
|
||||||
{
|
{
|
||||||
$initial = $operation->getInitialPackage();
|
$initial = $operation->getInitialPackage();
|
||||||
$target = $operation->getTargetPackage();
|
$target = $operation->getTargetPackage();
|
||||||
|
@ -569,7 +569,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface|null
|
||||||
*/
|
*/
|
||||||
public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation)
|
public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
|
||||||
{
|
{
|
||||||
$package = $operation->getPackage();
|
$package = $operation->getPackage();
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
|
@ -585,7 +585,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation)
|
public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
|
||||||
{
|
{
|
||||||
$package = $operation->getPackage();
|
$package = $operation->getPackage();
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
|
public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
|
||||||
{
|
{
|
||||||
$package = $operation->getPackage();
|
$package = $operation->getPackage();
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ class InstallationManager
|
||||||
* @param PackageInterface $package
|
* @param PackageInterface $package
|
||||||
* @return string path
|
* @return string path
|
||||||
*/
|
*/
|
||||||
public function getInstallPath(PackageInterface $package)
|
public function getInstallPath(PackageInterface $package): string
|
||||||
{
|
{
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ class InstallationManager
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setOutputProgress($outputProgress)
|
public function setOutputProgress(bool $outputProgress): void
|
||||||
{
|
{
|
||||||
$this->outputProgress = $outputProgress;
|
$this->outputProgress = $outputProgress;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ class InstallationManager
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function notifyInstalls(IOInterface $io)
|
public function notifyInstalls(IOInterface $io): void
|
||||||
{
|
{
|
||||||
$promises = array();
|
$promises = array();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class InstallerEvent extends Event
|
||||||
* @param bool $executeOperations
|
* @param bool $executeOperations
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
*/
|
*/
|
||||||
public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, $executeOperations, Transaction $transaction)
|
public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, bool $executeOperations, Transaction $transaction)
|
||||||
{
|
{
|
||||||
parent::__construct($eventName);
|
parent::__construct($eventName);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class InstallerEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public function getComposer()
|
public function getComposer(): Composer
|
||||||
{
|
{
|
||||||
return $this->composer;
|
return $this->composer;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class InstallerEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return IOInterface
|
* @return IOInterface
|
||||||
*/
|
*/
|
||||||
public function getIO()
|
public function getIO(): IOInterface
|
||||||
{
|
{
|
||||||
return $this->io;
|
return $this->io;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class InstallerEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDevMode()
|
public function isDevMode(): bool
|
||||||
{
|
{
|
||||||
return $this->devMode;
|
return $this->devMode;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class InstallerEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isExecutingOperations()
|
public function isExecutingOperations(): bool
|
||||||
{
|
{
|
||||||
return $this->executeOperations;
|
return $this->executeOperations;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class InstallerEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return Transaction|null
|
* @return Transaction|null
|
||||||
*/
|
*/
|
||||||
public function getTransaction()
|
public function getTransaction(): ?Transaction
|
||||||
{
|
{
|
||||||
return $this->transaction;
|
return $this->transaction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ interface InstallerInterface
|
||||||
* @param string $packageType
|
* @param string $packageType
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function supports($packageType);
|
public function supports(string $packageType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that provided package is installed.
|
* Checks that provided package is installed.
|
||||||
|
@ -65,7 +65,7 @@ interface InstallerInterface
|
||||||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface|null
|
||||||
*/
|
*/
|
||||||
public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null);
|
public function prepare(string $type, PackageInterface $package, PackageInterface $prevPackage = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs specific package.
|
* Installs specific package.
|
||||||
|
@ -108,7 +108,7 @@ interface InstallerInterface
|
||||||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||||
* @return PromiseInterface|null
|
* @return PromiseInterface|null
|
||||||
*/
|
*/
|
||||||
public function cleanup($type, PackageInterface $package, PackageInterface $prevPackage = null);
|
public function cleanup(string $type, PackageInterface $package, PackageInterface $prevPackage = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the absolute installation path of a package.
|
* Returns the absolute installation path of a package.
|
||||||
|
|
|
@ -56,7 +56,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
|
||||||
* @param Filesystem $filesystem
|
* @param Filesystem $filesystem
|
||||||
* @param BinaryInstaller $binaryInstaller
|
* @param BinaryInstaller $binaryInstaller
|
||||||
*/
|
*/
|
||||||
public function __construct(IOInterface $io, PartialComposer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
|
public function __construct(IOInterface $io, PartialComposer $composer, ?string $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
|
||||||
{
|
{
|
||||||
$this->composer = $composer;
|
$this->composer = $composer;
|
||||||
$this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
|
$this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class PackageEvent extends Event
|
||||||
* @param OperationInterface[] $operations
|
* @param OperationInterface[] $operations
|
||||||
* @param OperationInterface $operation
|
* @param OperationInterface $operation
|
||||||
*/
|
*/
|
||||||
public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
|
public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
|
||||||
{
|
{
|
||||||
parent::__construct($eventName);
|
parent::__construct($eventName);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class PackageEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public function getComposer()
|
public function getComposer(): Composer
|
||||||
{
|
{
|
||||||
return $this->composer;
|
return $this->composer;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class PackageEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return IOInterface
|
* @return IOInterface
|
||||||
*/
|
*/
|
||||||
public function getIO()
|
public function getIO(): IOInterface
|
||||||
{
|
{
|
||||||
return $this->io;
|
return $this->io;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ class PackageEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDevMode()
|
public function isDevMode(): bool
|
||||||
{
|
{
|
||||||
return $this->devMode;
|
return $this->devMode;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class PackageEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return RepositoryInterface
|
* @return RepositoryInterface
|
||||||
*/
|
*/
|
||||||
public function getLocalRepo()
|
public function getLocalRepo(): RepositoryInterface
|
||||||
{
|
{
|
||||||
return $this->localRepo;
|
return $this->localRepo;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class PackageEvent extends Event
|
||||||
/**
|
/**
|
||||||
* @return OperationInterface[]
|
* @return OperationInterface[]
|
||||||
*/
|
*/
|
||||||
public function getOperations()
|
public function getOperations(): array
|
||||||
{
|
{
|
||||||
return $this->operations;
|
return $this->operations;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class PackageEvent extends Event
|
||||||
*
|
*
|
||||||
* @return OperationInterface
|
* @return OperationInterface
|
||||||
*/
|
*/
|
||||||
public function getOperation()
|
public function getOperation(): OperationInterface
|
||||||
{
|
{
|
||||||
return $this->operation;
|
return $this->operation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ProjectInstaller implements InstallerInterface
|
||||||
/**
|
/**
|
||||||
* @param string $installPath
|
* @param string $installPath
|
||||||
*/
|
*/
|
||||||
public function __construct($installPath, DownloadManager $dm, Filesystem $fs)
|
public function __construct(string $installPath, DownloadManager $dm, Filesystem $fs)
|
||||||
{
|
{
|
||||||
$this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
|
$this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
|
||||||
$this->downloadManager = $dm;
|
$this->downloadManager = $dm;
|
||||||
|
@ -49,7 +49,7 @@ class ProjectInstaller implements InstallerInterface
|
||||||
* @param string $packageType
|
* @param string $packageType
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function supports($packageType): bool
|
public function supports(string $packageType): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue