1
0
Fork 0
pull/9935/head
Jordi Boggiano 2021-06-03 10:38:38 +02:00
parent 10e634890e
commit 4c9e75c6e5
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
35 changed files with 62 additions and 71 deletions

View File

@ -133,7 +133,7 @@ EOT
$options['autoload'] = (object) array(
'psr-4' => array(
$namespace . '\\' => $autoloadPath,
)
),
);
}
@ -444,7 +444,6 @@ EOT
$autoload
);
$input->setOption('autoload', $autoload);
}
/**
@ -673,9 +672,10 @@ EOT
}
$namespace = array_map(
function($part) {
function ($part) {
$part = preg_replace('/[^a-z0-9]/i', ' ', $part);
$part = ucwords($part);
return str_replace(' ', '', $part);
},
explode('/', $packageName)

View File

@ -91,6 +91,7 @@ EOT
if (!$packagesToReinstall) {
$io->writeError('<warning>Found no packages to reinstall, aborting.</warning>');
return 1;
}

View File

@ -36,13 +36,11 @@ use Composer\Repository\RootPackageRepository;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Semver;
use Composer\Spdx\SpdxLicenses;
use Composer\Util\Platform;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Terminal;
/**
* @author Robert Schönthal <seroscho@googlemail.com>

View File

@ -23,8 +23,8 @@ class GenericRule extends Rule
protected $literals;
/**
* @param array $literals
* @param int|null $reason A RULE_* constant describing the reason for generating this rule
* @param array $literals
* @param int|null $reason A RULE_* constant describing the reason for generating this rule
* @param Link|BasePackage|int|null $reasonData
*/
public function __construct(array $literals, $reason, $reasonData)

View File

@ -25,8 +25,8 @@ class MultiConflictRule extends Rule
protected $literals;
/**
* @param array $literals
* @param int $reason A RULE_* constant describing the reason for generating this rule
* @param array $literals
* @param int $reason A RULE_* constant describing the reason for generating this rule
* @param Link|BasePackage $reasonData
*/
public function __construct(array $literals, $reason, $reasonData)

View File

@ -441,7 +441,7 @@ class Problem
if ($topPackage instanceof RootPackageInterface) {
return array(
"- Root composer.json requires $packageName".self::constraintToText($constraint).', it is ',
'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.'
'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
);
}
}
@ -450,7 +450,7 @@ class Problem
$singular = count($higherRepoPackages) === 1;
return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ',
'found '.self::getPackageList($nextRepoPackages, $isVerbose).' in the lock file and '.self::getPackageList($higherRepoPackages, $isVerbose).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. Make sure you either fix the '.$reason.' or avoid updating this package to keep the one from the lock file.');
'found '.self::getPackageList($nextRepoPackages, $isVerbose).' in the lock file and '.self::getPackageList($higherRepoPackages, $isVerbose).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. Make sure you either fix the '.$reason.' or avoid updating this package to keep the one from the lock file.', );
}
return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages with higher priority do not match your '.$reason.' and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.');

View File

@ -243,7 +243,6 @@ abstract class Rule
}
}
return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';
case self::RULE_PACKAGE_REQUIRES:

View File

@ -24,9 +24,9 @@ class Rule2Literals extends Rule
protected $literal2;
/**
* @param int $literal1
* @param int $literal2
* @param int $reason A RULE_* constant describing the reason for generating this rule
* @param int $literal1
* @param int $literal2
* @param int $reason A RULE_* constant describing the reason for generating this rule
* @param Link|BasePackage $reasonData
*/
public function __construct($literal1, $literal2, $reason, $reasonData)

View File

@ -44,9 +44,9 @@ class RuleSetGenerator
* @param BasePackage $package The package with a requirement
* @param array $providers The providers of the requirement
* @param int $reason A RULE_* constant describing the
* reason for generating this rule
* reason for generating this rule
* @param mixed $reasonData Any data, e.g. the requirement name,
* that goes with the reason
* that goes with the reason
* @return Rule|null The generated rule or null if tautological
*/
protected function createRequireRule(BasePackage $package, array $providers, $reason, $reasonData = null)
@ -95,9 +95,9 @@ class RuleSetGenerator
* @param BasePackage $issuer The package declaring the conflict
* @param BasePackage $provider The package causing the conflict
* @param int $reason A RULE_* constant describing the
* reason for generating this rule
* reason for generating this rule
* @param mixed $reasonData Any data, e.g. the package name, that
* goes with the reason
* goes with the reason
* @return Rule|null The generated rule
*/
protected function createRule2Literals(BasePackage $issuer, BasePackage $provider, $reason, $reasonData = null)

View File

@ -115,8 +115,8 @@ abstract class ArchiveDownloader extends FileDownloader
* that the source directory gets merged into the target one if the target exists. Otherwise rename() by default would
* put the source into the target e.g. src/ => target/src/ (assuming target exists) instead of src/ => target/
*
* @param string $from Directory
* @param string $to Directory
* @param string $from Directory
* @param string $to Directory
* @return void
*/
$renameRecursively = function ($from, $to) use ($filesystem, $getFolderContent, $package, &$renameRecursively) {

View File

@ -77,5 +77,5 @@ class RarDownloader extends ArchiveDownloader
$rarArchive->close();
return \React\Promise\resolve();
}
}
}

View File

@ -76,8 +76,8 @@ class ZipDownloader extends ArchiveDownloader
/**
* extract $file to $path with "unzip" command
*
* @param string $file File to extract
* @param string $path Path where to extract file
* @param string $file File to extract
* @param string $path Path where to extract file
* @return PromiseInterface
*/
private function extractWithSystemUnzip(PackageInterface $package, $file, $path)
@ -136,8 +136,8 @@ class ZipDownloader extends ArchiveDownloader
/**
* extract $file to $path with ZipArchive
*
* @param string $file File to extract
* @param string $path Path where to extract file
* @param string $file File to extract
* @param string $path Path where to extract file
* @return PromiseInterface
*
* TODO v3 should make this private once we can drop PHP 5.3 support

View File

@ -126,7 +126,7 @@ class Factory
if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
}
return $userDir . '/Library/Caches/composer';
}

View File

@ -16,7 +16,6 @@ use Composer\IO\IOInterface;
use Composer\IO\ConsoleIO;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\Operation\InstallOperation;

View File

@ -98,9 +98,9 @@ class SuggestedPackagesReporter
*
* Do not list the ones already installed if installed repository provided.
*
* @param int $mode One of the MODE_* constants from this class
* @param InstalledRepository|null $installedRepo If passed in, suggested packages which are installed already will be skipped
* @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown
* @param int $mode One of the MODE_* constants from this class
* @param InstalledRepository|null $installedRepo If passed in, suggested packages which are installed already will be skipped
* @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown
* @return void
*/
public function output($mode, InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null)
@ -165,8 +165,8 @@ class SuggestedPackagesReporter
/**
* Output number of new suggested packages and a hint to use suggest command.
*
* @param InstalledRepository|null $installedRepo If passed in, suggested packages which are installed already will be skipped
* @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown
* @param InstalledRepository|null $installedRepo If passed in, suggested packages which are installed already will be skipped
* @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown
* @return void
*/
public function outputMinimalistic(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null)

View File

@ -43,9 +43,9 @@ class AliasPackage extends BasePackage
/**
* All descendants' constructors should call this parent constructor
*
* @param BasePackage $aliasOf The package this package is an alias of
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
* @param BasePackage $aliasOf The package this package is an alias of
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
*/
public function __construct(BasePackage $aliasOf, $version, $prettyVersion)
{

View File

@ -13,7 +13,6 @@
namespace Composer\Package\Archiver;
use Composer\Downloader\DownloadManager;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Util\Filesystem;
use Composer\Util\Loop;

View File

@ -24,8 +24,8 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
* All descendants' constructors should call this parent constructor
*
* @param CompletePackage $aliasOf The package this package is an alias of
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
*/
public function __construct(CompletePackage $aliasOf, $version, $prettyVersion)
{

View File

@ -27,7 +27,7 @@ interface CompletePackageInterface extends PackageInterface
public function getScripts();
/**
* @param array<string, string[]> $scripts
* @param array<string, string[]> $scripts
* @return void
*/
public function setScripts(array $scripts);
@ -205,6 +205,4 @@ interface CompletePackageInterface extends PackageInterface
* @return void
*/
public function setArchiveExcludes(array $excludes);
}

View File

@ -77,9 +77,9 @@ class Link
*
* @param string $source
* @param string $target
* @param ConstraintInterface $constraint Constraint applying to the target of this link
* @param self::TYPE_* $description Used to create a descriptive string representation
* @param string|null $prettyConstraint
* @param ConstraintInterface $constraint Constraint applying to the target of this link
* @param self::TYPE_* $description Used to create a descriptive string representation
* @param string|null $prettyConstraint
*/
public function __construct(
$source,

View File

@ -80,7 +80,7 @@ class ArrayLoader implements LoaderInterface
/**
* @template PackageClass of CompletePackageInterface
* @param array $versions
* @param string $class FQCN to be instantiated
* @param string $class FQCN to be instantiated
* @return list<CompletePackage|CompleteAliasPackage>
* @phpstan-param class-string<PackageClass> $class
*/

View File

@ -13,11 +13,9 @@
namespace Composer\Package\Loader;
use Composer\Package\BasePackage;
use Composer\Package\AliasPackage;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Package\Package;
use Composer\Package\RootPackageInterface;
use Composer\Package\RootAliasPackage;
use Composer\Repository\RepositoryFactory;
use Composer\Package\Version\VersionGuesser;

View File

@ -24,8 +24,8 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
* All descendants' constructors should call this parent constructor
*
* @param RootPackageInterface $aliasOf The package this package is an alias of
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
*/
public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
{

View File

@ -477,7 +477,7 @@ class PluginManager
/**
* @template CapabilityClass of Capability
* @param PluginInterface $plugin
* @param PluginInterface $plugin
* @param class-string<CapabilityClass> $capabilityClassName The fully qualified name of the API interface which the plugin may provide
* an implementation of.
* @param array $ctorArgs Arguments passed to Capability's constructor.
@ -509,12 +509,12 @@ class PluginManager
return null;
}
/**
/**
* @template CapabilityClass of Capability
* @param class-string<CapabilityClass> $capabilityClassName The fully qualified name of the API interface which the plugin may provide
* an implementation of.
* @param array $ctorArgs Arguments passed to Capability's constructor.
* Keeping it an array will allow future values to be passed w\o changing the signature.
* an implementation of.
* @param array $ctorArgs Arguments passed to Capability's constructor.
* Keeping it an array will allow future values to be passed w\o changing the signature.
* @return CapabilityClass[]
*/
public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())

View File

@ -50,12 +50,12 @@ class PostFileDownloadEvent extends Event
/**
* Constructor.
*
* @param string $name The event name
* @param string|null $fileName The file name
* @param string|null $checksum The checksum
* @param string $url The processed url
* @param string $type The type (package or metadata).
* @param mixed $context Additional context for the download.
* @param string $name The event name
* @param string|null $fileName The file name
* @param string|null $checksum The checksum
* @param string $url The processed url
* @param string $type The type (package or metadata).
* @param mixed $context Additional context for the download.
*/
public function __construct($name, $fileName, $checksum, $url, $type, $context = null)
{

View File

@ -14,7 +14,6 @@ namespace Composer\Repository;
use Composer\Json\JsonFile;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Package\AliasPackage;
use Composer\Package\Dumper\ArrayDumper;

View File

@ -72,8 +72,8 @@ interface RepositoryInterface extends \Countable
*
* @param ConstraintInterface[] $packageNameMap package names pointing to constraints
* @param array<string, BasePackage::STABILITY_*> $acceptableStabilities array of stability => BasePackage::STABILITY_* value
* @param array<string, BasePackage::STABILITY_*> $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @param array<string, array<string, PackageInterface>> $alreadyLoaded an array of package name => package version => package
* @param array<string, BasePackage::STABILITY_*> $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @param array<string, array<string, PackageInterface>> $alreadyLoaded an array of package name => package version => package
*
* @return array{namesFound: string[], packages: PackageInterface[]}
*/

View File

@ -228,6 +228,7 @@ class GitLabDriver extends VcsDriver
if ($this->protocol) {
return $this->project["{$this->protocol}_url_to_repo"];
}
return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
}

View File

@ -606,7 +606,7 @@ class Filesystem
* This will also check for readability by reading the file as is_readable can not be trusted on network-mounts
* and \\wsl$ paths. See https://github.com/composer/composer/issues/8231 and https://bugs.php.net/bug.php?id=68926
*
* @param string $path
* @param string $path
* @return bool
*/
public static function isReadable($path)

View File

@ -12,7 +12,6 @@
namespace Composer\Util;
use Composer\Package\Link;
use Composer\Package\PackageInterface;
class PackageSorter

View File

@ -42,7 +42,6 @@ class Platform
* putenv('X') equivalent but updates the runtime global variables too
*
* @param string $name
* @param string $value
* @return void
*/
public static function clearEnv($name)
@ -103,7 +102,7 @@ class Platform
{
if (null === self::$isWindowsSubsystemForLinux) {
self::$isWindowsSubsystemForLinux = false;
// while WSL will be hosted within windows, WSL itself cannot be windows based itself.
if (self::isWindows()) {
return self::$isWindowsSubsystemForLinux = false;

View File

@ -260,9 +260,11 @@ class ProcessExecutor
}
} catch (\Exception $e) {
call_user_func($job['reject'], $e);
return;
} catch (\Throwable $e) {
call_user_func($job['reject'], $e);
return;
}
@ -272,9 +274,11 @@ class ProcessExecutor
$process->start();
} catch (\Exception $e) {
call_user_func($job['reject'], $e);
return;
} catch (\Throwable $e) {
call_user_func($job['reject'], $e);
return;
}
}

View File

@ -113,5 +113,4 @@ class InitCommandTest extends TestCase
$namespace = $command->namespaceFromPackageName(null);
$this->assertNull($namespace);
}
}

View File

@ -85,7 +85,6 @@ class ZipDownloaderTest extends TestCase
$downloader = new ZipDownloader($this->io, $this->config, $this->httpDownloader);
try {
$loop = new Loop($this->httpDownloader);
$promise = $downloader->download($this->package, $path = sys_get_temp_dir().'/composer-zip-test');

View File

@ -13,7 +13,6 @@
namespace Composer\Test\Mock;
use Composer\Installer\InstallationManager;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\IO\IOInterface;