commit
b6c1afaa47
|
@ -16,8 +16,8 @@ $finder = PhpCsFixer\Finder::create()
|
|||
->in(__DIR__.'/tests')
|
||||
->name('*.php')
|
||||
->notPath('Fixtures')
|
||||
->notPath(__DIR__.'/src/Composer/Autoload/ClassLoader.php')
|
||||
->notPath(__DIR__.'/src/Composer/InstalledVersions.php')
|
||||
->notPath('Composer/Autoload/ClassLoader.php')
|
||||
->notPath('Composer/InstalledVersions.php')
|
||||
;
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
|
@ -70,7 +70,11 @@ return $config->setRules([
|
|||
'combine_nested_dirname' => true,
|
||||
'random_api_migration' => true,
|
||||
'ternary_to_null_coalescing' => true,
|
||||
'phpdoc_to_param_type' => true,
|
||||
//'declare_strict_types' => true,
|
||||
|
||||
// TODO php 7.4 migration (one day..)
|
||||
// 'phpdoc_to_property_type' => true,
|
||||
])
|
||||
->setUsingCache(true)
|
||||
->setRiskyAllowed(true)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<?php
|
||||
|
||||
$cwd = getcwd();
|
||||
assert(is_string($cwd));
|
||||
chdir(__DIR__.'/../');
|
||||
$ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD'));
|
||||
if (!is_numeric($ts)) {
|
||||
|
|
|
@ -117,7 +117,7 @@ parameters:
|
|||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
||||
|
||||
-
|
||||
|
@ -127,7 +127,7 @@ parameters:
|
|||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../src/Composer/Autoload/AutoloadGenerator.php
|
||||
|
||||
-
|
||||
|
@ -240,16 +240,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -325,11 +315,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -395,11 +380,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -470,11 +450,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -485,11 +460,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -515,21 +485,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -600,11 +555,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -795,11 +745,6 @@ parameters:
|
|||
count: 8
|
||||
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\\.$#"
|
||||
count: 3
|
||||
|
@ -830,16 +775,6 @@ parameters:
|
|||
count: 3
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -875,11 +810,6 @@ parameters:
|
|||
count: 4
|
||||
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\\.$#"
|
||||
count: 3
|
||||
|
@ -940,11 +870,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1130,11 +1055,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1145,11 +1065,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1180,11 +1095,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1455,21 +1365,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -1505,21 +1400,6 @@ parameters:
|
|||
count: 3
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1710,11 +1590,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -1745,21 +1620,11 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -1820,21 +1685,11 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -2340,11 +2195,6 @@ parameters:
|
|||
count: 4
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -2725,11 +2575,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 3
|
||||
|
@ -2745,11 +2590,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -2990,11 +2830,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
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\\.$#"
|
||||
count: 5
|
||||
count: 3
|
||||
path: ../src/Composer/Factory.php
|
||||
|
||||
-
|
||||
|
@ -3625,21 +3460,11 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -3700,11 +3525,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -3786,23 +3606,18 @@ parameters:
|
|||
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
|
||||
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\\(\\)$#"
|
||||
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\\.$#"
|
||||
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: "#^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
|
||||
|
||||
-
|
||||
|
@ -4080,11 +3895,6 @@ parameters:
|
|||
count: 1
|
||||
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\\>\\.$#"
|
||||
count: 1
|
||||
|
@ -4115,11 +3925,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -4137,7 +3942,7 @@ parameters:
|
|||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, Composer\\\\Repository\\\\InstalledRepositoryInterface\\|null given\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../src/Composer/Plugin/PluginManager.php
|
||||
|
||||
-
|
||||
|
@ -4475,11 +4280,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -4647,7 +4447,7 @@ parameters:
|
|||
|
||||
-
|
||||
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
|
||||
|
||||
-
|
||||
|
@ -4670,11 +4470,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -4790,11 +4585,6 @@ parameters:
|
|||
count: 10
|
||||
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\\>\\.$#"
|
||||
count: 1
|
||||
|
@ -4915,11 +4705,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -4992,7 +4777,7 @@ parameters:
|
|||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 2
|
||||
count: 1
|
||||
path: ../src/Composer/Repository/Vcs/GitLabDriver.php
|
||||
|
||||
-
|
||||
|
@ -5170,11 +4955,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -5220,11 +5000,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -5460,11 +5235,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 4
|
||||
|
@ -5885,11 +5655,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -5985,11 +5750,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -6115,11 +5875,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -6415,16 +6170,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -6595,11 +6340,6 @@ parameters:
|
|||
count: 3
|
||||
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\\(\\)\\.$#"
|
||||
count: 1
|
||||
|
@ -6650,16 +6390,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 3
|
||||
|
@ -6700,11 +6430,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -6775,26 +6500,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -6805,36 +6510,6 @@ parameters:
|
|||
count: 8
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -6850,11 +6525,6 @@ parameters:
|
|||
count: 6
|
||||
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\\.$#"
|
||||
count: 3
|
||||
|
@ -6905,21 +6575,11 @@ parameters:
|
|||
count: 1
|
||||
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\\(\\)\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 2
|
||||
|
@ -6930,11 +6590,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -6988,21 +6643,11 @@ parameters:
|
|||
count: 1
|
||||
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\\(\\)\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -7083,11 +6728,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 5
|
||||
|
@ -7113,16 +6753,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -7173,11 +6803,6 @@ parameters:
|
|||
count: 2
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -7198,61 +6823,31 @@ parameters:
|
|||
count: 1
|
||||
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\\(\\)\\.$#"
|
||||
count: 1
|
||||
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\\(\\)\\.$#"
|
||||
count: 2
|
||||
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\\.$#"
|
||||
count: 2
|
||||
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\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
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\\.$#"
|
||||
count: 2
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
|
||||
|
||||
-
|
||||
|
@ -7353,16 +6948,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -7388,34 +6973,14 @@ parameters:
|
|||
count: 1
|
||||
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\\(\\)\\.$#"
|
||||
count: 1
|
||||
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\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../tests/Composer/Test/Repository/PathRepositoryTest.php
|
||||
|
||||
-
|
||||
|
@ -7523,21 +7088,6 @@ parameters:
|
|||
count: 1
|
||||
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\\.$#"
|
||||
count: 1
|
||||
|
@ -7575,7 +7125,7 @@ parameters:
|
|||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, string given\\.$#"
|
||||
count: 2
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/Http/ProxyManagerTest.php
|
||||
|
||||
-
|
||||
|
|
|
@ -89,7 +89,7 @@ class AutoloadGenerator
|
|||
* @param bool $devMode
|
||||
* @return void
|
||||
*/
|
||||
public function setDevMode($devMode = true)
|
||||
public function setDevMode(bool $devMode = true)
|
||||
{
|
||||
$this->devMode = (bool) $devMode;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class AutoloadGenerator
|
|||
* @param bool $classMapAuthoritative
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
public function setClassMapAuthoritative(bool $classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class AutoloadGenerator
|
|||
* @param string|null $apcuPrefix
|
||||
* @return void
|
||||
*/
|
||||
public function setApcu($apcu, $apcuPrefix = null)
|
||||
public function setApcu(bool $apcu, ?string $apcuPrefix = null)
|
||||
{
|
||||
$this->apcu = (bool) $apcu;
|
||||
$this->apcuPrefix = $apcuPrefix !== null ? (string) $apcuPrefix : $apcuPrefix;
|
||||
|
@ -124,7 +124,7 @@ class AutoloadGenerator
|
|||
* @param bool $runScripts
|
||||
* @return void
|
||||
*/
|
||||
public function setRunScripts($runScripts = true)
|
||||
public function setRunScripts(bool $runScripts = true)
|
||||
{
|
||||
$this->runScripts = (bool) $runScripts;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class AutoloadGenerator
|
|||
* @return int
|
||||
* @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) {
|
||||
// Force scanPsrPackages when classmap is authoritative
|
||||
|
@ -200,7 +200,7 @@ class AutoloadGenerator
|
|||
// Do not remove double realpath() calls.
|
||||
// Fixes failing Windows realpath() implementation.
|
||||
// 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'))));
|
||||
$useGlobalIncludePath = (bool) $config->get('use-include-path');
|
||||
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
|
||||
|
@ -433,15 +433,15 @@ EOF;
|
|||
* @param string $basePath
|
||||
* @param string $vendorPath
|
||||
* @param string $dir
|
||||
* @param ?array<int, string> $excluded
|
||||
* @param ?string $namespaceFilter
|
||||
* @param ?string $autoloadType
|
||||
* @param null|array<int, string> $excluded
|
||||
* @param null|string $namespaceFilter
|
||||
* @param null|string $autoloadType
|
||||
* @param array<class-string, string> $classMap
|
||||
* @param array<class-string, array<int, string>> $ambiguousClasses
|
||||
* @param array<string, true> $scannedFiles
|
||||
* @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) {
|
||||
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
|
||||
|
@ -457,14 +457,14 @@ EOF;
|
|||
|
||||
/**
|
||||
* @param string $dir
|
||||
* @param ?array<int, string> $excluded
|
||||
* @param ?string $namespaceFilter
|
||||
* @param ?string $autoloadType
|
||||
* @param null|array<int, string> $excluded
|
||||
* @param null|string $namespaceFilter
|
||||
* @param null|string $autoloadType
|
||||
* @param bool $showAmbiguousWarning
|
||||
* @param array<string, true> $scannedFiles
|
||||
* @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) {
|
||||
// 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
|
||||
*
|
||||
* @param array<string, mixed[]> $autoloads see parseAutoloads return value
|
||||
* @param ?string $vendorDir
|
||||
* @param null|string $vendorDir
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public function createLoader(array $autoloads, $vendorDir = null)
|
||||
public function createLoader(array $autoloads, ?string $vendorDir = null)
|
||||
{
|
||||
$loader = new ClassLoader($vendorDir);
|
||||
|
||||
|
@ -632,7 +632,7 @@ EOF;
|
|||
* @param string $appBaseDirCode
|
||||
* @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();
|
||||
|
||||
|
@ -680,7 +680,7 @@ EOF;
|
|||
* @param string $appBaseDirCode
|
||||
* @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 = '';
|
||||
foreach ($files as $fileIdentifier => $functionFile) {
|
||||
|
@ -712,7 +712,7 @@ EOF;
|
|||
* @param string $path
|
||||
* @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)) {
|
||||
$path = $basePath . '/' . $path;
|
||||
|
@ -748,7 +748,7 @@ EOF;
|
|||
* @param string[] $devPackageNames
|
||||
* @return ?string
|
||||
*/
|
||||
protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
|
||||
protected function getPlatformCheck(array $packageMap, bool $checkPlatform, array $devPackageNames)
|
||||
{
|
||||
$lowestPhpVersion = Bound::zero();
|
||||
$requiredExtensions = array();
|
||||
|
@ -906,7 +906,7 @@ PLATFORM_CHECK;
|
|||
* @param string $suffix
|
||||
* @return string
|
||||
*/
|
||||
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
|
||||
protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
|
||||
{
|
||||
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
||||
if ("'" === $lastChar || '"' === $lastChar) {
|
||||
|
@ -930,7 +930,7 @@ AUTOLOAD;
|
|||
/**
|
||||
* @param bool $useClassMap
|
||||
* @param bool $useIncludePath
|
||||
* @param ?string $targetDirLoader
|
||||
* @param null|string $targetDirLoader
|
||||
* @param bool $useIncludeFiles
|
||||
* @param string $vendorPathCode unused in this method
|
||||
* @param string $appBaseDirCode unused in this method
|
||||
|
@ -940,7 +940,7 @@ AUTOLOAD;
|
|||
* @param bool $checkPlatform
|
||||
* @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
|
||||
<?php
|
||||
|
@ -1092,7 +1092,7 @@ FOOTER;
|
|||
* @param string $basePath input for findShortestPathCode
|
||||
* @return string
|
||||
*/
|
||||
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath)
|
||||
protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
|
||||
{
|
||||
$file = <<<HEADER
|
||||
<?php
|
||||
|
@ -1185,7 +1185,7 @@ INITIALIZER;
|
|||
* @param string $type one of: 'psr-0'|'psr-4'|'classmap'|'files'
|
||||
* @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();
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ INITIALIZER;
|
|||
$path
|
||||
);
|
||||
if (empty($installPath)) {
|
||||
$installPath = strtr(getcwd(), '\\', '/');
|
||||
$installPath = strtr(Platform::getCwd(), '\\', '/');
|
||||
}
|
||||
|
||||
$resolvedPath = realpath($installPath . '/' . $updir);
|
||||
|
@ -1271,7 +1271,7 @@ INITIALIZER;
|
|||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
protected function getFileIdentifier(PackageInterface $package, $path)
|
||||
protected function getFileIdentifier(PackageInterface $package, string $path)
|
||||
{
|
||||
return md5($package->getName() . ':' . $path);
|
||||
}
|
||||
|
@ -1364,12 +1364,7 @@ INITIALIZER;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileIdentifier
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire($fileIdentifier, $file)
|
||||
function composerRequire(string $fileIdentifier, string $file): void
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
namespace Composer\Autoload;
|
||||
|
||||
use Composer\Pcre\Preg;
|
||||
use Composer\Util\Platform;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
|
@ -38,7 +39,7 @@ class ClassMapGenerator
|
|||
* @param string $file The name of the class map file
|
||||
* @return void
|
||||
*/
|
||||
public static function dump($dirs, $file): void
|
||||
public static function dump(iterable $dirs, string $file): void
|
||||
{
|
||||
$maps = array();
|
||||
|
||||
|
@ -55,13 +56,13 @@ class ClassMapGenerator
|
|||
* @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 ?IOInterface $io IO object
|
||||
* @param ?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 $namespace Optional namespace prefix to filter by
|
||||
* @param null|string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
|
||||
* @param array<string, true> $scannedFiles
|
||||
* @return array<class-string, string> A class map array
|
||||
* @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;
|
||||
if (is_string($path)) {
|
||||
|
@ -81,7 +82,7 @@ class ClassMapGenerator
|
|||
|
||||
$map = array();
|
||||
$filesystem = new Filesystem();
|
||||
$cwd = realpath(getcwd());
|
||||
$cwd = realpath(Platform::getCwd());
|
||||
|
||||
foreach ($path as $file) {
|
||||
$filePath = $file->getPathname();
|
||||
|
@ -157,7 +158,7 @@ class ClassMapGenerator
|
|||
* @param ?IOInterface $io IO object
|
||||
* @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();
|
||||
$rejectedClasses = array();
|
||||
|
@ -198,7 +199,7 @@ class ClassMapGenerator
|
|||
if (empty($validClasses)) {
|
||||
foreach ($rejectedClasses as $class) {
|
||||
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
|
||||
* @return array<int, class-string> The found classes
|
||||
*/
|
||||
private static function findClasses($path): array
|
||||
private static function findClasses(string $path): array
|
||||
{
|
||||
$extraTypes = self::getExtraTypes();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class PhpFileCleaner
|
|||
* @param string[] $types
|
||||
* @return void
|
||||
*/
|
||||
public static function setTypeConfig($types): void
|
||||
public static function setTypeConfig(array $types): void
|
||||
{
|
||||
foreach ($types as $type) {
|
||||
self::$typeConfig[$type[0]] = array(
|
||||
|
@ -68,7 +68,7 @@ class PhpFileCleaner
|
|||
* @param string $contents
|
||||
* @param int $maxMatches
|
||||
*/
|
||||
public function __construct($contents, $maxMatches)
|
||||
public function __construct(string $contents, int $maxMatches)
|
||||
{
|
||||
$this->contents = $contents;
|
||||
$this->len = \strlen($this->contents);
|
||||
|
@ -168,7 +168,7 @@ class PhpFileCleaner
|
|||
* @param string $delimiter
|
||||
* @return void
|
||||
*/
|
||||
private function skipString($delimiter): void
|
||||
private function skipString(string $delimiter): void
|
||||
{
|
||||
$this->index += 1;
|
||||
while ($this->index < $this->len) {
|
||||
|
@ -217,7 +217,7 @@ class PhpFileCleaner
|
|||
* @param string $delimiter
|
||||
* @return void
|
||||
*/
|
||||
private function skipHeredoc($delimiter): void
|
||||
private function skipHeredoc(string $delimiter): void
|
||||
{
|
||||
$firstDelimiterChar = $delimiter[0];
|
||||
$delimiterLength = \strlen($delimiter);
|
||||
|
@ -260,14 +260,14 @@ class PhpFileCleaner
|
|||
* @param string $char
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $regex
|
||||
* @param ?array<int, string> $match
|
||||
* @param null|array<int, string> $match
|
||||
* @return bool
|
||||
*/
|
||||
private function match($regex, array &$match = null): bool
|
||||
|
|
|
@ -48,7 +48,7 @@ class Cache
|
|||
* @param Filesystem $filesystem optional filesystem instance
|
||||
* @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->root = rtrim($cacheDir, '/\\') . '/';
|
||||
|
@ -66,7 +66,7 @@ class Cache
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setReadOnly($readOnly)
|
||||
public function setReadOnly(bool $readOnly)
|
||||
{
|
||||
$this->readOnly = (bool) $readOnly;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isUsable($path)
|
||||
public static function isUsable(string $path)
|
||||
{
|
||||
return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class Cache
|
|||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function read($file)
|
||||
public function read(string $file)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -142,7 +142,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write($file, $contents)
|
||||
public function write(string $file, string $contents)
|
||||
{
|
||||
if ($this->isEnabled() && !$this->readOnly) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -186,7 +186,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function copyFrom($file, $source)
|
||||
public function copyFrom(string $file, string $source)
|
||||
{
|
||||
if ($this->isEnabled() && !$this->readOnly) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -212,7 +212,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function copyTo($file, $target)
|
||||
public function copyTo(string $file, string $target)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -256,7 +256,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function remove($file)
|
||||
public function remove(string $file)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -287,7 +287,7 @@ class Cache
|
|||
* @return int|false
|
||||
* @phpstan-return int<0, max>|false
|
||||
*/
|
||||
public function getAge($file)
|
||||
public function getAge(string $file)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -305,7 +305,7 @@ class Cache
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function gc($ttl, $maxSize)
|
||||
public function gc(int $ttl, int $maxSize)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$expire = new \DateTime();
|
||||
|
@ -340,7 +340,7 @@ class Cache
|
|||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function sha1($file)
|
||||
public function sha1(string $file)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
@ -357,7 +357,7 @@ class Cache
|
|||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function sha256($file)
|
||||
public function sha256(string $file)
|
||||
{
|
||||
if ($this->isEnabled()) {
|
||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||
|
|
|
@ -25,6 +25,7 @@ use Composer\Plugin\CommandEvent;
|
|||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Loop;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -136,7 +137,7 @@ EOT
|
|||
$io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
|
||||
$packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
|
||||
$fs = new Filesystem;
|
||||
$shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
|
||||
$shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
|
||||
|
||||
$io->writeError('Created: ', false);
|
||||
$io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
|
||||
|
@ -150,7 +151,7 @@ EOT
|
|||
*
|
||||
* @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>');
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ abstract class BaseCommand extends Command
|
|||
* @return Composer|null
|
||||
* @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) {
|
||||
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
|
||||
*/
|
||||
protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
|
||||
protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
|
||||
{
|
||||
$preferSource = false;
|
||||
$preferDist = false;
|
||||
|
|
|
@ -50,7 +50,7 @@ class BaseDependencyCommand extends BaseCommand
|
|||
* @param bool $inverted Whether to invert matching process (why-not vs why behaviour)
|
||||
* @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
|
||||
$composer = $this->requireComposer();
|
||||
|
@ -197,7 +197,7 @@ class BaseDependencyCommand extends BaseCommand
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function printTree($results, $prefix = '', $level = 1): void
|
||||
protected function printTree(array $results, string $prefix = '', int $level = 1): void
|
||||
{
|
||||
$count = count($results);
|
||||
$idx = 0;
|
||||
|
@ -223,7 +223,7 @@ class BaseDependencyCommand extends BaseCommand
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function writeTreeLine($line): void
|
||||
private function writeTreeLine(string $line): void
|
||||
{
|
||||
$io = $this->getIO();
|
||||
if (!$io->isDecorated()) {
|
||||
|
|
|
@ -174,7 +174,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function printTable(OutputInterface $output, $results): void
|
||||
protected function printTable(OutputInterface $output, array $results): void
|
||||
{
|
||||
$rows = array();
|
||||
foreach ($results as $result) {
|
||||
|
|
|
@ -175,7 +175,7 @@ EOT
|
|||
if (
|
||||
($configFile === 'composer.json' || $configFile === './composer.json')
|
||||
&& !file_exists($configFile)
|
||||
&& realpath(getcwd()) === realpath($this->config->get('home'))
|
||||
&& realpath(Platform::getCwd()) === realpath($this->config->get('home'))
|
||||
) {
|
||||
file_put_contents($configFile, "{\n}\n");
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ EOT
|
|||
*
|
||||
* @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;
|
||||
if (1 !== count($values)) {
|
||||
|
@ -845,7 +845,7 @@ EOT
|
|||
*
|
||||
* @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;
|
||||
if (true !== $validation = $validator($values)) {
|
||||
|
@ -868,7 +868,7 @@ EOT
|
|||
*
|
||||
* @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;
|
||||
$io = $this->getIO();
|
||||
|
|
|
@ -187,9 +187,9 @@ EOT
|
|||
* @return int
|
||||
* @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)) {
|
||||
$repositories = (array) $repositories;
|
||||
|
@ -284,7 +284,7 @@ EOT
|
|||
)
|
||||
) {
|
||||
$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) {
|
||||
$finder->name($vcsName);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ EOT
|
|||
* @return bool
|
||||
* @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) {
|
||||
$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 (null === $directory) {
|
||||
$parts = explode("/", $name, 2);
|
||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||
$directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||
}
|
||||
|
||||
$process = new ProcessExecutor($io);
|
||||
$fs = new Filesystem($process);
|
||||
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 (!is_dir($directory)) {
|
||||
|
|
|
@ -52,7 +52,7 @@ class DiagnoseCommand extends BaseCommand
|
|||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setName('diagnose')
|
||||
|
@ -245,7 +245,7 @@ EOT
|
|||
*
|
||||
* @return string|string[]|true
|
||||
*/
|
||||
private function checkHttp($proto, Config $config)
|
||||
private function checkHttp(string $proto, Config $config)
|
||||
{
|
||||
$result = $this->checkConnectivity();
|
||||
if ($result !== true) {
|
||||
|
@ -315,7 +315,7 @@ EOT
|
|||
*
|
||||
* @return string|true|\Exception
|
||||
*/
|
||||
private function checkGithubOauth($domain, $token)
|
||||
private function checkGithubOauth(string $domain, string $token)
|
||||
{
|
||||
$result = $this->checkConnectivity();
|
||||
if ($result !== true) {
|
||||
|
@ -346,7 +346,7 @@ EOT
|
|||
* @throws TransportException
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function getGithubRateLimit($domain, $token = null)
|
||||
private function getGithubRateLimit(string $domain, string $token = null)
|
||||
{
|
||||
$result = $this->checkConnectivity();
|
||||
if ($result !== true) {
|
||||
|
|
|
@ -95,7 +95,7 @@ EOT
|
|||
// 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
|
||||
// not the global one
|
||||
if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
|
||||
if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
|
||||
try {
|
||||
chdir($this->getApplication()->getInitialWorkingDirectory());
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
@ -101,7 +101,7 @@ EOT
|
|||
* @param bool $showOnly
|
||||
* @return bool
|
||||
*/
|
||||
private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly): bool
|
||||
private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
|
||||
{
|
||||
$support = $package->getSupport();
|
||||
$url = $support['source'] ?? $package->getSourceUrl();
|
||||
|
@ -128,7 +128,7 @@ EOT
|
|||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
private function openBrowser($url): void
|
||||
private function openBrowser(string $url): void
|
||||
{
|
||||
$url = ProcessExecutor::escape($url);
|
||||
|
||||
|
|
|
@ -456,11 +456,10 @@ EOT
|
|||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param string $author
|
||||
* @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)) {
|
||||
$hasEmail = isset($match['email']) && '' !== $match['email'];
|
||||
|
@ -485,7 +484,7 @@ EOT
|
|||
*
|
||||
* @return array<int, array{name: string, email?: string}>
|
||||
*/
|
||||
protected function formatAuthors($author)
|
||||
protected function formatAuthors(string $author): array
|
||||
{
|
||||
$author = $this->parseAuthorString($author);
|
||||
if (null === $author['email']) {
|
||||
|
@ -504,7 +503,7 @@ EOT
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function namespaceFromPackageName($packageName)
|
||||
public function namespaceFromPackageName(string $packageName): ?string
|
||||
{
|
||||
if (!$packageName || strpos($packageName, '/') === false) {
|
||||
return null;
|
||||
|
@ -526,7 +525,7 @@ EOT
|
|||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function getGitConfig()
|
||||
protected function getGitConfig(): array
|
||||
{
|
||||
if (null !== $this->gitConfig) {
|
||||
return $this->gitConfig;
|
||||
|
@ -567,7 +566,7 @@ EOT
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
|
||||
protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
|
||||
{
|
||||
if (!file_exists($ignoreFile)) {
|
||||
return false;
|
||||
|
@ -591,7 +590,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
|
||||
protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
|
||||
{
|
||||
$contents = "";
|
||||
if (file_exists($ignoreFile)) {
|
||||
|
@ -610,7 +609,7 @@ EOT
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isValidEmail($email)
|
||||
protected function isValidEmail(string $email): bool
|
||||
{
|
||||
// assume it's valid if we can't validate it
|
||||
if (!function_exists('filter_var')) {
|
||||
|
@ -652,7 +651,7 @@ EOT
|
|||
* @param array<string, string|array<string>> $options
|
||||
* @return bool
|
||||
*/
|
||||
private function hasDependencies($options): bool
|
||||
private function hasDependencies(array $options): bool
|
||||
{
|
||||
$requires = (array) $options['require'];
|
||||
$devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
|
||||
|
|
|
@ -163,7 +163,7 @@ EOT
|
|||
* @param array<string, PackageInterface> $bucket
|
||||
* @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());
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ EOT
|
|||
* @param string $requireKey
|
||||
* @return string[]
|
||||
*/
|
||||
private function getInconsistentRequireKeys(array $newRequirements, $requireKey): array
|
||||
private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
|
||||
{
|
||||
$requireKeys = $this->getPackagesByRequireKey();
|
||||
$inconsistentRequirements = array();
|
||||
|
@ -335,15 +335,6 @@ EOT
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @return void
|
||||
*/
|
||||
public function markSolverComplete()
|
||||
{
|
||||
$this->dependencyResolutionCompleted = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $requirements
|
||||
* @param string $requireKey
|
||||
|
@ -351,14 +342,16 @@ EOT
|
|||
* @return int
|
||||
* @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
|
||||
$this->resetComposer();
|
||||
$composer = $this->requireComposer();
|
||||
|
||||
$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')) {
|
||||
$rootPackage = $composer->getPackage();
|
||||
|
@ -449,7 +442,7 @@ EOT
|
|||
* @param bool $sortPackages
|
||||
* @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());
|
||||
|
||||
|
@ -480,7 +473,7 @@ EOT
|
|||
* @param bool $hardExit
|
||||
* @return void
|
||||
*/
|
||||
public function revertComposerFile($hardExit = true)
|
||||
public function revertComposerFile(bool $hardExit = true): void
|
||||
{
|
||||
$io = $this->getIO();
|
||||
|
||||
|
|
|
@ -27,14 +27,10 @@ class ScriptAliasCommand extends BaseCommand
|
|||
/** @var string */
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @param string $script
|
||||
* @param string $description
|
||||
*/
|
||||
public function __construct($script, $description)
|
||||
public function __construct(string $script, ?string $description)
|
||||
{
|
||||
$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();
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ TAGSPUBKEY
|
|||
* @return int
|
||||
* @throws FilesystemException
|
||||
*/
|
||||
protected function rollback(OutputInterface $output, $rollbackDir, $localFilename): int
|
||||
protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
|
||||
{
|
||||
$rollbackVersion = $this->getLastBackupVersion($rollbackDir);
|
||||
if (!$rollbackVersion) {
|
||||
|
@ -431,7 +431,7 @@ TAGSPUBKEY
|
|||
* @throws FilesystemException If the file cannot be 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();
|
||||
@chmod($newFilename, fileperms($localFilename));
|
||||
|
@ -483,7 +483,7 @@ TAGSPUBKEY
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function cleanBackups($rollbackDir, $except = null): void
|
||||
protected function cleanBackups(string $rollbackDir, ?string $except = null): void
|
||||
{
|
||||
$finder = $this->getOldInstallationFinder($rollbackDir);
|
||||
$io = $this->getIO();
|
||||
|
@ -503,7 +503,7 @@ TAGSPUBKEY
|
|||
* @param string $rollbackDir
|
||||
* @return string|false
|
||||
*/
|
||||
protected function getLastBackupVersion($rollbackDir)
|
||||
protected function getLastBackupVersion(string $rollbackDir)
|
||||
{
|
||||
$finder = $this->getOldInstallationFinder($rollbackDir);
|
||||
$finder->sortByName();
|
||||
|
@ -520,7 +520,7 @@ TAGSPUBKEY
|
|||
* @param string $rollbackDir
|
||||
* @return Finder
|
||||
*/
|
||||
protected function getOldInstallationFinder($rollbackDir): Finder
|
||||
protected function getOldInstallationFinder(string $rollbackDir): Finder
|
||||
{
|
||||
return Finder::create()
|
||||
->depth(0)
|
||||
|
@ -541,7 +541,7 @@ TAGSPUBKEY
|
|||
* @throws \Exception
|
||||
* @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')) {
|
||||
return true;
|
||||
|
@ -590,7 +590,7 @@ TAGSPUBKEY
|
|||
* @param string $newFilename The downloaded or backup phar
|
||||
* @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();
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ EOT
|
|||
|
||||
if ($input->getOption('no-dev')) {
|
||||
$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;
|
||||
}, $packages))));
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ EOT
|
|||
if (
|
||||
$input->getOption('outdated')
|
||||
&& $input->getOption('strict')
|
||||
&& $latestPackage
|
||||
&& null !== $latestPackage
|
||||
&& $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
|
||||
&& (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
|
||||
) {
|
||||
|
@ -415,7 +415,7 @@ EOT
|
|||
foreach ($packages[$type] as $package) {
|
||||
if (is_object($package)) {
|
||||
$latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMinorOnly, $platformReqFilter);
|
||||
if ($latestPackage === false) {
|
||||
if ($latestPackage === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -602,7 +602,7 @@ EOT
|
|||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getRootRequires()
|
||||
protected function getRootRequires(): array
|
||||
{
|
||||
$rootPackage = $this->requireComposer()->getPackage();
|
||||
|
||||
|
@ -628,7 +628,7 @@ EOT
|
|||
* @throws \InvalidArgumentException
|
||||
* @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);
|
||||
$constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
|
||||
|
@ -677,7 +677,7 @@ EOT
|
|||
*
|
||||
* @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();
|
||||
|
||||
|
@ -705,7 +705,7 @@ EOT
|
|||
*
|
||||
* @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->write('<info>name</info> : ' . $package->getPrettyName());
|
||||
|
@ -773,7 +773,7 @@ EOT
|
|||
*
|
||||
* @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 = Semver::rsort($versions);
|
||||
|
@ -802,7 +802,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
|
||||
protected function printLinks(CompletePackageInterface $package, string $linkType, string $title = null): void
|
||||
{
|
||||
$title = $title ?: $linkType;
|
||||
$io = $this->getIO();
|
||||
|
@ -820,7 +820,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function printLicenses(CompletePackageInterface $package)
|
||||
protected function printLicenses(CompletePackageInterface $package): void
|
||||
{
|
||||
$spdxLicenses = new SpdxLicenses();
|
||||
|
||||
|
@ -852,7 +852,7 @@ EOT
|
|||
*
|
||||
* @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(
|
||||
'name' => $package->getPrettyName(),
|
||||
|
@ -923,7 +923,7 @@ EOT
|
|||
* @param array<string, string> $versions
|
||||
* @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');
|
||||
$versions = array_keys(array_reverse($versions));
|
||||
|
@ -936,7 +936,7 @@ EOT
|
|||
* @param array<string, string|string[]|null> $json
|
||||
* @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()) {
|
||||
$spdxLicenses = new SpdxLicenses();
|
||||
|
@ -963,7 +963,7 @@ EOT
|
|||
* @param array<string, string|string[]|null> $json
|
||||
* @return array<string, string|string[]|null>
|
||||
*/
|
||||
private function appendAutoload($json, CompletePackageInterface $package): array
|
||||
private function appendAutoload(array $json, CompletePackageInterface $package): array
|
||||
{
|
||||
if ($package->getAutoload()) {
|
||||
$autoload = array();
|
||||
|
@ -996,7 +996,7 @@ EOT
|
|||
* @param array<string, string|string[]|null> $json
|
||||
* @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) {
|
||||
$json = $this->appendLink($json, $package, $linkType);
|
||||
|
@ -1010,7 +1010,7 @@ EOT
|
|||
* @param string $linkType
|
||||
* @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)}();
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initStyles(OutputInterface $output)
|
||||
protected function initStyles(OutputInterface $output): void
|
||||
{
|
||||
$this->colors = array(
|
||||
'green',
|
||||
|
@ -1052,7 +1052,7 @@ EOT
|
|||
* @param array<int, array<string, string|mixed[]>> $arrayTree
|
||||
* @return void
|
||||
*/
|
||||
protected function displayPackageTree(array $arrayTree)
|
||||
protected function displayPackageTree(array $arrayTree): void
|
||||
{
|
||||
$io = $this->getIO();
|
||||
foreach ($arrayTree as $package) {
|
||||
|
@ -1101,7 +1101,7 @@ EOT
|
|||
PackageInterface $package,
|
||||
InstalledRepository $installedRepo,
|
||||
RepositoryInterface $remoteRepos
|
||||
) {
|
||||
): array {
|
||||
$requires = $package->getRequires();
|
||||
ksort($requires);
|
||||
$children = array();
|
||||
|
@ -1147,9 +1147,9 @@ EOT
|
|||
protected function displayTree(
|
||||
$package,
|
||||
array $packagesInTree,
|
||||
$previousTreeBar = '├',
|
||||
$level = 1
|
||||
) {
|
||||
string $previousTreeBar = '├',
|
||||
int $level = 1
|
||||
): void {
|
||||
$previousTreeBar = str_replace('├', '│', $previousTreeBar);
|
||||
if (is_array($package) && isset($package['requires'])) {
|
||||
$requires = $package['requires'];
|
||||
|
@ -1197,12 +1197,12 @@ EOT
|
|||
* @return array<int, array<string, array<int, array<string, string>>|string>>
|
||||
*/
|
||||
protected function addTree(
|
||||
$name,
|
||||
string $name,
|
||||
Link $link,
|
||||
InstalledRepository $installedRepo,
|
||||
RepositoryInterface $remoteRepos,
|
||||
array $packagesInTree
|
||||
) {
|
||||
): array {
|
||||
$children = array();
|
||||
list($package) = $this->getPackage(
|
||||
$installedRepo,
|
||||
|
@ -1240,7 +1240,7 @@ EOT
|
|||
* @param string $updateStatus
|
||||
* @return string
|
||||
*/
|
||||
private function updateStatusToVersionStyle($updateStatus): string
|
||||
private function updateStatusToVersionStyle(string $updateStatus): string
|
||||
{
|
||||
// 'up-to-date' is printed green
|
||||
// 'semver-safe-update' is printed red
|
||||
|
@ -1275,7 +1275,7 @@ EOT
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function writeTreeLine($line): void
|
||||
private function writeTreeLine(string $line): void
|
||||
{
|
||||
$io = $this->getIO();
|
||||
if (!$io->isDecorated()) {
|
||||
|
@ -1287,10 +1287,8 @@ EOT
|
|||
|
||||
/**
|
||||
* 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
|
||||
$name = $package->getName();
|
||||
|
@ -1320,7 +1318,7 @@ EOT
|
|||
$candidate = $candidate->getAliasOf();
|
||||
}
|
||||
|
||||
return $candidate;
|
||||
return $candidate !== false ? $candidate : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1342,7 +1340,7 @@ EOT
|
|||
* @param array<PackageInterface> $bucket
|
||||
* @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();
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ EOT
|
|||
* @param string $constraint
|
||||
* @return Link
|
||||
*/
|
||||
private function appendConstraintToLink(Link $link, $constraint): Link
|
||||
private function appendConstraintToLink(Link $link, string $constraint): Link
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
$oldPrettyString = $link->getConstraint()->getPrettyString();
|
||||
|
|
|
@ -169,7 +169,7 @@ EOT
|
|||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Compiler
|
|||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function compile($pharFile = 'composer.phar'): void
|
||||
public function compile(string $pharFile = 'composer.phar'): void
|
||||
{
|
||||
if (file_exists($pharFile)) {
|
||||
unlink($pharFile);
|
||||
|
@ -201,7 +201,7 @@ class Compiler
|
|||
* @param \SplFileInfo $file
|
||||
* @return string
|
||||
*/
|
||||
private function getRelativeFilePath($file): string
|
||||
private function getRelativeFilePath(\SplFileInfo $file): string
|
||||
{
|
||||
$realPath = $file->getRealPath();
|
||||
$pathPrefix = dirname(__DIR__, 2).DIRECTORY_SEPARATOR;
|
||||
|
@ -217,7 +217,7 @@ class Compiler
|
|||
*
|
||||
* @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);
|
||||
$content = file_get_contents($file);
|
||||
|
@ -258,7 +258,7 @@ class Compiler
|
|||
* @param string $source A PHP string
|
||||
* @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')) {
|
||||
return $source;
|
||||
|
|
|
@ -112,9 +112,9 @@ class Config
|
|||
|
||||
/**
|
||||
* @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
|
||||
$this->config = static::$defaultConfig;
|
||||
|
@ -126,7 +126,7 @@ class Config
|
|||
|
||||
$this->repositories = static::$defaultRepositories;
|
||||
$this->useEnvironment = (bool) $useEnvironment;
|
||||
$this->baseDir = $baseDir;
|
||||
$this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
|
||||
|
||||
foreach ($this->config as $configKey => $configValue) {
|
||||
$this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
|
||||
|
@ -177,7 +177,7 @@ class Config
|
|||
*
|
||||
* @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
|
||||
if (!empty($config['config']) && is_array($config['config'])) {
|
||||
|
@ -277,7 +277,7 @@ class Config
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $flags = 0)
|
||||
public function get(string $key, int $flags = 0)
|
||||
{
|
||||
switch ($key) {
|
||||
// strings/paths with env var and {$refs} support
|
||||
|
@ -441,7 +441,7 @@ class Config
|
|||
*
|
||||
* @return array<string, mixed[]>
|
||||
*/
|
||||
public function all($flags = 0): array
|
||||
public function all(int $flags = 0): array
|
||||
{
|
||||
$all = array(
|
||||
'repositories' => $this->getRepositories(),
|
||||
|
@ -457,7 +457,7 @@ class Config
|
|||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceOfValue($key): string
|
||||
public function getSourceOfValue(string $key): string
|
||||
{
|
||||
$this->get($key);
|
||||
|
||||
|
@ -471,7 +471,7 @@ class Config
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function setSourceOfConfigValue($configValue, $path, $source): void
|
||||
private function setSourceOfConfigValue($configValue, string $path, string $source): void
|
||||
{
|
||||
$this->sourceOfConfigValue[$path] = $source;
|
||||
|
||||
|
@ -499,7 +499,7 @@ class Config
|
|||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key): bool
|
||||
public function has(string $key): bool
|
||||
{
|
||||
return array_key_exists($key, $this->config);
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ class Config
|
|||
*
|
||||
* @return string|int|null
|
||||
*/
|
||||
private function process($value, $flags)
|
||||
private function process($value, int $flags)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
return $value;
|
||||
|
@ -531,9 +531,9 @@ class Config
|
|||
* @param string $path
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ class Config
|
|||
* @param string $var
|
||||
* @return string|bool
|
||||
*/
|
||||
private function getComposerEnv($var)
|
||||
private function getComposerEnv(string $var)
|
||||
{
|
||||
if ($this->useEnvironment) {
|
||||
return Platform::getEnv($var);
|
||||
|
@ -563,7 +563,7 @@ class Config
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function disableRepoByName($name): void
|
||||
private function disableRepoByName(string $name): void
|
||||
{
|
||||
if (isset($this->repositories[$name])) {
|
||||
unset($this->repositories[$name]);
|
||||
|
@ -580,7 +580,7 @@ class Config
|
|||
*
|
||||
* @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)
|
||||
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
|
|
|
@ -29,7 +29,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addRepository($name, $config, $append = true);
|
||||
public function addRepository(string $name, $config, bool $append = true): void;
|
||||
|
||||
/**
|
||||
* Remove a repository
|
||||
|
@ -38,7 +38,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeRepository($name);
|
||||
public function removeRepository(string $name): void;
|
||||
|
||||
/**
|
||||
* Add a config setting
|
||||
|
@ -48,7 +48,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addConfigSetting($name, $value);
|
||||
public function addConfigSetting(string $name, $value): void;
|
||||
|
||||
/**
|
||||
* Remove a config setting
|
||||
|
@ -57,7 +57,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeConfigSetting($name);
|
||||
public function removeConfigSetting(string $name): void;
|
||||
|
||||
/**
|
||||
* Add a property
|
||||
|
@ -67,7 +67,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addProperty($name, $value);
|
||||
public function addProperty(string $name, $value): void;
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
|
@ -76,7 +76,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeProperty($name);
|
||||
public function removeProperty(string $name): void;
|
||||
|
||||
/**
|
||||
* Add a package link
|
||||
|
@ -87,7 +87,7 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addLink($type, $name, $value);
|
||||
public function addLink(string $type, string $name, string $value): void;
|
||||
|
||||
/**
|
||||
* Remove a package link
|
||||
|
@ -97,12 +97,12 @@ interface ConfigSourceInterface
|
|||
*
|
||||
* @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)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
public function getName(): string;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
* @param JsonFile $file
|
||||
* @param bool $authConfig
|
||||
*/
|
||||
public function __construct(JsonFile $file, $authConfig = false)
|
||||
public function __construct(JsonFile $file, bool $authConfig = false)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->authConfig = $authConfig;
|
||||
|
@ -52,7 +52,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->file->getPath();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @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 {
|
||||
// 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
|
||||
*/
|
||||
public function removeRepository($name)
|
||||
public function removeRepository(string $name): void
|
||||
{
|
||||
$this->manipulateJson('removeRepository', function (&$config, $repo): void {
|
||||
unset($config['repositories'][$repo]);
|
||||
|
@ -99,7 +99,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addConfigSetting($name, $value)
|
||||
public function addConfigSetting(string $name, $value): void
|
||||
{
|
||||
$authConfig = $this->authConfig;
|
||||
$this->manipulateJson('addConfigSetting', function (&$config, $key, $val) use ($authConfig): void {
|
||||
|
@ -119,7 +119,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function removeConfigSetting($name)
|
||||
public function removeConfigSetting(string $name): void
|
||||
{
|
||||
$authConfig = $this->authConfig;
|
||||
$this->manipulateJson('removeConfigSetting', function (&$config, $key) use ($authConfig): void {
|
||||
|
@ -139,7 +139,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addProperty($name, $value)
|
||||
public function addProperty(string $name, $value): void
|
||||
{
|
||||
$this->manipulateJson('addProperty', function (&$config, $key, $val): void {
|
||||
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
||||
|
@ -162,7 +162,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function removeProperty($name)
|
||||
public function removeProperty(string $name): void
|
||||
{
|
||||
$this->manipulateJson('removeProperty', function (&$config, $key): void {
|
||||
if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
|
||||
|
@ -185,7 +185,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @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 {
|
||||
$config[$type][$name] = $value;
|
||||
|
@ -195,7 +195,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function removeLink($type, $name)
|
||||
public function removeLink(string $type, string $name): void
|
||||
{
|
||||
$this->manipulateJson('removeSubNode', function (&$config, $type, $name): void {
|
||||
unset($config[$type][$name]);
|
||||
|
@ -214,7 +214,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function manipulateJson($method, $fallback, ...$args): void
|
||||
private function manipulateJson(string $method, callable $fallback, ...$args): void
|
||||
{
|
||||
if ($this->file->exists()) {
|
||||
if (!is_writable($this->file->getPath())) {
|
||||
|
@ -297,7 +297,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
* @param mixed $value
|
||||
* @return int
|
||||
*/
|
||||
private function arrayUnshiftRef(&$array, &$value): int
|
||||
private function arrayUnshiftRef(array &$array, &$value): int
|
||||
{
|
||||
$return = array_unshift($array, '');
|
||||
$array[0] = &$value;
|
||||
|
|
|
@ -74,7 +74,7 @@ class Application extends BaseApplication
|
|||
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;
|
||||
|
||||
|
@ -151,10 +151,11 @@ class Application extends BaseApplication
|
|||
|
||||
// switch working dir
|
||||
if ($newWorkDir = $this->getNewWorkingDir($input)) {
|
||||
$oldWorkingDir = getcwd();
|
||||
$oldWorkingDir = Platform::getCwd(true);
|
||||
chdir($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
|
||||
|
@ -171,7 +172,7 @@ class Application extends BaseApplication
|
|||
|
||||
// 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) {
|
||||
$dir = dirname(getcwd());
|
||||
$dir = dirname(Platform::getCwd(true));
|
||||
$home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
|
||||
|
||||
// abort when we reach the home dir or top of the filesystem
|
||||
|
@ -183,7 +184,7 @@ class Application extends BaseApplication
|
|||
} else {
|
||||
$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);
|
||||
}
|
||||
break;
|
||||
|
@ -330,7 +331,7 @@ class Application extends BaseApplication
|
|||
$result = parent::doRun($input, $output);
|
||||
|
||||
// chdir back to $oldWorkingDir if set
|
||||
if (isset($oldWorkingDir)) {
|
||||
if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
|
||||
Silencer::call('chdir', $oldWorkingDir);
|
||||
}
|
||||
|
||||
|
@ -422,9 +423,9 @@ class Application extends BaseApplication
|
|||
* @param bool|null $disableScripts
|
||||
* @throws JsonValidationException
|
||||
* @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) {
|
||||
$disablePlugins = $this->disablePluginsByDefault;
|
||||
|
@ -459,7 +460,7 @@ class Application extends BaseApplication
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetComposer()
|
||||
public function resetComposer(): void
|
||||
{
|
||||
$this->composer = null;
|
||||
if (method_exists($this->getIO(), 'resetAuthentications')) {
|
||||
|
@ -470,7 +471,7 @@ class Application extends BaseApplication
|
|||
/**
|
||||
* @return IOInterface
|
||||
*/
|
||||
public function getIO()
|
||||
public function getIO(): IOInterface
|
||||
{
|
||||
return $this->io;
|
||||
}
|
||||
|
@ -585,7 +586,7 @@ class Application extends BaseApplication
|
|||
/**
|
||||
* Get the working directory at startup time
|
||||
*
|
||||
* @return string
|
||||
* @return string|false
|
||||
*/
|
||||
public function getInitialWorkingDirectory()
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ final class GithubActionError
|
|||
*
|
||||
* @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')) {
|
||||
$message = $this->escapeData($message);
|
||||
|
@ -55,7 +55,7 @@ final class GithubActionError
|
|||
* @param string $data
|
||||
* @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
|
||||
$data = str_replace("%", '%25', $data);
|
||||
|
@ -69,7 +69,7 @@ final class GithubActionError
|
|||
* @param string $property
|
||||
* @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
|
||||
$property = str_replace("%", '%25', $property);
|
||||
|
|
|
@ -43,7 +43,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $level
|
||||
* @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->decisionQueue[] = array(
|
||||
|
@ -56,7 +56,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literal
|
||||
* @return bool
|
||||
*/
|
||||
public function satisfy($literal): bool
|
||||
public function satisfy(int $literal): bool
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literal
|
||||
* @return bool
|
||||
*/
|
||||
public function conflict($literal): bool
|
||||
public function conflict(int $literal): bool
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
|
@ -84,7 +84,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literalOrPackageId
|
||||
* @return bool
|
||||
*/
|
||||
public function decided($literalOrPackageId): bool
|
||||
public function decided(int $literalOrPackageId): bool
|
||||
{
|
||||
return !empty($this->decisionMap[abs($literalOrPackageId)]);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literalOrPackageId
|
||||
* @return bool
|
||||
*/
|
||||
public function undecided($literalOrPackageId): bool
|
||||
public function undecided(int $literalOrPackageId): bool
|
||||
{
|
||||
return empty($this->decisionMap[abs($literalOrPackageId)]);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literalOrPackageId
|
||||
* @return bool
|
||||
*/
|
||||
public function decidedInstall($literalOrPackageId): bool
|
||||
public function decidedInstall(int $literalOrPackageId): bool
|
||||
{
|
||||
$packageId = abs($literalOrPackageId);
|
||||
|
||||
|
@ -113,7 +113,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literalOrPackageId
|
||||
* @return int
|
||||
*/
|
||||
public function decisionLevel($literalOrPackageId): int
|
||||
public function decisionLevel(int $literalOrPackageId): int
|
||||
{
|
||||
$packageId = abs($literalOrPackageId);
|
||||
if (isset($this->decisionMap[$packageId])) {
|
||||
|
@ -127,7 +127,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $literalOrPackageId
|
||||
* @return Rule|null
|
||||
*/
|
||||
public function decisionRule($literalOrPackageId): ?Rule
|
||||
public function decisionRule(int $literalOrPackageId): ?Rule
|
||||
{
|
||||
$packageId = abs($literalOrPackageId);
|
||||
|
||||
|
@ -144,7 +144,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $queueOffset
|
||||
* @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];
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $queueOffset
|
||||
* @return bool
|
||||
*/
|
||||
public function validOffset($queueOffset): bool
|
||||
public function validOffset(int $queueOffset): bool
|
||||
{
|
||||
return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $offset
|
||||
* @return void
|
||||
*/
|
||||
public function resetToOffset($offset): void
|
||||
public function resetToOffset(int $offset): void
|
||||
{
|
||||
while (\count($this->decisionQueue) > $offset + 1) {
|
||||
$decision = array_pop($this->decisionQueue);
|
||||
|
@ -252,7 +252,7 @@ class Decisions implements \Iterator, \Countable
|
|||
* @param int $level
|
||||
* @return void
|
||||
*/
|
||||
protected function addDecision($literal, $level): void
|
||||
protected function addDecision(int $literal, int $level): void
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
|
@ -288,7 +288,7 @@ class Decisions implements \Iterator, \Countable
|
|||
return $str;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
* @param bool $preferStable
|
||||
* @param bool $preferLowest
|
||||
*/
|
||||
public function __construct($preferStable = false, $preferLowest = false)
|
||||
public function __construct(bool $preferStable = false, bool $preferLowest = false)
|
||||
{
|
||||
$this->preferStable = $preferStable;
|
||||
$this->preferLowest = $preferLowest;
|
||||
|
@ -44,7 +44,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
*
|
||||
* @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())) {
|
||||
return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
|
||||
|
@ -61,7 +61,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
* @param string $requiredPackage
|
||||
* @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);
|
||||
|
||||
|
@ -90,7 +90,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
* @param int[] $literals
|
||||
* @return array<string, int[]>
|
||||
*/
|
||||
protected function groupLiteralsByName(Pool $pool, $literals): array
|
||||
protected function groupLiteralsByName(Pool $pool, array $literals): array
|
||||
{
|
||||
$packages = array();
|
||||
foreach ($literals as $literal) {
|
||||
|
@ -107,11 +107,11 @@ class DefaultPolicy implements PolicyInterface
|
|||
|
||||
/**
|
||||
* @protected
|
||||
* @param ?string $requiredPackage
|
||||
* @param null|string $requiredPackage
|
||||
* @param bool $ignoreReplace
|
||||
* @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
|
||||
if ($a->getName() === $b->getName()) {
|
||||
|
@ -182,7 +182,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
* @param int[] $literals
|
||||
* @return int[]
|
||||
*/
|
||||
protected function pruneToBestVersion(Pool $pool, $literals): array
|
||||
protected function pruneToBestVersion(Pool $pool, array $literals): array
|
||||
{
|
||||
$operator = $this->preferLowest ? '<' : '>';
|
||||
$bestLiterals = array($literals[0]);
|
||||
|
|
|
@ -77,7 +77,7 @@ class GenericRule extends Rule
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
$result = $this->isDisabled() ? 'disabled(' : '(';
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class LockTransaction extends Transaction
|
|||
* @param bool $updateMirrors
|
||||
* @return BasePackage[]
|
||||
*/
|
||||
public function getNewLockPackages($devMode, $updateMirrors = false): array
|
||||
public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
|
||||
{
|
||||
$packages = array();
|
||||
foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
|
||||
|
@ -119,7 +119,7 @@ class LockTransaction extends Transaction
|
|||
if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
|
||||
$package->setSourceDistReferences($presentPackage->getSourceReference());
|
||||
}
|
||||
if ($presentPackage->getReleaseDate() && $package instanceof Package) {
|
||||
if ($presentPackage->getReleaseDate() !== null && $package instanceof Package) {
|
||||
$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
|
||||
* @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();
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class MultiConflictRule extends Rule
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
// TODO multi conflict?
|
||||
$result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
|
||||
|
|
|
@ -38,7 +38,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
|||
*
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
public function getPackage(): PackageInterface
|
||||
{
|
||||
return $this->package;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function show($lock)
|
||||
public function show($lock): string
|
||||
{
|
||||
return self::format($this->package, $lock);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class InstallOperation extends SolverOperation implements OperationInterface
|
|||
* @param bool $lock
|
||||
* @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>)';
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ interface OperationInterface
|
|||
* @param bool $lock Whether this is an operation on the lock file
|
||||
* @return string
|
||||
*/
|
||||
public function show($lock);
|
||||
public function show(bool $lock);
|
||||
|
||||
/**
|
||||
* Serializes the operation in a human readable format
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class SolverOperation implements OperationInterface
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperationType()
|
||||
public function getOperationType(): string
|
||||
{
|
||||
return static::TYPE;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class UninstallOperation extends SolverOperation implements OperationInterface
|
|||
* @param bool $lock
|
||||
* @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>)';
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class UpdateOperation extends SolverOperation implements OperationInterface
|
|||
* @param bool $lock
|
||||
* @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();
|
||||
$toVersion = $targetPackage->getFullPrettyVersion();
|
||||
|
|
|
@ -26,12 +26,12 @@ interface PolicyInterface
|
|||
*
|
||||
* @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 ?string $requiredPackage
|
||||
* @param null|string $requiredPackage
|
||||
* @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
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getRemovedVersions($name, ConstraintInterface $constraint): array
|
||||
public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
|
||||
{
|
||||
if (!isset($this->removedVersions[$name])) {
|
||||
return array();
|
||||
|
@ -80,7 +80,7 @@ class Pool implements \Countable
|
|||
* @param string $objectHash
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getRemovedVersionsByPackage($objectHash): array
|
||||
public function getRemovedVersionsByPackage(string $objectHash): array
|
||||
{
|
||||
if (!isset($this->removedVersionsByPackage[$objectHash])) {
|
||||
return array();
|
||||
|
@ -122,7 +122,7 @@ class Pool implements \Countable
|
|||
* @param int $id
|
||||
* @return BasePackage
|
||||
*/
|
||||
public function packageById($id): BasePackage
|
||||
public function packageById(int $id): BasePackage
|
||||
{
|
||||
return $this->packages[$id - 1];
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class Pool implements \Countable
|
|||
* packages must match or null to return all
|
||||
* @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;
|
||||
if (isset($this->providerCache[$name][$key])) {
|
||||
|
@ -159,7 +159,7 @@ class Pool implements \Countable
|
|||
* packages must match or null to return all
|
||||
* @return BasePackage[]
|
||||
*/
|
||||
private function computeWhatProvides($name, ConstraintInterface $constraint = null): array
|
||||
private function computeWhatProvides(string $name, ConstraintInterface $constraint = null): array
|
||||
{
|
||||
if (!isset($this->packageByName[$name])) {
|
||||
return array();
|
||||
|
@ -180,7 +180,7 @@ class Pool implements \Countable
|
|||
* @param int $literal
|
||||
* @return BasePackage
|
||||
*/
|
||||
public function literalToPackage($literal): BasePackage
|
||||
public function literalToPackage(int $literal): BasePackage
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
|
@ -192,7 +192,7 @@ class Pool implements \Countable
|
|||
* @param array<int, BasePackage> $installedMap
|
||||
* @return string
|
||||
*/
|
||||
public function literalToPrettyString($literal, $installedMap): string
|
||||
public function literalToPrettyString(int $literal, array $installedMap): string
|
||||
{
|
||||
$package = $this->literalToPackage($literal);
|
||||
|
||||
|
@ -212,7 +212,7 @@ class Pool implements \Countable
|
|||
* @param string $name Name of the package to be matched
|
||||
* @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();
|
||||
$candidateVersion = $candidate->getVersion();
|
||||
|
@ -268,7 +268,7 @@ class Pool implements \Countable
|
|||
return $this->unacceptableFixedOrLockedPackages;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
$str = "Pool:\n";
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ class PoolBuilder
|
|||
* @param string $name
|
||||
* @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
|
||||
if (PlatformRepository::isPlatformPackage($name)) {
|
||||
|
@ -396,7 +396,7 @@ class PoolBuilder
|
|||
* @param RepositoryInterface[] $repositories
|
||||
* @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++;
|
||||
$this->packages[$index] = $package;
|
||||
|
@ -501,7 +501,7 @@ class PoolBuilder
|
|||
* @param string $name packageName
|
||||
* @return bool
|
||||
*/
|
||||
private function isRootRequire(Request $request, $name): bool
|
||||
private function isRootRequire(Request $request, string $name): bool
|
||||
{
|
||||
$rootRequires = $request->getRequires();
|
||||
|
||||
|
@ -512,7 +512,7 @@ class PoolBuilder
|
|||
* @param string $name
|
||||
* @return string[]
|
||||
*/
|
||||
private function getSkippedRootRequires(Request $request, $name): array
|
||||
private function getSkippedRootRequires(Request $request, string $name): array
|
||||
{
|
||||
if (!isset($this->skippedLoad[$name])) {
|
||||
return array();
|
||||
|
@ -602,7 +602,7 @@ class PoolBuilder
|
|||
* @param string $name
|
||||
* @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) {
|
||||
// if we unfixed a replaced package name, we also need to unfix the replacer itself
|
||||
|
@ -668,7 +668,7 @@ class PoolBuilder
|
|||
* @param int $index
|
||||
* @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);
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ class PoolOptimizer
|
|||
* @param int $id
|
||||
* @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
|
||||
if (isset($this->irremovablePackages[$id])) {
|
||||
|
@ -337,7 +337,7 @@ class PoolOptimizer
|
|||
* @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup
|
||||
* @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]);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class Problem
|
|||
* @param array<Rule[]> $learnedPool
|
||||
* @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?
|
||||
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
|
||||
|
@ -117,7 +117,7 @@ class Problem
|
|||
* @return string
|
||||
* @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();
|
||||
$templates = array();
|
||||
|
@ -185,7 +185,7 @@ class Problem
|
|||
* @param Rule $reason The reason descriptor
|
||||
* @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
|
||||
// that is important to understand the issue?
|
||||
|
@ -210,7 +210,7 @@ class Problem
|
|||
* @param string $packageName
|
||||
* @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)) {
|
||||
// handle php/php-*/hhvm
|
||||
|
@ -382,7 +382,7 @@ class Problem
|
|||
* @param bool $useRemovedVersionGroup
|
||||
* @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();
|
||||
$hasDefaultBranch = array();
|
||||
|
@ -427,7 +427,7 @@ class Problem
|
|||
* @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
|
||||
*/
|
||||
private static function getPlatformPackageVersion(Pool $pool, $packageName, $version): ?string
|
||||
private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
|
||||
{
|
||||
$available = $pool->whatProvides($packageName);
|
||||
|
||||
|
@ -471,7 +471,7 @@ class Problem
|
|||
* @param int $maxDev
|
||||
* @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) {
|
||||
return $versions;
|
||||
|
@ -527,7 +527,7 @@ class Problem
|
|||
* @param string $reason
|
||||
* @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();
|
||||
$nextRepo = null;
|
||||
|
|
|
@ -64,7 +64,7 @@ class Request
|
|||
* @param string $packageName
|
||||
* @return void
|
||||
*/
|
||||
public function requireName($packageName, ConstraintInterface $constraint = null): void
|
||||
public function requireName(string $packageName, ConstraintInterface $constraint = null): void
|
||||
{
|
||||
$packageName = strtolower($packageName);
|
||||
|
||||
|
@ -135,7 +135,7 @@ class Request
|
|||
* @param false|self::UPDATE_* $updateAllowTransitiveDependencies
|
||||
* @return void
|
||||
*/
|
||||
public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies): void
|
||||
public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
|
||||
{
|
||||
$this->updateAllowList = $updateAllowList;
|
||||
$this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
|
||||
|
@ -222,7 +222,7 @@ class Request
|
|||
* Some locked packages may not be in the pool,
|
||||
* so they have a package->id of -1
|
||||
*/
|
||||
public function getPresentMap($packageIds = false): array
|
||||
public function getPresentMap(bool $packageIds = false): array
|
||||
{
|
||||
$presentMap = array();
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ abstract class Rule
|
|||
*/
|
||||
abstract public function getHash();
|
||||
|
||||
abstract public function __toString();
|
||||
abstract public function __toString(): string;
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
|
@ -267,7 +267,7 @@ abstract class Rule
|
|||
* @param array<Rule[]> $learnedPool
|
||||
* @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();
|
||||
|
||||
|
@ -484,7 +484,7 @@ abstract class Rule
|
|||
* @param bool $useRemovedVersionGroup
|
||||
* @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) {
|
||||
if (!\is_object($package)) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class Rule2Literals extends Rule
|
|||
*
|
||||
* @phpstan-param ReasonData $reasonData
|
||||
*/
|
||||
public function __construct($literal1, $literal2, $reason, $reasonData)
|
||||
public function __construct(int $literal1, int $literal2, $reason, $reasonData)
|
||||
{
|
||||
parent::__construct($reason, $reasonData);
|
||||
|
||||
|
@ -108,7 +108,7 @@ class Rule2Literals extends Rule
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
$result = $this->isDisabled() ? 'disabled(' : '(';
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
* @param int $id
|
||||
* @return Rule
|
||||
*/
|
||||
public function ruleById($id): Rule
|
||||
public function ruleById(int $id): Rule
|
||||
{
|
||||
return $this->ruleById[$id];
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
* @param bool $isVerbose
|
||||
* @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";
|
||||
foreach ($this->rules as $type => $rules) {
|
||||
|
@ -195,7 +195,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
return $string;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getPrettyString();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class RuleSetGenerator
|
|||
* @param BasePackage[] $packages The set of packages to choose from
|
||||
* @param Rule::RULE_* $reason A RULE_* constant describing the reason for
|
||||
* 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
|
||||
*
|
||||
* @phpstan-param ReasonData $reasonData
|
||||
|
|
|
@ -29,7 +29,7 @@ class RuleWatchChain extends \SplDoublyLinkedList
|
|||
* @param int $offset The offset to seek to.
|
||||
* @return void
|
||||
*/
|
||||
public function seek($offset): void
|
||||
public function seek(int $offset): void
|
||||
{
|
||||
$this->rewind();
|
||||
for ($i = 0; $i < $offset; $i++, $this->next());
|
||||
|
|
|
@ -88,7 +88,7 @@ class RuleWatchGraph
|
|||
* register decisions resulting from propagation
|
||||
* @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:
|
||||
// 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
|
||||
* @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])) {
|
||||
$this->watchChains[$toLiteral] = new RuleWatchChain;
|
||||
|
|
|
@ -91,7 +91,7 @@ class RuleWatchNode
|
|||
* @param int $literal The watched literal that should not be returned
|
||||
* @return int A literal
|
||||
*/
|
||||
public function getOtherWatch($literal): int
|
||||
public function getOtherWatch(int $literal): int
|
||||
{
|
||||
if ($this->watch1 == $literal) {
|
||||
return $this->watch2;
|
||||
|
@ -107,7 +107,7 @@ class RuleWatchNode
|
|||
* @param int $to The literal to be watched now
|
||||
* @return void
|
||||
*/
|
||||
public function moveWatch($from, $to): void
|
||||
public function moveWatch(int $from, int $to): void
|
||||
{
|
||||
if ($this->watch1 == $from) {
|
||||
$this->watch1 = $to;
|
||||
|
|
|
@ -233,7 +233,7 @@ class Solver
|
|||
* @param int $level
|
||||
* @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)) {
|
||||
$decision = $this->decisions->atOffset($this->propagateIndex);
|
||||
|
@ -261,7 +261,7 @@ class Solver
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function revert($level): void
|
||||
private function revert(int $level): void
|
||||
{
|
||||
while (!$this->decisions->isEmpty()) {
|
||||
$literal = $this->decisions->lastLiteral();
|
||||
|
@ -302,7 +302,7 @@ class Solver
|
|||
* @param string|int $literal
|
||||
* @return int
|
||||
*/
|
||||
private function setPropagateLearn($level, $literal, Rule $rule): int
|
||||
private function setPropagateLearn(int $level, $literal, Rule $rule): int
|
||||
{
|
||||
$level++;
|
||||
|
||||
|
@ -351,7 +351,7 @@ class Solver
|
|||
* @param int[] $decisionQueue
|
||||
* @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
|
||||
$literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
|
||||
|
@ -370,7 +370,7 @@ class Solver
|
|||
* @param int $level
|
||||
* @return array{int, int, GenericRule, int}
|
||||
*/
|
||||
protected function analyze($level, Rule $rule): array
|
||||
protected function analyze(int $level, Rule $rule): array
|
||||
{
|
||||
$analyzedRule = $rule;
|
||||
$ruleLevel = 1;
|
||||
|
|
|
@ -20,7 +20,7 @@ class SolverBugException extends \RuntimeException
|
|||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function __construct($message)
|
||||
public function __construct(string $message)
|
||||
{
|
||||
parent::__construct(
|
||||
$message."\nThis exception was most likely caused by a bug in Composer.\n".
|
||||
|
|
|
@ -46,7 +46,7 @@ class SolverProblemsException extends \RuntimeException
|
|||
* @param bool $isDevExtraction
|
||||
* @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);
|
||||
$missingExtensions = array();
|
||||
|
|
|
@ -50,7 +50,7 @@ class Transaction
|
|||
* @param PackageInterface[] $presentPackages
|
||||
* @param PackageInterface[] $resultPackages
|
||||
*/
|
||||
public function __construct($presentPackages, $resultPackages)
|
||||
public function __construct(array $presentPackages, array $resultPackages)
|
||||
{
|
||||
$this->presentPackages = $presentPackages;
|
||||
$this->setResultPackageMaps($resultPackages);
|
||||
|
@ -69,7 +69,7 @@ class Transaction
|
|||
* @param PackageInterface[] $resultPackages
|
||||
* @return void
|
||||
*/
|
||||
private function setResultPackageMaps($resultPackages): void
|
||||
private function setResultPackageMaps(array $resultPackages): void
|
||||
{
|
||||
$packageSort = function (PackageInterface $a, PackageInterface $b): int {
|
||||
// sort alias packages by the same name behind their non alias version
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\Platform;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use React\Promise\PromiseInterface;
|
||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||
|
@ -32,9 +33,9 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
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()]);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -61,7 +62,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
* @throws \RuntimeException
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function install(PackageInterface $package, $path, $output = true)
|
||||
public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||
{
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
|
||||
|
@ -83,7 +84,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
$this->addCleanupPath($package, $temporaryDir);
|
||||
// avoid cleaning up $path if installing in "." for eg create-project as we can not
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -98,7 +99,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
|
||||
// clean up
|
||||
$filesystem->removeDirectory($temporaryDir);
|
||||
if (is_dir($path) && realpath($path) !== getcwd()) {
|
||||
if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
|
||||
$filesystem->removeDirectory($path);
|
||||
}
|
||||
$this->removeCleanupPath($package, $temporaryDir);
|
||||
|
@ -112,10 +113,6 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
throw $e;
|
||||
}
|
||||
|
||||
if (!$promise instanceof PromiseInterface) {
|
||||
$promise = \React\Promise\resolve();
|
||||
}
|
||||
|
||||
return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
|
||||
$filesystem->unlink($fileName);
|
||||
|
||||
|
@ -214,7 +211,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||
{
|
||||
return ': Extracting archive';
|
||||
}
|
||||
|
@ -226,7 +223,6 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
* @param string $path Directory
|
||||
*
|
||||
* @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
|
||||
* @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 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->preferSource = $preferSource;
|
||||
|
@ -59,7 +59,7 @@ class DownloadManager
|
|||
* @param bool $preferSource prefer downloading from source
|
||||
* @return DownloadManager
|
||||
*/
|
||||
public function setPreferSource($preferSource): DownloadManager
|
||||
public function setPreferSource(bool $preferSource): self
|
||||
{
|
||||
$this->preferSource = $preferSource;
|
||||
|
||||
|
@ -72,7 +72,7 @@ class DownloadManager
|
|||
* @param bool $preferDist prefer downloading from dist
|
||||
* @return DownloadManager
|
||||
*/
|
||||
public function setPreferDist($preferDist): DownloadManager
|
||||
public function setPreferDist(bool $preferDist): self
|
||||
{
|
||||
$this->preferDist = $preferDist;
|
||||
|
||||
|
@ -86,7 +86,7 @@ class DownloadManager
|
|||
*
|
||||
* @return DownloadManager
|
||||
*/
|
||||
public function setPreferences(array $preferences): DownloadManager
|
||||
public function setPreferences(array $preferences): self
|
||||
{
|
||||
$this->packagePreferences = $preferences;
|
||||
|
||||
|
@ -100,7 +100,7 @@ class DownloadManager
|
|||
* @param DownloaderInterface $downloader downloader instance
|
||||
* @return DownloadManager
|
||||
*/
|
||||
public function setDownloader($type, DownloaderInterface $downloader): DownloadManager
|
||||
public function setDownloader(string $type, DownloaderInterface $downloader): self
|
||||
{
|
||||
$type = strtolower($type);
|
||||
$this->downloaders[$type] = $downloader;
|
||||
|
@ -115,7 +115,7 @@ class DownloadManager
|
|||
* @throws \InvalidArgumentException if downloader for provided type is not registered
|
||||
* @return DownloaderInterface
|
||||
*/
|
||||
public function getDownloader($type): DownloaderInterface
|
||||
public function getDownloader(string $type): DownloaderInterface
|
||||
{
|
||||
$type = strtolower($type);
|
||||
if (!isset($this->downloaders[$type])) {
|
||||
|
@ -184,7 +184,7 @@ class DownloadManager
|
|||
* @throws \RuntimeException
|
||||
* @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);
|
||||
$this->filesystem->ensureDirectoryExists(dirname($targetDir));
|
||||
|
@ -229,9 +229,6 @@ class DownloadManager
|
|||
} catch (\Exception $e) {
|
||||
return $handleError($e);
|
||||
}
|
||||
if (!$result instanceof PromiseInterface) {
|
||||
return \React\Promise\resolve($result);
|
||||
}
|
||||
|
||||
$res = $result->then(function ($res) {
|
||||
return $res;
|
||||
|
@ -251,9 +248,9 @@ class DownloadManager
|
|||
* @param string $targetDir target dir
|
||||
* @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);
|
||||
$downloader = $this->getDownloaderForPackage($package);
|
||||
|
@ -272,9 +269,9 @@ class DownloadManager
|
|||
*
|
||||
* @throws \InvalidArgumentException if package have no urls to download from
|
||||
* @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);
|
||||
$downloader = $this->getDownloaderForPackage($package);
|
||||
|
@ -293,9 +290,9 @@ class DownloadManager
|
|||
* @param string $targetDir target dir
|
||||
*
|
||||
* @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);
|
||||
$downloader = $this->getDownloaderForPackage($target);
|
||||
|
@ -330,18 +327,10 @@ class DownloadManager
|
|||
// 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
|
||||
$promise = $initialDownloader->remove($initial, $targetDir);
|
||||
if ($promise instanceof 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);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,9 +339,9 @@ class DownloadManager
|
|||
* @param PackageInterface $package package instance
|
||||
* @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);
|
||||
$downloader = $this->getDownloaderForPackage($package);
|
||||
|
@ -371,9 +360,9 @@ class DownloadManager
|
|||
* @param string $targetDir target dir
|
||||
* @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);
|
||||
$downloader = $this->getDownloaderForPackage($package);
|
||||
|
@ -461,7 +450,7 @@ class DownloadManager
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function normalizeTargetDir($dir): string
|
||||
private function normalizeTargetDir(string $dir): string
|
||||
{
|
||||
if ($dir === '\\' || $dir === '/') {
|
||||
return $dir;
|
||||
|
|
|
@ -28,15 +28,15 @@ interface DownloaderInterface
|
|||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
|
@ -50,18 +50,18 @@ interface DownloaderInterface
|
|||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @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.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @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.
|
||||
|
@ -69,18 +69,18 @@ interface DownloaderInterface
|
|||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target updated package
|
||||
* @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.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @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
|
||||
|
@ -93,7 +93,7 @@ interface DownloaderInterface
|
|||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @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
|
||||
* @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\EventDispatcher\EventDispatcher;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\Silencer;
|
||||
use Composer\Util\HttpDownloader;
|
||||
use Composer\Util\Url as UrlUtil;
|
||||
|
@ -65,11 +66,9 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
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
|
||||
*/
|
||||
public $lastCacheWrites = array();
|
||||
private $lastCacheWrites = array();
|
||||
/** @var array<string, string[]> Map of package name to list of paths */
|
||||
private $additionalCleanupPaths = array();
|
||||
|
||||
|
@ -102,7 +101,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getInstallationSource()
|
||||
public function getInstallationSource(): string
|
||||
{
|
||||
return 'dist';
|
||||
}
|
||||
|
@ -112,7 +111,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*
|
||||
* @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()) {
|
||||
throw new \InvalidArgumentException('The given package is missing url information');
|
||||
|
@ -295,7 +294,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
/**
|
||||
* @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();
|
||||
}
|
||||
|
@ -303,7 +302,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
/**
|
||||
* @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);
|
||||
if (file_exists($fileName)) {
|
||||
|
@ -323,7 +322,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +335,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*
|
||||
* @param bool $output
|
||||
*/
|
||||
public function install(PackageInterface $package, $path, $output = true)
|
||||
public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||
{
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . InstallOperation::format($package));
|
||||
|
@ -362,7 +361,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function clearLastCacheWrite(PackageInterface $package)
|
||||
protected function clearLastCacheWrite(PackageInterface $package): void
|
||||
{
|
||||
if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
|
||||
$this->cache->remove($this->lastCacheWrites[$package->getName()]);
|
||||
|
@ -375,7 +374,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addCleanupPath(PackageInterface $package, $path)
|
||||
protected function addCleanupPath(PackageInterface $package, string $path): void
|
||||
{
|
||||
$this->additionalCleanupPaths[$package->getName()][] = $path;
|
||||
}
|
||||
|
@ -385,7 +384,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function removeCleanupPath(PackageInterface $package, $path)
|
||||
protected function removeCleanupPath(PackageInterface $package, string $path): void
|
||||
{
|
||||
if (isset($this->additionalCleanupPaths[$package->getName()])) {
|
||||
$idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
|
||||
|
@ -398,22 +397,14 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
/**
|
||||
* @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));
|
||||
|
||||
$promise = $this->remove($initial, $path, false);
|
||||
if (!$promise instanceof PromiseInterface) {
|
||||
$promise = \React\Promise\resolve();
|
||||
}
|
||||
|
||||
return $promise->then(function () use ($target, $path): PromiseInterface {
|
||||
$promise = $this->install($target, $path, false);
|
||||
if ($promise instanceof PromiseInterface) {
|
||||
return $promise;
|
||||
}
|
||||
|
||||
return \React\Promise\resolve();
|
||||
return $this->install($target, $path, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -422,7 +413,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*
|
||||
* @param bool $output
|
||||
*/
|
||||
public function remove(PackageInterface $package, $path, $output = true)
|
||||
public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
|
||||
{
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . UninstallOperation::format($package));
|
||||
|
@ -443,7 +434,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
* @param string $path download path
|
||||
* @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), '.');
|
||||
}
|
||||
|
@ -455,7 +446,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
* @param string $path download path
|
||||
* @return string
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
@ -468,7 +459,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
* @throws \RuntimeException If any problem with the 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:')) {
|
||||
throw new \RuntimeException('You must enable the openssl extension to download files via https');
|
||||
|
@ -485,7 +476,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
* @inheritDoc
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function getLocalChanges(PackageInterface $package, $targetDir)
|
||||
public function getLocalChanges(PackageInterface $package, string $targetDir): ?string
|
||||
{
|
||||
$prevIO = $this->io;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class FilesystemException extends \Exception
|
|||
* @param int $code
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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
|
||||
$this->config->prohibitUrlByConfig($url, $this->io);
|
||||
|
@ -61,7 +61,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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
|
||||
$this->config->prohibitUrlByConfig($url, $this->io);
|
||||
|
@ -84,7 +84,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLocalChanges(PackageInterface $package, $path): ?string
|
||||
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
if (!$this->hasMetadataRepository($path)) {
|
||||
return null;
|
||||
|
@ -98,7 +98,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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));
|
||||
|
||||
|
@ -122,7 +122,7 @@ class FossilDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function hasMetadataRepository($path): bool
|
||||
protected function hasMetadataRepository(string $path): bool
|
||||
{
|
||||
return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @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();
|
||||
|
||||
|
@ -83,7 +83,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function doInstall(PackageInterface $package, $path, $url)
|
||||
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||
{
|
||||
GitUtil::cleanEnv();
|
||||
$path = $this->normalizePath($path);
|
||||
|
@ -114,7 +114,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
|
||||
$this->io->writeError($msg);
|
||||
|
||||
$commandCallable = function ($url) use ($path, $command, $cachePath): string {
|
||||
$commandCallable = function (string $url) use ($path, $command, $cachePath): string {
|
||||
return str_replace(
|
||||
array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
|
||||
array(
|
||||
|
@ -148,7 +148,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
|
||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||
{
|
||||
GitUtil::cleanEnv();
|
||||
$path = $this->normalizePath($path);
|
||||
|
@ -213,7 +213,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLocalChanges(PackageInterface $package, $path)
|
||||
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
GitUtil::cleanEnv();
|
||||
if (!$this->hasMetadataRepository($path)) {
|
||||
|
@ -231,7 +231,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getUnpushedChanges(PackageInterface $package, $path)
|
||||
public function getUnpushedChanges(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
GitUtil::cleanEnv();
|
||||
$path = $this->normalizePath($path);
|
||||
|
@ -328,7 +328,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function cleanChanges(PackageInterface $package, $path, $update)
|
||||
protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
|
||||
{
|
||||
GitUtil::cleanEnv();
|
||||
$path = $this->normalizePath($path);
|
||||
|
@ -415,7 +415,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function reapplyChanges($path)
|
||||
protected function reapplyChanges(string $path): void
|
||||
{
|
||||
$path = $this->normalizePath($path);
|
||||
if (!empty($this->hasStashedChanges[$path])) {
|
||||
|
@ -438,7 +438,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
* @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
|
||||
*/
|
||||
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 ' : '';
|
||||
|
||||
|
@ -505,7 +505,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
*
|
||||
* @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->setPushUrl($path, $url);
|
||||
|
@ -517,7 +517,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setPushUrl($path, $url)
|
||||
protected function setPushUrl(string $path, string $url): void
|
||||
{
|
||||
// set push url for github projects
|
||||
if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
|
||||
|
@ -534,7 +534,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getCommitLogs($fromReference, $toReference, $path)
|
||||
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||
{
|
||||
$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));
|
||||
|
@ -553,7 +553,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function discardChanges($path)
|
||||
protected function discardChanges(string $path): PromiseInterface
|
||||
{
|
||||
$path = $this->normalizePath($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
|
||||
*/
|
||||
protected function stashChanges($path)
|
||||
protected function stashChanges(string $path): PromiseInterface
|
||||
{
|
||||
$path = $this->normalizePath($path);
|
||||
if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
|
||||
|
@ -591,7 +591,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function viewDiff($path)
|
||||
protected function viewDiff(string $path): void
|
||||
{
|
||||
$path = $this->normalizePath($path);
|
||||
if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
|
||||
|
@ -606,7 +606,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function normalizePath($path)
|
||||
protected function normalizePath(string $path): string
|
||||
{
|
||||
if (Platform::isWindows() && strlen($path) > 0) {
|
||||
$basePath = $path;
|
||||
|
@ -630,7 +630,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function hasMetadataRepository($path)
|
||||
protected function hasMetadataRepository(string $path): bool
|
||||
{
|
||||
$path = $this->normalizePath($path);
|
||||
|
||||
|
@ -641,7 +641,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
* @param string $reference
|
||||
* @return string
|
||||
*/
|
||||
protected function getShortHash($reference)
|
||||
protected function getShortHash(string $reference): string
|
||||
{
|
||||
if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
|
||||
return substr($reference, 0, 10);
|
||||
|
|
|
@ -24,7 +24,7 @@ use Composer\Util\ProcessExecutor;
|
|||
*/
|
||||
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);
|
||||
$targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
|
||||
|
@ -60,7 +60,7 @@ class GzipDownloader extends ArchiveDownloader
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function extractUsingExt($file, $targetFilepath): void
|
||||
private function extractUsingExt(string $file, string $targetFilepath): void
|
||||
{
|
||||
$archiveFile = gzopen($file, 'rb');
|
||||
$targetFile = fopen($targetFilepath, 'wb');
|
||||
|
|
|
@ -25,7 +25,7 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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)) {
|
||||
throw new \RuntimeException('hg was not found in your PATH, skipping source download');
|
||||
|
@ -37,11 +37,11 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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);
|
||||
|
||||
$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));
|
||||
};
|
||||
|
||||
|
@ -59,7 +59,7 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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);
|
||||
|
||||
|
@ -82,7 +82,7 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLocalChanges(PackageInterface $package, $path): ?string
|
||||
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
if (!is_dir($path.'/.hg')) {
|
||||
return null;
|
||||
|
@ -96,7 +96,7 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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));
|
||||
|
||||
|
@ -110,7 +110,7 @@ class HgDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function hasMetadataRepository($path): bool
|
||||
protected function hasMetadataRepository(string $path): bool
|
||||
{
|
||||
return is_dir($path . '/.hg');
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
/**
|
||||
* @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);
|
||||
$url = $package->getDistUrl();
|
||||
|
@ -75,7 +75,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
/**
|
||||
* @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);
|
||||
$url = $package->getDistUrl();
|
||||
|
@ -113,7 +113,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
} else {
|
||||
$absolutePath = $path;
|
||||
if (!$this->filesystem->isAbsolutePath($absolutePath)) {
|
||||
$absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
|
||||
$absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
|
||||
}
|
||||
$shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
|
||||
$path = rtrim($path, "/");
|
||||
|
@ -161,7 +161,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
/**
|
||||
* @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);
|
||||
/**
|
||||
|
@ -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
|
||||
// it points to
|
||||
$fs = new Filesystem;
|
||||
$absPath = $fs->isAbsolutePath($path) ? $path : getcwd() . '/' . $path;
|
||||
$absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : getcwd() . '/' . $package->getDistUrl();
|
||||
$absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
|
||||
$absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : Platform::getCwd() . '/' . $package->getDistUrl();
|
||||
if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
|
||||
|
@ -206,7 +206,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVcsReference(PackageInterface $package, $path): ?string
|
||||
public function getVcsReference(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
$path = Filesystem::trimTrailingSlash($path);
|
||||
$parser = new VersionParser;
|
||||
|
@ -224,7 +224,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path): string
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
|
||||
{
|
||||
$realUrl = realpath($package->getDistUrl());
|
||||
|
||||
|
@ -250,7 +250,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
*
|
||||
* @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
|
||||
$currentStrategy = self::STRATEGY_SYMLINK;
|
||||
|
|
|
@ -28,7 +28,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function doInstall(PackageInterface $package, $path, $url): ?PromiseInterface
|
||||
public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||
{
|
||||
$ref = $package->getSourceReference();
|
||||
$label = $this->getLabelFromSourceReference((string) $ref);
|
||||
|
@ -58,7 +58,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function getLabelFromSourceReference($ref): ?string
|
||||
private function getLabelFromSourceReference(string $ref): ?string
|
||||
{
|
||||
$pos = strpos($ref, '@');
|
||||
if (false !== $pos) {
|
||||
|
@ -74,7 +74,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initPerforce(PackageInterface $package, $path, $url): void
|
||||
public function initPerforce(PackageInterface $package, string $path, string $url): void
|
||||
{
|
||||
if (!empty($this->perforce)) {
|
||||
$this->perforce->initializePath($path);
|
||||
|
@ -101,7 +101,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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');
|
||||
|
||||
|
@ -119,7 +119,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getCommitLogs($fromReference, $toReference, $path): string
|
||||
protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
|
||||
{
|
||||
return $this->perforce->getCommitLogs($fromReference, $toReference);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function hasMetadataRepository($path): bool
|
||||
protected function hasMetadataRepository(string $path): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class PharDownloader extends ArchiveDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
||||
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||
{
|
||||
// Can throw an UnexpectedValueException
|
||||
$archive = new \Phar($file);
|
||||
|
|
|
@ -28,7 +28,7 @@ use RarArchive;
|
|||
*/
|
||||
class RarDownloader extends ArchiveDownloader
|
||||
{
|
||||
protected function extract(PackageInterface $package, $file, $path): ?PromiseInterface
|
||||
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||
{
|
||||
$processError = null;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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();
|
||||
$util = new SvnUtil($url, $this->io, $this->config, $this->process);
|
||||
|
@ -45,7 +45,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function doInstall(PackageInterface $package, $path, $url)
|
||||
protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
|
||||
{
|
||||
SvnUtil::cleanEnv();
|
||||
$ref = $package->getSourceReference();
|
||||
|
@ -67,7 +67,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
|
||||
protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
|
||||
{
|
||||
SvnUtil::cleanEnv();
|
||||
$ref = $target->getSourceReference();
|
||||
|
@ -91,7 +91,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLocalChanges(PackageInterface $package, $path)
|
||||
public function getLocalChanges(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
if (!$this->hasMetadataRepository($path)) {
|
||||
return null;
|
||||
|
@ -114,7 +114,7 @@ class SvnDownloader extends VcsDownloader
|
|||
* @throws \RuntimeException
|
||||
* @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->setCacheCredentials($this->cacheCredentials);
|
||||
|
@ -130,7 +130,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function cleanChanges(PackageInterface $package, $path, $update)
|
||||
protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
|
||||
{
|
||||
if (!$changes = $this->getLocalChanges($package, $path)) {
|
||||
return \React\Promise\resolve();
|
||||
|
@ -191,7 +191,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @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)) {
|
||||
// retrieve the svn base url from the checkout folder
|
||||
|
@ -236,7 +236,7 @@ class SvnDownloader extends VcsDownloader
|
|||
*
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
protected function discardChanges($path)
|
||||
protected function discardChanges(string $path): PromiseInterface
|
||||
{
|
||||
if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
|
||||
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
|
||||
|
@ -248,7 +248,7 @@ class SvnDownloader extends VcsDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function hasMetadataRepository($path)
|
||||
protected function hasMetadataRepository(string $path): bool
|
||||
{
|
||||
return is_dir($path.'/.svn');
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use React\Promise\PromiseInterface;
|
||||
|
||||
/**
|
||||
* Downloader for tar files: tar, tar.gz or tar.bz2
|
||||
|
@ -24,7 +25,7 @@ class TarDownloader extends ArchiveDownloader
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function extract(PackageInterface $package, $file, $path)
|
||||
protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||
{
|
||||
// Can throw an UnexpectedValueException
|
||||
$archive = new \PharData($file);
|
||||
|
|
|
@ -31,7 +31,7 @@ class TransportException extends \RuntimeException
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setHeaders($headers): void
|
||||
public function setHeaders(array $headers): void
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ class TransportException extends \RuntimeException
|
|||
}
|
||||
|
||||
/**
|
||||
* @param ?string $response
|
||||
* @param null|string $response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setResponse($response): void
|
||||
public function setResponse(?string $response): void
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
|
|
@ -28,5 +28,5 @@ interface VcsCapableDownloaderInterface
|
|||
* @param string $path package directory
|
||||
* @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
|
||||
*/
|
||||
public function getInstallationSource()
|
||||
public function getInstallationSource(): string
|
||||
{
|
||||
return 'source';
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null)
|
||||
public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
|
||||
{
|
||||
if (!$package->getSourceReference()) {
|
||||
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
||||
|
@ -93,7 +93,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @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') {
|
||||
$this->cleanChanges($prevPackage, $path, true);
|
||||
|
@ -110,7 +110,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @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()])) {
|
||||
$this->reapplyChanges($path);
|
||||
|
@ -123,7 +123,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function install(PackageInterface $package, $path)
|
||||
public function install(PackageInterface $package, string $path): PromiseInterface
|
||||
{
|
||||
if (!$package->getSourceReference()) {
|
||||
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
|
||||
|
@ -158,7 +158,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function update(PackageInterface $initial, PackageInterface $target, $path)
|
||||
public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
|
||||
{
|
||||
if (!$target->getSourceReference()) {
|
||||
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
|
||||
|
@ -194,12 +194,12 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
$message = 'Pulling in changes:';
|
||||
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
|
||||
|
||||
if (!trim($logs)) {
|
||||
if ('' === trim($logs)) {
|
||||
$message = 'Rolling back changes:';
|
||||
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
|
||||
}
|
||||
|
||||
if (trim($logs)) {
|
||||
if ('' !== trim($logs)) {
|
||||
$logs = implode("\n", array_map(function ($line): string {
|
||||
return ' ' . $line;
|
||||
}, explode("\n", $logs)));
|
||||
|
@ -222,13 +222,13 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function remove(PackageInterface $package, $path)
|
||||
public function remove(PackageInterface $package, string $path): PromiseInterface
|
||||
{
|
||||
$this->io->writeError(" - " . UninstallOperation::format($package));
|
||||
|
||||
$promise = $this->filesystem->removeDirectoryAsync($path);
|
||||
|
||||
return $promise->then(function ($result) use ($path) {
|
||||
return $promise->then(function (bool $result) use ($path) {
|
||||
if (!$result) {
|
||||
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVcsReference(PackageInterface $package, $path)
|
||||
public function getVcsReference(PackageInterface $package, string $path): ?string
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
$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
|
||||
*/
|
||||
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
|
||||
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
|
||||
*/
|
||||
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 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.
|
||||
|
@ -306,9 +306,9 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
* @param string $path download path
|
||||
* @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.
|
||||
|
@ -318,9 +318,9 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
* @param string $path download path
|
||||
* @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
|
||||
|
@ -330,7 +330,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
* @param string $path the package path
|
||||
* @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
|
||||
|
@ -339,7 +339,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function hasMetadataRepository($path);
|
||||
abstract protected function hasMetadataRepository(string $path): bool;
|
||||
|
||||
/**
|
||||
* @param string[] $urls
|
||||
|
|
|
@ -24,7 +24,7 @@ use Composer\Util\ProcessExecutor;
|
|||
*/
|
||||
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);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use Composer\Util\IniHelper;
|
|||
use Composer\Util\Platform;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
use Symfony\Component\Process\Process;
|
||||
use React\Promise\PromiseInterface;
|
||||
use ZipArchive;
|
||||
|
||||
|
@ -38,7 +39,7 @@ class ZipDownloader extends ArchiveDownloader
|
|||
/**
|
||||
* @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) {
|
||||
self::$unzipCommands = array();
|
||||
|
@ -105,7 +106,7 @@ class ZipDownloader extends ArchiveDownloader
|
|||
* @param string $path Path where to extract file
|
||||
* @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
|
||||
$isLastChance = !self::$hasZipArchive;
|
||||
|
@ -127,7 +128,7 @@ class ZipDownloader extends ArchiveDownloader
|
|||
$executable = $commandSpec[0];
|
||||
|
||||
$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) {
|
||||
throw $processError;
|
||||
}
|
||||
|
@ -148,7 +149,7 @@ class ZipDownloader extends ArchiveDownloader
|
|||
try {
|
||||
$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 (isset($this->cleanupExecuted[$package->getName()])) {
|
||||
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
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
private function extractWithZipArchive(PackageInterface $package, $file, $path): PromiseInterface
|
||||
private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
|
||||
{
|
||||
$processError = null;
|
||||
$zipArchive = $this->zipArchiveObject ?: new ZipArchive();
|
||||
|
@ -205,9 +206,9 @@ class ZipDownloader extends ArchiveDownloader
|
|||
*
|
||||
* @param string $file File to extract
|
||||
* @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);
|
||||
}
|
||||
|
@ -219,7 +220,7 @@ class ZipDownloader extends ArchiveDownloader
|
|||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
protected function getErrorMessage($retval, $file)
|
||||
protected function getErrorMessage(int $retval, string $file): string
|
||||
{
|
||||
switch ($retval) {
|
||||
case ZipArchive::ER_EXISTS:
|
||||
|
|
|
@ -46,7 +46,7 @@ class Event
|
|||
* @param string[] $args Arguments passed by the user
|
||||
* @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->args = $args;
|
||||
|
@ -58,7 +58,7 @@ class Event
|
|||
*
|
||||
* @return string The event name
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class Event
|
|||
*
|
||||
* @return string[] The event arguments
|
||||
*/
|
||||
public function getArguments()
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->args;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class Event
|
|||
*
|
||||
* @return mixed[] The event flags
|
||||
*/
|
||||
public function getFlags()
|
||||
public function getFlags(): array
|
||||
{
|
||||
return $this->flags;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class Event
|
|||
*
|
||||
* @return bool Whether propagation has been stopped
|
||||
*/
|
||||
public function isPropagationStopped()
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return $this->propagationStopped;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class Event
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function stopPropagation()
|
||||
public function stopPropagation(): void
|
||||
{
|
||||
$this->propagationStopped = true;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\EventDispatcher;
|
||||
|
||||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\DependencyResolver\Transaction;
|
||||
use Composer\Installer\InstallerEvent;
|
||||
use Composer\IO\IOInterface;
|
||||
|
@ -82,7 +81,7 @@ class EventDispatcher
|
|||
* @param bool $runScripts
|
||||
* @return $this
|
||||
*/
|
||||
public function setRunScripts($runScripts = true)
|
||||
public function setRunScripts(bool $runScripts = true): self
|
||||
{
|
||||
$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
|
||||
* 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) {
|
||||
$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
|
||||
* 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'));
|
||||
|
||||
|
@ -135,7 +134,7 @@ class EventDispatcher
|
|||
* @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
|
||||
*/
|
||||
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'));
|
||||
|
||||
|
@ -153,7 +152,7 @@ class EventDispatcher
|
|||
* @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
|
||||
*/
|
||||
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'));
|
||||
|
||||
|
@ -343,7 +342,7 @@ class EventDispatcher
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function executeTty($exec)
|
||||
protected function executeTty(string $exec): int
|
||||
{
|
||||
if ($this->io->isInteractive()) {
|
||||
return $this->process->executeTty($exec);
|
||||
|
@ -355,7 +354,7 @@ class EventDispatcher
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getPhpExecCommand()
|
||||
protected function getPhpExecCommand(): string
|
||||
{
|
||||
$finder = new PhpExecutableFinder();
|
||||
$phpPath = $finder->find(false);
|
||||
|
@ -378,7 +377,7 @@ class EventDispatcher
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function executeEventPhpScript($className, $methodName, Event $event)
|
||||
protected function executeEventPhpScript(string $className, string $methodName, Event $event)
|
||||
{
|
||||
if ($this->io->isVerbose()) {
|
||||
$this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
|
||||
|
@ -398,7 +397,7 @@ class EventDispatcher
|
|||
*
|
||||
* @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;
|
||||
}
|
||||
|
@ -408,7 +407,7 @@ class EventDispatcher
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeListener($listener)
|
||||
public function removeListener($listener): void
|
||||
{
|
||||
foreach ($this->listeners as $eventName => $priorities) {
|
||||
foreach ($priorities as $priority => $listeners) {
|
||||
|
@ -430,7 +429,7 @@ class EventDispatcher
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addSubscriber(EventSubscriberInterface $subscriber)
|
||||
public function addSubscriber(EventSubscriberInterface $subscriber): void
|
||||
{
|
||||
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
||||
if (is_string($params)) {
|
||||
|
@ -451,7 +450,7 @@ class EventDispatcher
|
|||
* @param Event $event
|
||||
* @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();
|
||||
|
||||
|
@ -472,7 +471,7 @@ class EventDispatcher
|
|||
* @param Event $event
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEventListeners(Event $event)
|
||||
public function hasEventListeners(Event $event): bool
|
||||
{
|
||||
$listeners = $this->getListeners($event);
|
||||
|
||||
|
@ -485,7 +484,7 @@ class EventDispatcher
|
|||
* @param Event $event Event object
|
||||
* @return string[] Listeners
|
||||
*/
|
||||
protected function getScriptListeners(Event $event)
|
||||
protected function getScriptListeners(Event $event): array
|
||||
{
|
||||
$package = $this->composer->getPackage();
|
||||
$scripts = $package->getScripts();
|
||||
|
@ -520,7 +519,7 @@ class EventDispatcher
|
|||
* @param string $callable
|
||||
* @return bool
|
||||
*/
|
||||
protected function isPhpScript($callable)
|
||||
protected function isPhpScript(string $callable): bool
|
||||
{
|
||||
return false === strpos($callable, ' ') && false !== strpos($callable, '::');
|
||||
}
|
||||
|
@ -531,7 +530,7 @@ class EventDispatcher
|
|||
* @param string $callable
|
||||
* @return bool
|
||||
*/
|
||||
protected function isComposerScript($callable)
|
||||
protected function isComposerScript(string $callable): bool
|
||||
{
|
||||
return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
|
||||
}
|
||||
|
@ -543,7 +542,7 @@ class EventDispatcher
|
|||
* @throws \RuntimeException
|
||||
* @return int
|
||||
*/
|
||||
protected function pushEvent(Event $event)
|
||||
protected function pushEvent(Event $event): int
|
||||
{
|
||||
$eventName = $event->getName();
|
||||
if (in_array($eventName, $this->eventStack)) {
|
||||
|
@ -558,7 +557,7 @@ class EventDispatcher
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function popEvent()
|
||||
protected function popEvent(): ?string
|
||||
{
|
||||
return array_pop($this->eventStack);
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ class Factory
|
|||
|
||||
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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
$cwd = $cwd ?: (string) getcwd();
|
||||
$cwd = $cwd ?? Platform::getCwd(true);
|
||||
|
||||
// load Composer configuration
|
||||
if (null === $localConfig) {
|
||||
|
@ -454,7 +454,7 @@ class Factory
|
|||
*
|
||||
* @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;
|
||||
if ($process) {
|
||||
|
@ -621,7 +621,7 @@ class Factory
|
|||
* @param mixed[] $options Array of options passed directly to HttpDownloader constructor
|
||||
* @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;
|
||||
$disableTls = false;
|
||||
|
|
|
@ -20,7 +20,7 @@ final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFil
|
|||
* @param string $req
|
||||
* @return bool
|
||||
*/
|
||||
public function isIgnored($req): bool
|
||||
public function isIgnored(string $req): bool
|
||||
{
|
||||
return PlatformRepository::isPlatformPackage($req);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
|
|||
* @param string $req
|
||||
* @return bool
|
||||
*/
|
||||
public function isIgnored($req): bool
|
||||
public function isIgnored(string $req): bool
|
||||
{
|
||||
if (!PlatformRepository::isPlatformPackage($req)) {
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
|
|||
* @param string $req
|
||||
* @return ConstraintInterface
|
||||
*/
|
||||
public function filterConstraint($req, ConstraintInterface $constraint): ConstraintInterface
|
||||
public function filterConstraint(string $req, ConstraintInterface $constraint): ConstraintInterface
|
||||
{
|
||||
if (!PlatformRepository::isPlatformPackage($req)) {
|
||||
return $constraint;
|
||||
|
|
|
@ -18,7 +18,7 @@ final class IgnoreNothingPlatformRequirementFilter implements PlatformRequiremen
|
|||
* @param string $req
|
||||
* @return false
|
||||
*/
|
||||
public function isIgnored($req): bool
|
||||
public function isIgnored(string $req): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -18,5 +18,5 @@ interface PlatformRequirementFilterInterface
|
|||
* @param string $req
|
||||
* @return bool
|
||||
*/
|
||||
public function isIgnored($req): bool;
|
||||
public function isIgnored(string $req): bool;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ abstract class BaseIO implements IOInterface
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ abstract class BaseIO implements IOInterface
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ abstract class BaseIO implements IOInterface
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
|
||||
protected function checkAndSetAuthentication(string $repositoryName, string $username, string $password = null)
|
||||
{
|
||||
if ($this->hasAuthentication($repositoryName)) {
|
||||
$auth = $this->getAuthentication($repositoryName);
|
||||
|
|
|
@ -35,7 +35,7 @@ class BufferIO extends ConsoleIO
|
|||
* @param int $verbosity
|
||||
* @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->setInteractive(false);
|
||||
|
|
|
@ -71,7 +71,7 @@ class ConsoleIO extends BaseIO
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enableDebugging($startTime)
|
||||
public function enableDebugging(float $startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class ConsoleIO extends BaseIO
|
|||
*
|
||||
* @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];
|
||||
if ($sfVerbosity > $this->output->getVerbosity()) {
|
||||
|
@ -194,7 +194,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class ConsoleIO extends BaseIO
|
|||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class ConsoleIO extends BaseIO
|
|||
*
|
||||
* @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 = implode($newline ? "\n" : '', (array) $messages);
|
||||
|
@ -258,7 +258,7 @@ class ConsoleIO extends BaseIO
|
|||
* @param int $max
|
||||
* @return ProgressBar
|
||||
*/
|
||||
public function getProgressBar($max = 0)
|
||||
public function getProgressBar(int $max = 0)
|
||||
{
|
||||
return new ProgressBar($this->getErrorOutput(), $max);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -83,7 +83,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -94,7 +94,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -105,7 +105,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -117,7 +117,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -129,7 +129,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -140,7 +140,7 @@ interface IOInterface extends LoggerInterface
|
|||
* @throws \RuntimeException If there is no data to read in the input stream
|
||||
* @return mixed The user answer
|
||||
*/
|
||||
public function ask($question, $default = null);
|
||||
public function ask(string $question, $default = null);
|
||||
|
||||
/**
|
||||
* Asks a confirmation to the user.
|
||||
|
@ -152,7 +152,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @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.
|
||||
|
@ -169,7 +169,7 @@ interface IOInterface extends LoggerInterface
|
|||
* @throws \Exception When any of the validators return an error
|
||||
* @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.
|
||||
|
@ -178,7 +178,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @return string|null The answer
|
||||
*/
|
||||
public function askAndHideAnswer($question);
|
||||
public function askAndHideAnswer(string $question);
|
||||
|
||||
/**
|
||||
* Asks the user to select a value.
|
||||
|
@ -193,7 +193,7 @@ interface IOInterface extends LoggerInterface
|
|||
* @throws \InvalidArgumentException
|
||||
* @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.
|
||||
|
@ -209,7 +209,7 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAuthentication($repositoryName);
|
||||
public function hasAuthentication(string $repositoryName);
|
||||
|
||||
/**
|
||||
* Get the username and password of repository.
|
||||
|
@ -218,18 +218,18 @@ interface IOInterface extends LoggerInterface
|
|||
*
|
||||
* @return array{username: string|null, password: string|null}
|
||||
*/
|
||||
public function getAuthentication($repositoryName);
|
||||
public function getAuthentication(string $repositoryName);
|
||||
|
||||
/**
|
||||
* Set the authentication information for the repository.
|
||||
*
|
||||
* @param string $repositoryName The unique name of repository
|
||||
* @param string $username The username
|
||||
* @param ?string $password The password
|
||||
* @param null|string $password The password
|
||||
*
|
||||
* @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
|
||||
|
|
|
@ -62,28 +62,28 @@ class NullIO extends BaseIO
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function write($messages, $newline = true, $verbosity = self::NORMAL): void
|
||||
public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function writeError($messages, $newline = true, $verbosity = self::NORMAL): void
|
||||
public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
|
|
|
@ -386,7 +386,7 @@ class Installer
|
|||
* @return int
|
||||
* @phpstan-return self::ERROR_*
|
||||
*/
|
||||
protected function doUpdate(InstalledRepositoryInterface $localRepo, $doInstall): int
|
||||
protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
|
||||
{
|
||||
$platformRepo = $this->createPlatformRepo(true);
|
||||
$aliases = $this->getRootAliases(true);
|
||||
|
@ -648,7 +648,7 @@ class Installer
|
|||
* @return int exit code
|
||||
* @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>');
|
||||
|
||||
|
@ -769,7 +769,7 @@ class Installer
|
|||
*
|
||||
* @return PlatformRepository
|
||||
*/
|
||||
protected function createPlatformRepo($forUpdate): PlatformRepository
|
||||
protected function createPlatformRepo(bool $forUpdate): PlatformRepository
|
||||
{
|
||||
if ($forUpdate) {
|
||||
$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
|
||||
*/
|
||||
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) {
|
||||
$minimumStability = $this->package->getMinimumStability();
|
||||
|
@ -858,7 +858,7 @@ class Installer
|
|||
*
|
||||
* @return DefaultPolicy
|
||||
*/
|
||||
private function createPolicy($forUpdate): DefaultPolicy
|
||||
private function createPolicy(bool $forUpdate): DefaultPolicy
|
||||
{
|
||||
$preferStable = null;
|
||||
$preferLowest = null;
|
||||
|
@ -919,7 +919,7 @@ class Installer
|
|||
*
|
||||
* @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 ($this->updateMirrors) {
|
||||
|
@ -953,7 +953,7 @@ class Installer
|
|||
*
|
||||
* @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) {
|
||||
$aliases = $this->package->getAliases();
|
||||
|
@ -1030,7 +1030,7 @@ class Installer
|
|||
* @param Composer $composer
|
||||
* @return Installer
|
||||
*/
|
||||
public static function create(IOInterface $io, Composer $composer): Installer
|
||||
public static function create(IOInterface $io, Composer $composer): self
|
||||
{
|
||||
return new static(
|
||||
$io,
|
||||
|
@ -1049,7 +1049,7 @@ class Installer
|
|||
* @param RepositoryInterface $additionalFixedRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository)
|
||||
public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
|
||||
{
|
||||
$this->additionalFixedRepository = $additionalFixedRepository;
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ class Installer
|
|||
* @param bool $dryRun
|
||||
* @return Installer
|
||||
*/
|
||||
public function setDryRun($dryRun = true): Installer
|
||||
public function setDryRun(bool $dryRun = true): self
|
||||
{
|
||||
$this->dryRun = (bool) $dryRun;
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ class Installer
|
|||
* @param bool $preferSource
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPreferSource($preferSource = true): Installer
|
||||
public function setPreferSource(bool $preferSource = true): self
|
||||
{
|
||||
$this->preferSource = (bool) $preferSource;
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ class Installer
|
|||
* @param bool $preferDist
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPreferDist($preferDist = true): Installer
|
||||
public function setPreferDist(bool $preferDist = true): self
|
||||
{
|
||||
$this->preferDist = (bool) $preferDist;
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ class Installer
|
|||
* @param bool $optimizeAutoloader
|
||||
* @return Installer
|
||||
*/
|
||||
public function setOptimizeAutoloader($optimizeAutoloader): Installer
|
||||
public function setOptimizeAutoloader(bool $optimizeAutoloader): self
|
||||
{
|
||||
$this->optimizeAutoloader = (bool) $optimizeAutoloader;
|
||||
if (!$this->optimizeAutoloader) {
|
||||
|
@ -1130,7 +1130,7 @@ class Installer
|
|||
* @param bool $classMapAuthoritative
|
||||
* @return Installer
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative): Installer
|
||||
public function setClassMapAuthoritative(bool $classMapAuthoritative): self
|
||||
{
|
||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||
if ($this->classMapAuthoritative) {
|
||||
|
@ -1148,7 +1148,7 @@ class Installer
|
|||
* @param string|null $apcuAutoloaderPrefix
|
||||
* @return Installer
|
||||
*/
|
||||
public function setApcuAutoloader($apcuAutoloader, $apcuAutoloaderPrefix = null): Installer
|
||||
public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
|
||||
{
|
||||
$this->apcuAutoloader = $apcuAutoloader;
|
||||
$this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
|
||||
|
@ -1162,7 +1162,7 @@ class Installer
|
|||
* @param bool $update
|
||||
* @return Installer
|
||||
*/
|
||||
public function setUpdate($update): Installer
|
||||
public function setUpdate(bool $update): self
|
||||
{
|
||||
$this->update = (bool) $update;
|
||||
|
||||
|
@ -1175,7 +1175,7 @@ class Installer
|
|||
* @param bool $install
|
||||
* @return Installer
|
||||
*/
|
||||
public function setInstall($install): Installer
|
||||
public function setInstall(bool $install): self
|
||||
{
|
||||
$this->install = (bool) $install;
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ class Installer
|
|||
* @param bool $devMode
|
||||
* @return Installer
|
||||
*/
|
||||
public function setDevMode($devMode = true): Installer
|
||||
public function setDevMode(bool $devMode = true): self
|
||||
{
|
||||
$this->devMode = (bool) $devMode;
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ class Installer
|
|||
* @param bool $dumpAutoloader
|
||||
* @return Installer
|
||||
*/
|
||||
public function setDumpAutoloader($dumpAutoloader = true): Installer
|
||||
public function setDumpAutoloader(bool $dumpAutoloader = true): self
|
||||
{
|
||||
$this->dumpAutoloader = (bool) $dumpAutoloader;
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ class Installer
|
|||
* @return Installer
|
||||
* @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;
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ class Installer
|
|||
* @param Config $config
|
||||
* @return Installer
|
||||
*/
|
||||
public function setConfig(Config $config): Installer
|
||||
public function setConfig(Config $config): self
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ class Installer
|
|||
* @param bool $verbose
|
||||
* @return Installer
|
||||
*/
|
||||
public function setVerbose($verbose = true): Installer
|
||||
public function setVerbose(bool $verbose = true): self
|
||||
{
|
||||
$this->verbose = (bool) $verbose;
|
||||
|
||||
|
@ -1275,7 +1275,7 @@ class Installer
|
|||
*
|
||||
* @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);
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ class Installer
|
|||
* @param PlatformRequirementFilterInterface $platformRequirementFilter
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): Installer
|
||||
public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
|
||||
{
|
||||
$this->platformRequirementFilter = $platformRequirementFilter;
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ class Installer
|
|||
* @param bool $updateMirrors
|
||||
* @return Installer
|
||||
*/
|
||||
public function setUpdateMirrors($updateMirrors): Installer
|
||||
public function setUpdateMirrors(bool $updateMirrors): self
|
||||
{
|
||||
$this->updateMirrors = $updateMirrors;
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ class Installer
|
|||
*
|
||||
* @return Installer
|
||||
*/
|
||||
public function setUpdateAllowList(array $packages): Installer
|
||||
public function setUpdateAllowList(array $packages): self
|
||||
{
|
||||
$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
|
||||
* @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)) {
|
||||
throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
|
||||
|
@ -1347,7 +1347,7 @@ class Installer
|
|||
* @param bool $preferStable
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPreferStable($preferStable = true): Installer
|
||||
public function setPreferStable(bool $preferStable = true): self
|
||||
{
|
||||
$this->preferStable = (bool) $preferStable;
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ class Installer
|
|||
* @param bool $preferLowest
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPreferLowest($preferLowest = true): Installer
|
||||
public function setPreferLowest(bool $preferLowest = true): self
|
||||
{
|
||||
$this->preferLowest = (bool) $preferLowest;
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ class Installer
|
|||
* @param bool $writeLock
|
||||
* @return Installer
|
||||
*/
|
||||
public function setWriteLock($writeLock = true): Installer
|
||||
public function setWriteLock(bool $writeLock = true): self
|
||||
{
|
||||
$this->writeLock = (bool) $writeLock;
|
||||
|
||||
|
@ -1390,7 +1390,7 @@ class Installer
|
|||
* @param bool $executeOperations
|
||||
* @return Installer
|
||||
*/
|
||||
public function setExecuteOperations($executeOperations = true): Installer
|
||||
public function setExecuteOperations(bool $executeOperations = true): self
|
||||
{
|
||||
$this->executeOperations = (bool) $executeOperations;
|
||||
|
||||
|
@ -1406,7 +1406,7 @@ class Installer
|
|||
*
|
||||
* @return Installer
|
||||
*/
|
||||
public function disablePlugins(): Installer
|
||||
public function disablePlugins(): self
|
||||
{
|
||||
$this->installationManager->disablePlugins();
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ class Installer
|
|||
* @param SuggestedPackagesReporter $suggestedPackagesReporter
|
||||
* @return Installer
|
||||
*/
|
||||
public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): Installer
|
||||
public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
|
||||
{
|
||||
$this->suggestedPackagesReporter = $suggestedPackagesReporter;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class BinaryInstaller
|
|||
* @param Filesystem $filesystem
|
||||
* @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->binCompat = $binCompat;
|
||||
|
@ -62,7 +62,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @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);
|
||||
if (!$binaries) {
|
||||
|
@ -149,7 +149,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function determineBinaryCaller($bin): string
|
||||
public static function determineBinaryCaller(string $bin): string
|
||||
{
|
||||
if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
|
||||
return 'call';
|
||||
|
@ -180,7 +180,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @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
|
||||
if ('.bat' !== substr($binPath, -4)) {
|
||||
|
@ -202,7 +202,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function installUnixyProxyBinaries($binPath, $link): void
|
||||
protected function installUnixyProxyBinaries(string $binPath, string $link): void
|
||||
{
|
||||
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
|
||||
Silencer::call('chmod', $link, 0777 & ~umask());
|
||||
|
@ -223,7 +223,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateWindowsProxyCode($bin, $link): string
|
||||
protected function generateWindowsProxyCode(string $bin, string $link): string
|
||||
{
|
||||
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
||||
$caller = self::determineBinaryCaller($bin);
|
||||
|
@ -252,7 +252,7 @@ class BinaryInstaller
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateUnixyProxyCode($bin, $link): string
|
||||
protected function generateUnixyProxyCode(string $bin, string $link): string
|
||||
{
|
||||
$binPath = $this->filesystem->findShortestPath($link, $bin);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class InstallationManager
|
|||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
public function reset(): void
|
||||
{
|
||||
$this->notifiablePackages = array();
|
||||
FileDownloader::$downloadMetadata = array();
|
||||
|
@ -76,7 +76,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addInstaller(InstallerInterface $installer)
|
||||
public function addInstaller(InstallerInterface $installer): void
|
||||
{
|
||||
array_unshift($this->installers, $installer);
|
||||
$this->cache = array();
|
||||
|
@ -89,7 +89,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeInstaller(InstallerInterface $installer)
|
||||
public function removeInstaller(InstallerInterface $installer): void
|
||||
{
|
||||
if (false !== ($key = array_search($installer, $this->installers, true))) {
|
||||
array_splice($this->installers, $key, 1);
|
||||
|
@ -106,7 +106,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disablePlugins()
|
||||
public function disablePlugins(): void
|
||||
{
|
||||
foreach ($this->installers as $i => $installer) {
|
||||
if (!$installer instanceof PluginInstaller) {
|
||||
|
@ -125,7 +125,7 @@ class InstallationManager
|
|||
* @throws \InvalidArgumentException if installer for provided type is not registered
|
||||
* @return InstallerInterface
|
||||
*/
|
||||
public function getInstaller($type)
|
||||
public function getInstaller(string $type): InstallerInterface
|
||||
{
|
||||
$type = strtolower($type);
|
||||
|
||||
|
@ -150,7 +150,7 @@ class InstallationManager
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
|
||||
{
|
||||
if ($package instanceof AliasPackage) {
|
||||
return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
|
||||
|
@ -167,7 +167,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ensureBinariesPresence(PackageInterface $package)
|
||||
public function ensureBinariesPresence(PackageInterface $package): void
|
||||
{
|
||||
try {
|
||||
$installer = $this->getInstaller($package->getType());
|
||||
|
@ -192,7 +192,7 @@ class InstallationManager
|
|||
*
|
||||
* @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[] */
|
||||
$cleanupPromises = array();
|
||||
|
@ -316,7 +316,7 @@ class InstallationManager
|
|||
*
|
||||
* @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();
|
||||
|
||||
|
@ -400,7 +400,7 @@ class InstallationManager
|
|||
*
|
||||
* @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();
|
||||
$postExecCallbacks = array();
|
||||
|
@ -511,7 +511,7 @@ class InstallationManager
|
|||
*
|
||||
* @return PromiseInterface|null
|
||||
*/
|
||||
public function install(InstalledRepositoryInterface $repo, InstallOperation $operation)
|
||||
public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
|
||||
{
|
||||
$package = $operation->getPackage();
|
||||
$installer = $this->getInstaller($package->getType());
|
||||
|
@ -529,7 +529,7 @@ class InstallationManager
|
|||
*
|
||||
* @return PromiseInterface|null
|
||||
*/
|
||||
public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation)
|
||||
public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
|
||||
{
|
||||
$initial = $operation->getInitialPackage();
|
||||
$target = $operation->getTargetPackage();
|
||||
|
@ -569,7 +569,7 @@ class InstallationManager
|
|||
*
|
||||
* @return PromiseInterface|null
|
||||
*/
|
||||
public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation)
|
||||
public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
|
||||
{
|
||||
$package = $operation->getPackage();
|
||||
$installer = $this->getInstaller($package->getType());
|
||||
|
@ -585,7 +585,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation)
|
||||
public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
|
||||
{
|
||||
$package = $operation->getPackage();
|
||||
|
||||
|
@ -602,7 +602,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
|
||||
public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
|
||||
{
|
||||
$package = $operation->getPackage();
|
||||
|
||||
|
@ -615,7 +615,7 @@ class InstallationManager
|
|||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
*/
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
public function getInstallPath(PackageInterface $package): string
|
||||
{
|
||||
$installer = $this->getInstaller($package->getType());
|
||||
|
||||
|
@ -627,7 +627,7 @@ class InstallationManager
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutputProgress($outputProgress)
|
||||
public function setOutputProgress(bool $outputProgress): void
|
||||
{
|
||||
$this->outputProgress = $outputProgress;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ class InstallationManager
|
|||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function notifyInstalls(IOInterface $io)
|
||||
public function notifyInstalls(IOInterface $io): void
|
||||
{
|
||||
$promises = array();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class InstallerEvent extends Event
|
|||
* @param bool $executeOperations
|
||||
* @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);
|
||||
|
||||
|
@ -68,7 +68,7 @@ class InstallerEvent extends Event
|
|||
/**
|
||||
* @return Composer
|
||||
*/
|
||||
public function getComposer()
|
||||
public function getComposer(): Composer
|
||||
{
|
||||
return $this->composer;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class InstallerEvent extends Event
|
|||
/**
|
||||
* @return IOInterface
|
||||
*/
|
||||
public function getIO()
|
||||
public function getIO(): IOInterface
|
||||
{
|
||||
return $this->io;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class InstallerEvent extends Event
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDevMode()
|
||||
public function isDevMode(): bool
|
||||
{
|
||||
return $this->devMode;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class InstallerEvent extends Event
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isExecutingOperations()
|
||||
public function isExecutingOperations(): bool
|
||||
{
|
||||
return $this->executeOperations;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class InstallerEvent extends Event
|
|||
/**
|
||||
* @return Transaction|null
|
||||
*/
|
||||
public function getTransaction()
|
||||
public function getTransaction(): ?Transaction
|
||||
{
|
||||
return $this->transaction;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ interface InstallerInterface
|
|||
* @param string $packageType
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($packageType);
|
||||
public function supports(string $packageType);
|
||||
|
||||
/**
|
||||
* Checks that provided package is installed.
|
||||
|
@ -65,7 +65,7 @@ interface InstallerInterface
|
|||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||
* @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.
|
||||
|
@ -108,7 +108,7 @@ interface InstallerInterface
|
|||
* @param PackageInterface $prevPackage previous package instance in case of an update
|
||||
* @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.
|
||||
|
|
|
@ -56,7 +56,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
|
|||
* @param Filesystem $filesystem
|
||||
* @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->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
|
||||
|
|
|
@ -66,7 +66,7 @@ class PackageEvent extends Event
|
|||
* @param OperationInterface[] $operations
|
||||
* @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);
|
||||
|
||||
|
@ -81,7 +81,7 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* @return Composer
|
||||
*/
|
||||
public function getComposer()
|
||||
public function getComposer(): Composer
|
||||
{
|
||||
return $this->composer;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* @return IOInterface
|
||||
*/
|
||||
public function getIO()
|
||||
public function getIO(): IOInterface
|
||||
{
|
||||
return $this->io;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDevMode()
|
||||
public function isDevMode(): bool
|
||||
{
|
||||
return $this->devMode;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public function getLocalRepo()
|
||||
public function getLocalRepo(): RepositoryInterface
|
||||
{
|
||||
return $this->localRepo;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* @return OperationInterface[]
|
||||
*/
|
||||
public function getOperations()
|
||||
public function getOperations(): array
|
||||
{
|
||||
return $this->operations;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class PackageEvent extends Event
|
|||
*
|
||||
* @return OperationInterface
|
||||
*/
|
||||
public function getOperation()
|
||||
public function getOperation(): OperationInterface
|
||||
{
|
||||
return $this->operation;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class ProjectInstaller implements InstallerInterface
|
|||
/**
|
||||
* @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->downloadManager = $dm;
|
||||
|
@ -49,7 +49,7 @@ class ProjectInstaller implements InstallerInterface
|
|||
* @param string $packageType
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($packageType): bool
|
||||
public function supports(string $packageType): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue