1
0
Fork 0
pull/9517/head
Jordi Boggiano 2020-11-22 14:48:56 +01:00
parent 152694b574
commit b7d770659b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
175 changed files with 688 additions and 724 deletions

View File

@ -695,6 +695,7 @@ EOF;
$version = str_replace('-', '.', $bound->getVersion()); $version = str_replace('-', '.', $bound->getVersion());
$chunks = array_map('intval', explode('.', $version)); $chunks = array_map('intval', explode('.', $version));
return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2]; return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
}; };
@ -710,6 +711,7 @@ EOF;
$version = str_replace('-', '.', $bound->getVersion()); $version = str_replace('-', '.', $bound->getVersion());
$chunks = explode('.', $version); $chunks = explode('.', $version);
$chunks = array_slice($chunks, 0, 3); $chunks = array_slice($chunks, 0, 3);
return implode('.', $chunks); return implode('.', $chunks);
}; };

View File

@ -51,7 +51,7 @@ class ClassMapGenerator
* Iterate over all files in the given directory searching for classes * Iterate over all files in the given directory searching for classes
* *
* @param \Iterator|string $path The path to search in or an iterator * @param \Iterator|string $path The path to search in or an iterator
* @param string $excluded Regex that matches against the file path that exclude from the classmap. * @param string $excluded Regex that matches against the file path that exclude from the classmap.
* @param IOInterface $io IO object * @param IOInterface $io IO object
* @param string $namespace Optional namespace prefix to filter by * @param string $namespace Optional namespace prefix to filter by
* @param string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules * @param string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
@ -147,13 +147,13 @@ class ClassMapGenerator
/** /**
* Remove classes which could not have been loaded by namespace autoloaders * Remove classes which could not have been loaded by namespace autoloaders
* *
* @param array $classes found classes in given file * @param array $classes found classes in given file
* @param string $filePath current file * @param string $filePath current file
* @param string $baseNamespace prefix of given autoload mapping * @param string $baseNamespace prefix of given autoload mapping
* @param string $namespaceType psr-0|psr-4 * @param string $namespaceType psr-0|psr-4
* @param string $basePath root directory of given autoload mapping * @param string $basePath root directory of given autoload mapping
* @param IOInterface $io IO object * @param IOInterface $io IO object
* @return array valid classes * @return array valid classes
*/ */
private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io) private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
{ {
@ -176,8 +176,7 @@ class ClassMapGenerator
$className = substr($class, $namespaceLength + 1); $className = substr($class, $namespaceLength + 1);
$subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
. str_replace('_', DIRECTORY_SEPARATOR, $className); . str_replace('_', DIRECTORY_SEPARATOR, $className);
} } else {
else {
$subPath = str_replace('_', DIRECTORY_SEPARATOR, $class); $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
} }
} elseif ('psr-4' === $namespaceType) { } elseif ('psr-4' === $namespaceType) {

View File

@ -209,6 +209,7 @@ class Cache
{ {
if ($this->enabled) { if ($this->enabled) {
$this->filesystem->emptyDirectory($this->root); $this->filesystem->emptyDirectory($this->root);
return true; return true;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\PackageInterface;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;

View File

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\Factory; use Composer\Factory;
use Composer\Installer; use Composer\Installer;
use Composer\Installer\ProjectInstaller; use Composer\Installer\ProjectInstaller;
use Composer\Installer\InstallationManager;
use Composer\Installer\SuggestedPackagesReporter; use Composer\Installer\SuggestedPackagesReporter;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
@ -39,9 +38,7 @@ use Composer\Json\JsonFile;
use Composer\Config\JsonConfigSource; use Composer\Config\JsonConfigSource;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Loop;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\EventDispatcher\EventDispatcher;
/** /**
* Install a package as new project into new directory. * Install a package as new project into new directory.

View File

@ -677,7 +677,6 @@ EOT
return !$warnings && !$errors ? true : $output; return !$warnings && !$errors ? true : $output;
} }
/** /**
* Check if allow_url_fopen is ON * Check if allow_url_fopen is ON
* *

View File

@ -18,7 +18,6 @@ use Composer\Package\BasePackage;
use Composer\Semver\Constraint\MatchAllConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Repository\CompositeRepository; use Composer\Repository\CompositeRepository;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**

View File

@ -845,7 +845,6 @@ EOT
} catch (\Exception $e) { } catch (\Exception $e) {
$this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.'); $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
} }
} }
private function hasDependencies($options) private function hasDependencies($options)

View File

@ -275,6 +275,7 @@ EOT
foreach ($packages as $package) { foreach ($packages as $package) {
if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) { if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
$io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>'); $io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
return 2; return 2;
} }
} }

View File

@ -269,7 +269,6 @@ EOT
$rootPackage->setDevRequires($links['require-dev']); $rootPackage->setDevRequires($links['require-dev']);
} }
$updateDevMode = !$input->getOption('update-no-dev'); $updateDevMode = !$input->getOption('update-no-dev');
$optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader'); $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
$authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative'); $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');

View File

@ -397,11 +397,11 @@ TAGSPUBKEY
/** /**
* Checks if the downloaded/rollback phar is valid then moves it * Checks if the downloaded/rollback phar is valid then moves it
* *
* @param string $localFilename The composer.phar location * @param string $localFilename The composer.phar location
* @param string $newFilename The downloaded or backup phar * @param string $newFilename The downloaded or backup phar
* @param string $backupTarget The filename to use for the backup * @param string $backupTarget The filename to use for the backup
* @throws FilesystemException If the file cannot be moved * @throws FilesystemException If the file cannot be moved
* @return bool Whether the phar is valid and has been moved * @return bool Whether the phar is valid and has been moved
*/ */
protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null) protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
{ {
@ -482,14 +482,14 @@ TAGSPUBKEY
/** /**
* Validates the downloaded/backup phar file * Validates the downloaded/backup phar file
* *
* @param string $pharFile The downloaded or backup phar * @param string $pharFile The downloaded or backup phar
* @param null|string $error Set by method on failure * @param null|string $error Set by method on failure
* *
* Code taken from getcomposer.org/installer. Any changes should be made * Code taken from getcomposer.org/installer. Any changes should be made
* there and replicated here * there and replicated here
* *
* @return bool If the operation succeeded
* @throws \Exception * @throws \Exception
* @return bool If the operation succeeded
*/ */
protected function validatePhar($pharFile, &$error) protected function validatePhar($pharFile, &$error)
{ {
@ -536,9 +536,9 @@ TAGSPUBKEY
* *
* Uses a .vbs script to elevate and run the cmd.exe move command. * Uses a .vbs script to elevate and run the cmd.exe move command.
* *
* @param string $localFilename The composer.phar location * @param string $localFilename The composer.phar location
* @param string $newFilename The downloaded or backup phar * @param string $newFilename The downloaded or backup phar
* @return bool Whether composer.phar has been updated * @return bool Whether composer.phar has been updated
*/ */
protected function tryAsWindowsAdmin($localFilename, $newFilename) protected function tryAsWindowsAdmin($localFilename, $newFilename)
{ {

View File

@ -160,6 +160,7 @@ EOT
$package = $this->getComposer()->getPackage(); $package = $this->getComposer()->getPackage();
if ($input->getOption('name-only')) { if ($input->getOption('name-only')) {
$io->write($package->getName()); $io->write($package->getName());
return 0; return 0;
} }
$repos = $installedRepo = new InstalledRepository(array(new RootPackageRepository($package))); $repos = $installedRepo = new InstalledRepository(array(new RootPackageRepository($package)));
@ -207,7 +208,9 @@ EOT
if ($input->getOption('no-dev')) { if ($input->getOption('no-dev')) {
$packages = $this->filterRequiredPackages($installedRepo, $rootPkg); $packages = $this->filterRequiredPackages($installedRepo, $rootPkg);
$repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg) { return clone $pkg; }, $packages)))); $repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg) {
return clone $pkg;
}, $packages))));
} }
if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) { if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
@ -798,7 +801,7 @@ EOT
'keywords' => $package->getKeywords() ?: array(), 'keywords' => $package->getKeywords() ?: array(),
'type' => $package->getType(), 'type' => $package->getType(),
'homepage' => $package->getHomepage(), 'homepage' => $package->getHomepage(),
'names' => $package->getNames() 'names' => $package->getNames(),
); );
$json = $this->appendVersions($json, $versions); $json = $this->appendVersions($json, $versions);
@ -814,7 +817,7 @@ EOT
$json['source'] = array( $json['source'] = array(
'type' => $package->getSourceType(), 'type' => $package->getSourceType(),
'url' => $package->getSourceUrl(), 'url' => $package->getSourceUrl(),
'reference' => $package->getSourceReference() 'reference' => $package->getSourceReference(),
); );
} }
@ -822,7 +825,7 @@ EOT
$json['dist'] = array( $json['dist'] = array(
'type' => $package->getDistType(), 'type' => $package->getDistType(),
'url' => $package->getDistUrl(), 'url' => $package->getDistUrl(),
'reference' => $package->getDistReference() 'reference' => $package->getDistReference(),
); );
} }
@ -880,7 +883,7 @@ EOT
return array( return array(
'name' => $license[0], 'name' => $license[0],
'osi' => $licenseId, 'osi' => $licenseId,
'url' => $license[2] 'url' => $license[2],
); );
}, $licenses); }, $licenses);
} }

View File

@ -82,7 +82,7 @@ EOT
} }
/** /**
* @param InputInterface $input * @param InputInterface $input
* @return int * @return int
*/ */
private function doExecute(InputInterface $input) private function doExecute(InputInterface $input)

View File

@ -175,6 +175,7 @@ EOT
if ($updateMirrors && !empty($packages)) { if ($updateMirrors && !empty($packages)) {
$io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>'); $io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
return -1; return -1;
} }
@ -299,6 +300,7 @@ EOT
$oldPrettyString = $link->getConstraint()->getPrettyString(); $oldPrettyString = $link->getConstraint()->getPrettyString();
$newConstraint = MultiConstraint::create(array($link->getConstraint(), $parser->parseConstraints($constraint))); $newConstraint = MultiConstraint::create(array($link->getConstraint(), $parser->parseConstraints($constraint)));
$newConstraint->setPrettyString($oldPrettyString.', '.$constraint); $newConstraint->setPrettyString($oldPrettyString.', '.$constraint);
return new Link( return new Link(
$link->getSource(), $link->getSource(),
$link->getTarget(), $link->getTarget(),

View File

@ -13,7 +13,6 @@
namespace Composer; namespace Composer;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Spdx\SpdxLicenses;
use Composer\CaBundle\CaBundle; use Composer\CaBundle\CaBundle;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
@ -208,7 +207,7 @@ class Compiler
array( array(
'@package_version@' => $this->version, '@package_version@' => $this->version,
'@package_branch_alias_version@' => $this->branchAliasVersion, '@package_branch_alias_version@' => $this->branchAliasVersion,
'@release_date@' => $this->versionDate->format('Y-m-d H:i:s') '@release_date@' => $this->versionDate->format('Y-m-d H:i:s'),
) )
); );
$content = preg_replace('{SOURCE_VERSION = \'[^\']+\';}', 'SOURCE_VERSION = \'\';', $content); $content = preg_replace('{SOURCE_VERSION = \'[^\']+\';}', 'SOURCE_VERSION = \'\';', $content);

View File

@ -248,6 +248,7 @@ class Config
if (false === $val) { if (false === $val) {
$val = $this->config[$key]; $val = $this->config[$key];
} }
return $val !== 'false' && (bool) $val; return $val !== 'false' && (bool) $val;
// booleans without env var support // booleans without env var support

View File

@ -38,7 +38,7 @@ interface ConfigSourceInterface
/** /**
* Add a config setting * Add a config setting
* *
* @param string $name Name * @param string $name Name
* @param string|array $value Value * @param string|array $value Value
*/ */
public function addConfigSetting($name, $value); public function addConfigSetting($name, $value);

View File

@ -252,7 +252,7 @@ class JsonConfigSource implements ConfigSourceInterface
$this->arrayUnshiftRef($args, $config); $this->arrayUnshiftRef($args, $config);
call_user_func_array($fallback, $args); call_user_func_array($fallback, $args);
// avoid ending up with arrays for keys that should be objects // avoid ending up with arrays for keys that should be objects
foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'support', ) as $prop) { foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'support') as $prop) {
if (isset($config[$prop]) && $config[$prop] === array()) { if (isset($config[$prop]) && $config[$prop] === array()) {
$config[$prop] = new \stdClass; $config[$prop] = new \stdClass;
} }

View File

@ -158,8 +158,8 @@ class Application extends BaseApplication
try { try {
$commandName = $this->find($name)->getName(); $commandName = $this->find($name)->getName();
} catch (CommandNotFoundException $e) { } catch (CommandNotFoundException $e) {
// we'll check command validity again later after plugins are loaded // we'll check command validity again later after plugins are loaded
$commandName = false; $commandName = false;
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
} }
} }

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Console; namespace Composer\Console;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
@ -17,9 +27,9 @@ final class GithubActionError
} }
/** /**
* @param string $message * @param string $message
* @param null|string $file * @param null|string $file
* @param null|int $line * @param null|int $line
*/ */
public function emit($message, $file = null, $line = null) public function emit($message, $file = null, $line = null)
{ {

View File

@ -206,6 +206,7 @@ class Decisions implements \Iterator, \Countable
$str .= $packageId.':'.$level.','; $str .= $packageId.':'.$level.',';
} }
$str .= ']'; $str .= ']';
return $str; return $str;
} }
} }

View File

@ -12,14 +12,7 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\Package\AliasPackage;
use Composer\Package\Link;
use Composer\Package\PackageInterface;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Semver\Constraint\Constraint;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>

View File

@ -12,13 +12,8 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\RootAliasPackage; use Composer\Package\RootAliasPackage;
use Composer\Package\RootPackageInterface;
use Composer\Repository\ArrayRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Test\Repository\ArrayRepositoryTest;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -50,7 +45,6 @@ class LockTransaction extends Transaction
$this->setResultPackages($pool, $decisions); $this->setResultPackages($pool, $decisions);
parent::__construct($this->presentMap, $this->resultPackages['all']); parent::__construct($this->presentMap, $this->resultPackages['all']);
} }
// TODO make this a bit prettier instead of the two text indexes? // TODO make this a bit prettier instead of the two text indexes?

View File

@ -68,6 +68,7 @@ class MultiConflictRule extends Rule
if ($rule instanceof MultiConflictRule) { if ($rule instanceof MultiConflictRule) {
return $this->literals === $rule->getLiterals(); return $this->literals === $rule->getLiterals();
} }
return false; return false;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\DependencyResolver\Operation; namespace Composer\DependencyResolver\Operation;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
/** /**
* Solver install operation. * Solver install operation.

View File

@ -13,7 +13,6 @@
namespace Composer\DependencyResolver\Operation; namespace Composer\DependencyResolver\Operation;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
/** /**
* Solver install operation. * Solver install operation.

View File

@ -29,7 +29,7 @@ interface OperationInterface
/** /**
* Serializes the operation in a human readable format * Serializes the operation in a human readable format
* *
* @param bool $lock Whether this is an operation on the lock file * @param bool $lock Whether this is an operation on the lock file
* @return string * @return string
*/ */
public function show($lock); public function show($lock);

View File

@ -12,8 +12,6 @@
namespace Composer\DependencyResolver\Operation; namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
/** /**
* Abstract operation class. * Abstract operation class.
* *

View File

@ -20,5 +20,6 @@ use Composer\Package\PackageInterface;
interface PolicyInterface interface PolicyInterface
{ {
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator); public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
public function selectPreferredPackages(Pool $pool, array $literals, $requiredPackage = null); public function selectPreferredPackages(Pool $pool, array $literals, $requiredPackage = null);
} }

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Package\AliasPackage;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Semver\CompilingMatcher; use Composer\Semver\CompilingMatcher;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
@ -82,9 +81,9 @@ class Pool implements \Countable
/** /**
* Searches all packages providing the given package name and match the constraint * Searches all packages providing the given package name and match the constraint
* *
* @param string $name The package name to be searched for * @param string $name The package name to be searched for
* @param ConstraintInterface $constraint A constraint that all returned * @param ConstraintInterface $constraint A constraint that all returned
* packages must match or null to return all * packages must match or null to return all
* @return PackageInterface[] A set of packages * @return PackageInterface[] A set of packages
*/ */
public function whatProvides($name, ConstraintInterface $constraint = null) public function whatProvides($name, ConstraintInterface $constraint = null)
@ -141,9 +140,9 @@ class Pool implements \Countable
* Checks if the package matches the given constraint directly or through * Checks if the package matches the given constraint directly or through
* provided or replaced packages * provided or replaced packages
* *
* @param PackageInterface $candidate * @param PackageInterface $candidate
* @param string $name Name of the package to be matched * @param string $name Name of the package to be matched
* @param ConstraintInterface $constraint The constraint to verify * @param ConstraintInterface $constraint The constraint to verify
* @return bool * @return bool
*/ */
public function match($candidate, $name, ConstraintInterface $constraint = null) public function match($candidate, $name, ConstraintInterface $constraint = null)

View File

@ -281,6 +281,7 @@ class PoolBuilder
} }
$this->packagesToLoad[$name] = $constraint; $this->packagesToLoad[$name] = $constraint;
return; return;
} }
@ -420,6 +421,7 @@ class PoolBuilder
private function isRootRequire(Request $request, $name) private function isRootRequire(Request $request, $name)
{ {
$rootRequires = $request->getRequires(); $rootRequires = $request->getRequires();
return isset($rootRequires[$name]); return isset($rootRequires[$name]);
} }
@ -503,4 +505,3 @@ class PoolBuilder
} }
} }
} }

View File

@ -156,7 +156,7 @@ class Problem
* Store a reason descriptor but ignore duplicates * Store a reason descriptor but ignore duplicates
* *
* @param string $id A canonical identifier for the reason * @param string $id A canonical identifier for the reason
* @param Rule $reason The reason descriptor * @param Rule $reason The reason descriptor
*/ */
protected function addReason($id, Rule $reason) protected function addReason($id, Rule $reason)
{ {
@ -304,11 +304,13 @@ class Problem
$maxProviders = 20; $maxProviders = 20;
$providersStr = implode(array_map(function ($p) { $providersStr = implode(array_map(function ($p) {
$description = $p['description'] ? ' '.substr($p['description'], 0, 100) : ''; $description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
return " - ${p['name']}".$description."\n"; return " - ${p['name']}".$description."\n";
}, count($providers) > $maxProviders+1 ? array_slice($providers, 0, $maxProviders) : $providers)); }, count($providers) > $maxProviders + 1 ? array_slice($providers, 0, $maxProviders) : $providers));
if (count($providers) > $maxProviders+1) { if (count($providers) > $maxProviders + 1) {
$providersStr .= ' ... and '.(count($providers)-$maxProviders).' more.'."\n"; $providersStr .= ' ... and '.(count($providers) - $maxProviders).' more.'."\n";
} }
return array("- Root composer.json requires $packageName".self::constraintToText($constraint).", it ", "could not be found in any version, but the following packages provide it:\n".$providersStr." Consider requiring one of these to satisfy the $packageName requirement."); return array("- Root composer.json requires $packageName".self::constraintToText($constraint).", it ", "could not be found in any version, but the following packages provide it:\n".$providersStr." Consider requiring one of these to satisfy the $packageName requirement.");
} }
@ -347,7 +349,7 @@ class Problem
} }
/** /**
* @param string[] $versions an array of pretty versions, with normalized versions as keys * @param string[] $versions an array of pretty versions, with normalized versions as keys
* @return list<string> a list of pretty versions and '...' where versions were removed * @return list<string> a list of pretty versions and '...' where versions were removed
*/ */
private static function condenseVersionList(array $versions, $max) private static function condenseVersionList(array $versions, $max)
@ -403,7 +405,6 @@ class Problem
} }
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.'); 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

@ -14,7 +14,6 @@ namespace Composer\DependencyResolver;
use Composer\Package\Package; use Composer\Package\Package;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\RootAliasPackage;
use Composer\Repository\LockArrayRepository; use Composer\Repository\LockArrayRepository;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\MatchAllConstraint; use Composer\Semver\Constraint\MatchAllConstraint;

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Package\CompletePackage;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
@ -279,14 +278,13 @@ abstract class Rule
return 'You can only install one version of a package, so only one of these can be installed: ' . $this->formatPackagesUnique($pool, $literals, $isVerbose) . '.'; return 'You can only install one version of a package, so only one of these can be installed: ' . $this->formatPackagesUnique($pool, $literals, $isVerbose) . '.';
case self::RULE_LEARNED: case self::RULE_LEARNED:
/** @TODO currently still generates way too much output to be helpful, and in some cases can even lead to endless recursion /** @TODO currently still generates way too much output to be helpful, and in some cases can even lead to endless recursion */
if (isset($learnedPool[$this->reasonData])) { // if (isset($learnedPool[$this->reasonData])) {
echo $this->reasonData."\n"; // echo $this->reasonData."\n";
$learnedString = ', learned rules:' . Problem::formatDeduplicatedRules($learnedPool[$this->reasonData], ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool); // $learnedString = ', learned rules:' . Problem::formatDeduplicatedRules($learnedPool[$this->reasonData], ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
} else { // } else {
$learnedString = ' (reasoning unavailable)'; // $learnedString = ' (reasoning unavailable)';
} // }
*/
$learnedString = ' (conflict analysis result)'; $learnedString = ' (conflict analysis result)';
if (count($literals) === 1) { if (count($literals) === 1) {

View File

@ -12,11 +12,9 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;
use Composer\Semver\Constraint\Constraint;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -49,7 +47,7 @@ class RuleSetGenerator
* reason for generating this rule * reason for generating this rule
* @param mixed $reasonData Any data, e.g. the requirement name, * @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 * @return Rule|null The generated rule or null if tautological
*/ */
protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null) protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
{ {
@ -72,9 +70,9 @@ class RuleSetGenerator
* The rule is (A|B|C) with A, B and C different packages. If the given * The rule is (A|B|C) with A, B and C different packages. If the given
* set of packages is empty an impossible rule is generated. * set of packages is empty an impossible rule is generated.
* *
* @param array $packages The set of packages to choose from * @param array $packages The set of packages to choose from
* @param int $reason A RULE_* constant describing the reason for * @param int $reason A RULE_* constant describing the reason for
* generating this rule * generating this rule
* @param array $reasonData Additional data like the root require or fix request info * @param array $reasonData Additional data like the root require or fix request info
* @return Rule The generated rule * @return Rule The generated rule
*/ */
@ -100,7 +98,7 @@ class RuleSetGenerator
* reason for generating this rule * reason for generating this rule
* @param mixed $reasonData Any data, e.g. the package name, that * @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 * @return Rule|null The generated rule
*/ */
protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null) protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
{ {

View File

@ -61,7 +61,6 @@ class RuleWatchGraph
$this->watchChains[$literal]->unshift($node); $this->watchChains[$literal]->unshift($node);
} }
} }
} }
/** /**
@ -151,8 +150,8 @@ class RuleWatchGraph
* The rule node's watched literals are updated accordingly. * The rule node's watched literals are updated accordingly.
* *
* @param int $fromLiteral A literal the node used to watch * @param int $fromLiteral A literal the node used to watch
* @param int $toLiteral A literal the node should watch now * @param int $toLiteral A literal the node should watch now
* @param RuleWatchNode $node The rule node to be moved * @param RuleWatchNode $node The rule node to be moved
*/ */
protected function moveWatch($fromLiteral, $toLiteral, $node) protected function moveWatch($fromLiteral, $toLiteral, $node)
{ {

View File

@ -15,7 +15,6 @@ namespace Composer\DependencyResolver;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;
use Composer\Semver\Constraint\MultiConstraint;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -58,9 +57,9 @@ class Solver
protected $io; protected $io;
/** /**
* @param PolicyInterface $policy * @param PolicyInterface $policy
* @param Pool $pool * @param Pool $pool
* @param IOInterface $io * @param IOInterface $io
*/ */
public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io) public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io)
{ {
@ -182,8 +181,8 @@ class Solver
} }
/** /**
* @param Request $request * @param Request $request
* @param bool|array $ignorePlatformReqs * @param bool|array $ignorePlatformReqs
* @return LockTransaction * @return LockTransaction
*/ */
public function solve(Request $request, $ignorePlatformReqs = false) public function solve(Request $request, $ignorePlatformReqs = false)

View File

@ -68,6 +68,7 @@ class Transaction
// if names are the same, compare version, e.g. to sort aliases reliably, actual order does not matter // if names are the same, compare version, e.g. to sort aliases reliably, actual order does not matter
return strcmp($b->getVersion(), $a->getVersion()); return strcmp($b->getVersion(), $a->getVersion());
} }
return strcmp($b->getName(), $a->getName()); return strcmp($b->getName(), $a->getName());
}; };
@ -230,6 +231,7 @@ class Transaction
if (!isset($this->resultPackagesByName[$link->getTarget()])) { if (!isset($this->resultPackagesByName[$link->getTarget()])) {
return array(); return array();
} }
return $this->resultPackagesByName[$link->getTarget()]; return $this->resultPackagesByName[$link->getTarget()];
} }

View File

@ -14,8 +14,6 @@ namespace Composer\Downloader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Composer\IO\IOInterface;
use Composer\Exception\IrrecoverableDownloadException;
use React\Promise\PromiseInterface; use React\Promise\PromiseInterface;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
@ -28,7 +26,6 @@ use Composer\DependencyResolver\Operation\InstallOperation;
*/ */
abstract class ArchiveDownloader extends FileDownloader abstract class ArchiveDownloader extends FileDownloader
{ {
/** /**
* {@inheritDoc} * {@inheritDoc}
* @throws \RuntimeException * @throws \RuntimeException
@ -158,8 +155,8 @@ abstract class ArchiveDownloader extends FileDownloader
* @param string $file Extracted file * @param string $file Extracted file
* @param string $path Directory * @param string $path Directory
* *
* @return PromiseInterface|null
* @throws \UnexpectedValueException If can not extract downloaded file to path * @throws \UnexpectedValueException If can not extract downloaded file to path
* @return PromiseInterface|null
*/ */
abstract protected function extract(PackageInterface $package, $file, $path); abstract protected function extract(PackageInterface $package, $file, $path);
} }

View File

@ -41,9 +41,9 @@ class DownloadManager
/** /**
* Initializes download manager. * Initializes download manager.
* *
* @param IOInterface $io The Input Output Interface * @param IOInterface $io The Input Output Interface
* @param bool $preferSource prefer downloading from source * @param bool $preferSource prefer downloading from source
* @param Filesystem|null $filesystem custom Filesystem object * @param Filesystem|null $filesystem custom Filesystem object
*/ */
public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null) public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
{ {
@ -171,13 +171,13 @@ class DownloadManager
/** /**
* Downloads package into target dir. * Downloads package into target dir.
* *
* @param PackageInterface $package package instance * @param PackageInterface $package package instance
* @param string $targetDir target dir * @param string $targetDir target dir
* @param PackageInterface|null $prevPackage previous package instance in case of updates * @param PackageInterface|null $prevPackage previous package instance in case of updates
* *
* @return PromiseInterface
* @throws \InvalidArgumentException if package have no urls to download from * @throws \InvalidArgumentException if package have no urls to download from
* @throws \RuntimeException * @throws \RuntimeException
* @return PromiseInterface
*/ */
public function download(PackageInterface $package, $targetDir, PackageInterface $prevPackage = null) public function download(PackageInterface $package, $targetDir, PackageInterface $prevPackage = null)
{ {
@ -242,10 +242,10 @@ class DownloadManager
/** /**
* Prepares an operation execution * Prepares an operation execution
* *
* @param string $type one of install/update/uninstall * @param string $type one of install/update/uninstall
* @param PackageInterface $package package instance * @param PackageInterface $package package instance
* @param string $targetDir target dir * @param string $targetDir target dir
* @param PackageInterface|null $prevPackage previous package instance in case of updates * @param PackageInterface|null $prevPackage previous package instance in case of updates
* *
* @return PromiseInterface|null * @return PromiseInterface|null
*/ */
@ -261,12 +261,12 @@ class DownloadManager
/** /**
* Installs package into target dir. * Installs package into target dir.
* *
* @param PackageInterface $package package instance * @param PackageInterface $package package instance
* @param string $targetDir target dir * @param string $targetDir target dir
* *
* @return PromiseInterface|null
* @throws \InvalidArgumentException if package have no urls to download from * @throws \InvalidArgumentException if package have no urls to download from
* @throws \RuntimeException * @throws \RuntimeException
* @return PromiseInterface|null
*/ */
public function install(PackageInterface $package, $targetDir) public function install(PackageInterface $package, $targetDir)
{ {
@ -284,8 +284,8 @@ class DownloadManager
* @param PackageInterface $target target package version * @param PackageInterface $target target package version
* @param string $targetDir target dir * @param string $targetDir target dir
* *
* @return PromiseInterface|null
* @throws \InvalidArgumentException if initial package is not installed * @throws \InvalidArgumentException if initial package is not installed
* @return PromiseInterface|null
*/ */
public function update(PackageInterface $initial, PackageInterface $target, $targetDir) public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
{ {
@ -324,6 +324,7 @@ class DownloadManager
$promise = $initialDownloader->remove($initial, $targetDir); $promise = $initialDownloader->remove($initial, $targetDir);
if ($promise) { if ($promise) {
$self = $this; $self = $this;
return $promise->then(function ($res) use ($self, $target, $targetDir) { return $promise->then(function ($res) use ($self, $target, $targetDir) {
return $self->install($target, $targetDir); return $self->install($target, $targetDir);
}); });
@ -352,10 +353,10 @@ class DownloadManager
/** /**
* Cleans up a failed operation * Cleans up a failed operation
* *
* @param string $type one of install/update/uninstall * @param string $type one of install/update/uninstall
* @param PackageInterface $package package instance * @param PackageInterface $package package instance
* @param string $targetDir target dir * @param string $targetDir target dir
* @param PackageInterface|null $prevPackage previous package instance in case of updates * @param PackageInterface|null $prevPackage previous package instance in case of updates
* *
* @return PromiseInterface|null * @return PromiseInterface|null
*/ */

View File

@ -29,7 +29,6 @@ use Composer\Util\Filesystem;
use Composer\Util\HttpDownloader; use Composer\Util\HttpDownloader;
use Composer\Util\Url as UrlUtil; use Composer\Util\Url as UrlUtil;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Downloader\TransportException;
use React\Promise\PromiseInterface; use React\Promise\PromiseInterface;
/** /**
@ -65,12 +64,12 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
/** /**
* Constructor. * Constructor.
* *
* @param IOInterface $io The IO instance * @param IOInterface $io The IO instance
* @param Config $config The config * @param Config $config The config
* @param HttpDownloader $httpDownloader The remote filesystem * @param HttpDownloader $httpDownloader The remote filesystem
* @param EventDispatcher $eventDispatcher The event dispatcher * @param EventDispatcher $eventDispatcher The event dispatcher
* @param Cache $cache Cache instance * @param Cache $cache Cache instance
* @param Filesystem $filesystem The filesystem * @param Filesystem $filesystem The filesystem
*/ */
public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, Filesystem $filesystem = null, ProcessExecutor $process = null) public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, Filesystem $filesystem = null, ProcessExecutor $process = null)
{ {
@ -121,7 +120,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
// from different packages, which would potentially allow a given package // from different packages, which would potentially allow a given package
// in a third party repo to pre-populate the cache for the same package in // in a third party repo to pre-populate the cache for the same package in
// packagist for example. // packagist for example.
'cacheKey' => $cacheKeyGenerator($package, $processedUrl) 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
); );
} }
@ -147,7 +146,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent); $eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
if ($preFileDownloadEvent->getCustomCacheKey() !== null) { if ($preFileDownloadEvent->getCustomCacheKey() !== null) {
$url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey()); $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey());
} else if ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) { } elseif ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) {
$url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl()); $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl());
} }
$url['processed'] = $preFileDownloadEvent->getProcessedUrl(); $url['processed'] = $preFileDownloadEvent->getProcessedUrl();

View File

@ -25,7 +25,6 @@ class FossilDownloader extends VcsDownloader
*/ */
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null) protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
{ {
} }
/** /**

View File

@ -488,7 +488,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
} }
/** /**
* @param string $path * @param string $path
* @throws \RuntimeException * @throws \RuntimeException
*/ */
protected function discardChanges($path) protected function discardChanges($path)
@ -502,7 +502,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
} }
/** /**
* @param string $path * @param string $path
* @throws \RuntimeException * @throws \RuntimeException
*/ */
protected function stashChanges($path) protected function stashChanges($path)
@ -516,7 +516,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
} }
/** /**
* @param string $path * @param string $path
* @throws \RuntimeException * @throws \RuntimeException
*/ */
protected function viewDiff($path) protected function viewDiff($path)

View File

@ -12,15 +12,9 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\HttpDownloader;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
/** /**
* GZip archive downloader. * GZip archive downloader.

View File

@ -26,7 +26,6 @@ class HgDownloader extends VcsDownloader
*/ */
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null) protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
{ {
} }
/** /**

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Downloader; namespace Composer\Downloader;
class MaxFileSizeExceededException extends TransportException class MaxFileSizeExceededException extends TransportException

View File

@ -18,16 +18,9 @@ use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionGuesser;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\IO\IOInterface;
use Composer\Config;
use Composer\Cache;
use Composer\Util\HttpDownloader;
use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\EventDispatcher\EventDispatcher;
use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;

View File

@ -29,7 +29,6 @@ class PerforceDownloader extends VcsDownloader
*/ */
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null) protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
{ {
} }
/** /**

View File

@ -12,15 +12,9 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Util\IniHelper; use Composer\Util\IniHelper;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\HttpDownloader;
use Composer\Util\Filesystem;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use RarArchive; use RarArchive;

View File

@ -30,7 +30,6 @@ class SvnDownloader extends VcsDownloader
*/ */
protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null) protected function doDownload(PackageInterface $package, $path, $url, PackageInterface $prevPackage = null)
{ {
} }
/** /**

View File

@ -12,14 +12,8 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\HttpDownloader;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
/** /**
* Xz archive downloader. * Xz archive downloader.

View File

@ -12,16 +12,10 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\IniHelper; use Composer\Util\IniHelper;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\Util\HttpDownloader;
use Composer\IO\IOInterface;
use Symfony\Component\Process\ExecutableFinder; use Symfony\Component\Process\ExecutableFinder;
use ZipArchive; use ZipArchive;
@ -75,9 +69,9 @@ class ZipDownloader extends ArchiveDownloader
/** /**
* extract $file to $path with "unzip" command * extract $file to $path with "unzip" command
* *
* @param string $file File to extract * @param string $file File to extract
* @param string $path Path where to extract file * @param string $path Path where to extract file
* @param bool $isLastChance If true it is called as a fallback and should throw an exception * @param bool $isLastChance If true it is called as a fallback and should throw an exception
*/ */
private function extractWithSystemUnzip(PackageInterface $package, $file, $path, $isLastChance, $async = false) private function extractWithSystemUnzip(PackageInterface $package, $file, $path, $isLastChance, $async = false)
{ {
@ -160,9 +154,9 @@ class ZipDownloader extends ArchiveDownloader
/** /**
* extract $file to $path with ZipArchive * extract $file to $path with ZipArchive
* *
* @param string $file File to extract * @param string $file File to extract
* @param string $path Path where to extract file * @param string $path Path where to extract file
* @param bool $isLastChance If true it is called as a fallback and should throw an exception * @param bool $isLastChance If true it is called as a fallback and should throw an exception
* *
* TODO v3 should make this private once we can drop PHP 5.3 support * TODO v3 should make this private once we can drop PHP 5.3 support
* @protected * @protected

View File

@ -121,10 +121,10 @@ class EventDispatcher
/** /**
* Dispatch a installer event. * Dispatch a installer event.
* *
* @param string $eventName The constant in InstallerEvents * @param string $eventName The constant in InstallerEvents
* @param bool $devMode Whether or not we are in dev mode * @param bool $devMode Whether or not we are in dev mode
* @param bool $executeOperations True if operations will be executed, false in --dry-run * @param bool $executeOperations True if operations will be executed, false in --dry-run
* @param Transaction $transaction The transaction contains the list of operations * @param Transaction $transaction The transaction contains the list of operations
* *
* @return int return code of the executed script if any, for php scripts a false return * @return int return code of the executed script if any, for php scripts a false return
* value is changed to 1, anything else to 0 * value is changed to 1, anything else to 0
@ -158,7 +158,6 @@ class EventDispatcher
$return = 0; $return = 0;
foreach ($listeners as $callable) { foreach ($listeners as $callable) {
$this->ensureBinDirIsInPath(); $this->ensureBinDirIsInPath();
if (!is_string($callable)) { if (!is_string($callable)) {
@ -168,7 +167,7 @@ class EventDispatcher
throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public'); throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
} }
if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) { if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
$this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1] ), true, IOInterface::VERBOSE); $this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
} }
$return = false === call_user_func($callable, $event) ? 1 : 0; $return = false === call_user_func($callable, $event) ? 1 : 0;
} elseif ($this->isComposerScript($callable)) { } elseif ($this->isComposerScript($callable)) {

View File

@ -427,8 +427,8 @@ class Factory
} }
/** /**
* @param IOInterface $io IO instance * @param IOInterface $io IO instance
* @param bool $disablePlugins Whether plugins should not be loaded * @param bool $disablePlugins Whether plugins should not be loaded
* @return Composer|null * @return Composer|null
*/ */
public static function createGlobal(IOInterface $io, $disablePlugins = false) public static function createGlobal(IOInterface $io, $disablePlugins = false)
@ -598,9 +598,9 @@ class Factory
/** /**
* If you are calling this in a plugin, you probably should instead use $composer->getLoop()->getHttpDownloader() * If you are calling this in a plugin, you probably should instead use $composer->getLoop()->getHttpDownloader()
* *
* @param IOInterface $io IO instance * @param IOInterface $io IO instance
* @param Config $config Config instance * @param Config $config Config instance
* @param array $options Array of options passed directly to HttpDownloader constructor * @param array $options Array of options passed directly to HttpDownloader constructor
* @return HttpDownloader * @return HttpDownloader
*/ */
public static function createHttpDownloader(IOInterface $io, Config $config, $options = array()) public static function createHttpDownloader(IOInterface $io, Config $config, $options = array())

View File

@ -255,7 +255,7 @@ class ConsoleIO extends BaseIO
} }
/** /**
* @param int $max * @param int $max
* @return ProgressBar * @return ProgressBar
*/ */
public function getProgressBar($max = 0) public function getProgressBar($max = 0)

View File

@ -179,7 +179,7 @@ interface IOInterface extends LoggerInterface
* @param bool $multiselect Select more than one value separated by comma * @param bool $multiselect Select more than one value separated by comma
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return int|string|array|bool The selected value or values (the key of the choices array) * @return int|string|array|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($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer; namespace Composer;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;

View File

@ -20,19 +20,14 @@ use Composer\DependencyResolver\LockTransaction;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Rule;
use Composer\DependencyResolver\Solver; use Composer\DependencyResolver\Solver;
use Composer\DependencyResolver\SolverProblemsException; use Composer\DependencyResolver\SolverProblemsException;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Installer\InstallationManager; use Composer\Installer\InstallationManager;
use Composer\Installer\InstallerEvents; use Composer\Installer\InstallerEvents;
use Composer\Installer\NoopInstaller;
use Composer\Installer\SuggestedPackagesReporter; use Composer\Installer\SuggestedPackagesReporter;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
@ -41,7 +36,6 @@ use Composer\Package\BasePackage;
use Composer\Package\CompletePackage; use Composer\Package\CompletePackage;
use Composer\Package\CompletePackageInterface; use Composer\Package\CompletePackageInterface;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
@ -50,9 +44,7 @@ use Composer\Repository\ArrayRepository;
use Composer\Repository\RepositorySet; use Composer\Repository\RepositorySet;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Package\Locker; use Composer\Package\Locker;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface; use Composer\Package\RootPackageInterface;
use Composer\Repository\CompositeRepository;
use Composer\Repository\InstalledArrayRepository; use Composer\Repository\InstalledArrayRepository;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\InstalledRepository; use Composer\Repository\InstalledRepository;
@ -376,6 +368,7 @@ class Installer
if ($this->updateAllowList) { if ($this->updateAllowList) {
if (!$lockedRepository) { if (!$lockedRepository) {
$this->io->writeError('<error>Cannot update only a partial set of packages without a lock file present.</error>', true, IOInterface::QUIET); $this->io->writeError('<error>Cannot update only a partial set of packages without a lock file present.</error>', true, IOInterface::QUIET);
return 1; return 1;
} }
} }
@ -612,9 +605,9 @@ class Installer
} }
/** /**
* @param InstalledRepositoryInterface $localRepo * @param InstalledRepositoryInterface $localRepo
* @param bool $alreadySolved Whether the function is called as part of an update command or independently * @param bool $alreadySolved Whether the function is called as part of an update command or independently
* @return int exit code * @return int exit code
*/ */
protected function doInstall(InstalledRepositoryInterface $localRepo, $alreadySolved = false) protected function doInstall(InstalledRepositoryInterface $localRepo, $alreadySolved = false)
{ {
@ -660,6 +653,7 @@ class Installer
// installing the locked packages on this platform resulted in lock modifying operations, there wasn't a conflict, but the lock file as-is seems to not work on this system // installing the locked packages on this platform resulted in lock modifying operations, there wasn't a conflict, but the lock file as-is seems to not work on this system
if (0 !== count($lockTransaction->getOperations())) { if (0 !== count($lockTransaction->getOperations())) {
$this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET); $this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET);
return 1; return 1;
} }
} catch (SolverProblemsException $e) { } catch (SolverProblemsException $e) {
@ -743,10 +737,10 @@ class Installer
} }
/** /**
* @param bool $forUpdate * @param bool $forUpdate
* @param PlatformRepository $platformRepo * @param PlatformRepository $platformRepo
* @param array $rootAliases * @param array $rootAliases
* @param RepositoryInterface|null $lockedRepository * @param RepositoryInterface|null $lockedRepository
* @return RepositorySet * @return RepositorySet
*/ */
private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null) private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null)
@ -821,9 +815,9 @@ class Installer
} }
/** /**
* @param RootPackageInterface $rootPackage * @param RootPackageInterface $rootPackage
* @param PlatformRepository $platformRepo * @param PlatformRepository $platformRepo
* @param RepositoryInterface|null $lockedRepository * @param RepositoryInterface|null $lockedRepository
* @return Request * @return Request
*/ */
private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, $lockedRepository = null) private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, $lockedRepository = null)
@ -858,7 +852,7 @@ class Installer
} }
/** /**
* @param bool $forUpdate * @param bool $forUpdate
* @return array * @return array
*/ */
private function getRootAliases($forUpdate) private function getRootAliases($forUpdate)
@ -1176,7 +1170,7 @@ class Installer
/** /**
* Update the lock file to the exact same versions and references but use current remote metadata like URLs and mirror info * Update the lock file to the exact same versions and references but use current remote metadata like URLs and mirror info
* *
* @param bool $updateMirrors * @param bool $updateMirrors
* @return Installer * @return Installer
*/ */
public function setUpdateMirrors($updateMirrors) public function setUpdateMirrors($updateMirrors)
@ -1206,7 +1200,7 @@ class Installer
* Depending on the chosen constant this will either only update the directly named packages, all transitive * Depending on the chosen constant this will either only update the directly named packages, all transitive
* dependencies which are not root requirement or all transitive dependencies including root requirements * dependencies which are not root requirement or all transitive dependencies including root requirements
* *
* @param int $updateAllowTransitiveDependencies One of the UPDATE_ constants on the Request class * @param int $updateAllowTransitiveDependencies One of the UPDATE_ constants on the Request class
* @return Installer * @return Installer
*/ */
public function setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies) public function setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)

View File

@ -25,7 +25,6 @@ use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation; use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation; use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Util\StreamContextFactory;
use Composer\Util\Loop; use Composer\Util\Loop;
use React\Promise\PromiseInterface; use React\Promise\PromiseInterface;
@ -293,7 +292,7 @@ class InstallationManager
} }
/** /**
* @param array $operations List of operations to execute in this batch * @param array $operations List of operations to execute in this batch
* @param array $allOperations Complete list of operations to be executed in the install job, used for event listeners * @param array $allOperations Complete list of operations to be executed in the install job, used for event listeners
*/ */
private function downloadAndExecuteBatch(RepositoryInterface $repo, array $operations, array &$cleanupPromises, $devMode, $runScripts, array $allOperations) private function downloadAndExecuteBatch(RepositoryInterface $repo, array $operations, array &$cleanupPromises, $devMode, $runScripts, array $allOperations)
@ -370,7 +369,7 @@ class InstallationManager
} }
/** /**
* @param array $operations List of operations to execute in this batch * @param array $operations List of operations to execute in this batch
* @param array $allOperations Complete list of operations to be executed in the install job, used for event listeners * @param array $allOperations Complete list of operations to be executed in the install job, used for event listeners
*/ */
private function executeBatch(RepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts, array $allOperations) private function executeBatch(RepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts, array $allOperations)

View File

@ -13,13 +13,9 @@
namespace Composer\Installer; namespace Composer\Installer;
use Composer\Composer; use Composer\Composer;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Transaction; use Composer\DependencyResolver\Transaction;
use Composer\EventDispatcher\Event; use Composer\EventDispatcher\Event;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Repository\RepositorySet;
class InstallerEvent extends Event class InstallerEvent extends Event
{ {
@ -51,12 +47,12 @@ class InstallerEvent extends Event
/** /**
* Constructor. * Constructor.
* *
* @param string $eventName * @param string $eventName
* @param Composer $composer * @param Composer $composer
* @param IOInterface $io * @param IOInterface $io
* @param bool $devMode * @param bool $devMode
* @param bool $executeOperations * @param bool $executeOperations
* @param Transaction $transaction * @param Transaction $transaction
*/ */
public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, $executeOperations, Transaction $transaction) public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, $executeOperations, Transaction $transaction)
{ {

View File

@ -82,9 +82,8 @@ interface InstallerInterface
* @param InstalledRepositoryInterface $repo repository in which to check * @param InstalledRepositoryInterface $repo repository in which to check
* @param PackageInterface $initial already installed package version * @param PackageInterface $initial already installed package version
* @param PackageInterface $target updated version * @param PackageInterface $target updated version
* @throws InvalidArgumentException if $initial package is not installed
* @return PromiseInterface|null * @return PromiseInterface|null
*
* @throws InvalidArgumentException if $initial package is not installed
*/ */
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target); public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);

View File

@ -139,6 +139,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
$binaryInstaller = $this->binaryInstaller; $binaryInstaller = $this->binaryInstaller;
$installPath = $this->getInstallPath($package); $installPath = $this->getInstallPath($package);
return $promise->then(function () use ($binaryInstaller, $installPath, $package, $repo) { return $promise->then(function () use ($binaryInstaller, $installPath, $package, $repo) {
$binaryInstaller->installBinaries($package, $installPath); $binaryInstaller->installBinaries($package, $installPath);
if (!$repo->hasPackage($package)) { if (!$repo->hasPackage($package)) {
@ -166,6 +167,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
$binaryInstaller = $this->binaryInstaller; $binaryInstaller = $this->binaryInstaller;
$installPath = $this->getInstallPath($target); $installPath = $this->getInstallPath($target);
return $promise->then(function () use ($binaryInstaller, $installPath, $target, $initial, $repo) { return $promise->then(function () use ($binaryInstaller, $installPath, $target, $initial, $repo) {
$binaryInstaller->installBinaries($target, $installPath); $binaryInstaller->installBinaries($target, $installPath);
$repo->removePackage($initial); $repo->removePackage($initial);
@ -192,6 +194,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
$binaryInstaller = $this->binaryInstaller; $binaryInstaller = $this->binaryInstaller;
$downloadPath = $this->getPackageBasePath($package); $downloadPath = $this->getPackageBasePath($package);
$filesystem = $this->filesystem; $filesystem = $this->filesystem;
return $promise->then(function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo) { return $promise->then(function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo) {
$binaryInstaller->removeBinaries($package); $binaryInstaller->removeBinaries($package);
$repo->removePackage($package); $repo->removePackage($package);
@ -252,6 +255,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
protected function installCode(PackageInterface $package) protected function installCode(PackageInterface $package)
{ {
$downloadPath = $this->getInstallPath($package); $downloadPath = $this->getInstallPath($package);
return $this->downloadManager->install($package, $downloadPath); return $this->downloadManager->install($package, $downloadPath);
} }
@ -271,6 +275,7 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
} }
$self = $this; $self = $this;
return $promise->then(function () use ($self, $target) { return $promise->then(function () use ($self, $target) {
$reflMethod = new \ReflectionMethod($self, 'installCode'); $reflMethod = new \ReflectionMethod($self, 'installCode');
$reflMethod->setAccessible(true); $reflMethod->setAccessible(true);
@ -283,12 +288,14 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
$this->filesystem->rename($initialDownloadPath, $targetDownloadPath); $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
} }
return $this->downloadManager->update($initial, $target, $targetDownloadPath); return $this->downloadManager->update($initial, $target, $targetDownloadPath);
} }
protected function removeCode(PackageInterface $package) protected function removeCode(PackageInterface $package)
{ {
$downloadPath = $this->getPackageBasePath($package); $downloadPath = $this->getPackageBasePath($package);
return $this->downloadManager->remove($package, $downloadPath); return $this->downloadManager->remove($package, $downloadPath);
} }

View File

@ -14,7 +14,6 @@ namespace Composer\Installer;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;

View File

@ -15,10 +15,7 @@ namespace Composer\Installer;
use Composer\Composer; use Composer\Composer;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Request;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Repository\RepositorySet;
use Composer\EventDispatcher\Event; use Composer\EventDispatcher\Event;
/** /**

View File

@ -71,6 +71,7 @@ class PluginInstaller extends LibraryInstaller
$pluginManager = $this->composer->getPluginManager(); $pluginManager = $this->composer->getPluginManager();
$self = $this; $self = $this;
return $promise->then(function () use ($self, $pluginManager, $package, $repo) { return $promise->then(function () use ($self, $pluginManager, $package, $repo) {
try { try {
$pluginManager->registerPackage($package, true); $pluginManager->registerPackage($package, true);
@ -92,6 +93,7 @@ class PluginInstaller extends LibraryInstaller
$pluginManager = $this->composer->getPluginManager(); $pluginManager = $this->composer->getPluginManager();
$self = $this; $self = $this;
return $promise->then(function () use ($self, $pluginManager, $initial, $target, $repo) { return $promise->then(function () use ($self, $pluginManager, $initial, $target, $repo) {
try { try {
$pluginManager->deactivatePackage($initial, true); $pluginManager->deactivatePackage($initial, true);

View File

@ -182,8 +182,8 @@ class SuggestedPackagesReporter
} }
/** /**
* @param InstalledRepository|null $installedRepo If passed in, suggested packages which are installed already will be skipped * @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 PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown
* @return array[] * @return array[]
*/ */
private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null) private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null)

View File

@ -164,7 +164,7 @@ class JsonFile
/** /**
* Validates the schema of the current json file according to composer-schema.json rules * Validates the schema of the current json file according to composer-schema.json rules
* *
* @param int $schema a JsonFile::*_SCHEMA constant * @param int $schema a JsonFile::*_SCHEMA constant
* @param string|null $schemaFile a path to the schema file * @param string|null $schemaFile a path to the schema file
* @throws JsonValidationException * @throws JsonValidationException
* @return bool true on success * @return bool true on success

View File

@ -431,7 +431,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
public function __toString() public function __toString()
{ {
return parent::__toString().' ('.($this->rootPackageAlias ? 'root ':''). 'alias of '.$this->aliasOf->getVersion().')'; return parent::__toString().' ('.($this->rootPackageAlias ? 'root ' : ''). 'alias of '.$this->aliasOf->getVersion().')';
} }
public function setDistUrl($url) public function setDistUrl($url)

View File

@ -258,7 +258,7 @@ abstract class BasePackage implements PackageInterface
* Build a regexp from a package name, expanding * globs as required * Build a regexp from a package name, expanding * globs as required
* *
* @param string $allowPattern * @param string $allowPattern
* @param string $wrap Wrap the cleaned string by the given string * @param string $wrap Wrap the cleaned string by the given string
* @return string * @return string
*/ */
public static function packageNameToRegexp($allowPattern, $wrap = '{^%s$}i') public static function packageNameToRegexp($allowPattern, $wrap = '{^%s$}i')

View File

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

View File

@ -295,11 +295,11 @@ class ArrayLoader implements LoaderInterface
} }
/** /**
* @param string $source source package name * @param string $source source package name
* @param string $sourceVersion source package version (pretty version ideally) * @param string $sourceVersion source package version (pretty version ideally)
* @param string $description link description (e.g. requires, replaces, ..) * @param string $description link description (e.g. requires, replaces, ..)
* @phpstan-param Link::TYPE_* $description * @phpstan-param Link::TYPE_* $description
* @param array $links array of package name => constraint mappings * @param array $links array of package name => constraint mappings
* @return Link[] * @return Link[]
*/ */
public function parseLinks($source, $sourceVersion, $description, $links) public function parseLinks($source, $sourceVersion, $description, $links)

View File

@ -15,7 +15,6 @@ namespace Composer\Package;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Installer\InstallationManager; use Composer\Installer\InstallationManager;
use Composer\Repository\LockArrayRepository; use Composer\Repository\LockArrayRepository;
use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
@ -334,6 +333,7 @@ class Locker
if (in_array($alias['version'], array('dev-master', 'dev-trunk', 'dev-default'), true)) { if (in_array($alias['version'], array('dev-master', 'dev-trunk', 'dev-default'), true)) {
$alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS; $alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS;
} }
return $alias; return $alias;
}, $aliases); }, $aliases);

View File

@ -203,7 +203,7 @@ interface PackageInterface
* *
* @see getPrettyVersion * @see getPrettyVersion
* *
* @param bool $truncate If the source reference is a sha1 hash, truncate it * @param bool $truncate If the source reference is a sha1 hash, truncate it
* @param int $displayMode One of the DISPLAY_ constants on this interface determining display of references * @param int $displayMode One of the DISPLAY_ constants on this interface determining display of references
* @return string version * @return string version
* *

View File

@ -26,9 +26,9 @@ class StabilityFilter
* @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities * @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value * @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags * @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @param string[] $names The package name(s) to check for stability flags * @param string[] $names The package name(s) to check for stability flags
* @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev' * @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev'
* @return bool true if any package name is acceptable * @return bool true if any package name is acceptable
*/ */
public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, $names, $stability) public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, $names, $stability)
{ {

View File

@ -21,7 +21,6 @@ use Composer\Util\HttpDownloader;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Svn as SvnUtil; use Composer\Util\Svn as SvnUtil;
/** /**
* Try to guess the current version number based on different VCS configuration. * Try to guess the current version number based on different VCS configuration.
* *

View File

@ -12,10 +12,8 @@
namespace Composer\Package\Version; namespace Composer\Package\Version;
use Composer\DependencyResolver\Pool;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Plugin\PluginInterface;
use Composer\Composer; use Composer\Composer;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
@ -54,10 +52,10 @@ class VersionSelector
* Given a package name and optional version, returns the latest PackageInterface * Given a package name and optional version, returns the latest PackageInterface
* that matches. * that matches.
* *
* @param string $packageName * @param string $packageName
* @param string $targetPackageVersion * @param string $targetPackageVersion
* @param string $preferredStability * @param string $preferredStability
* @param bool|array $ignorePlatformReqs * @param bool|array $ignorePlatformReqs
* @return PackageInterface|false * @return PackageInterface|false
*/ */
public function findBestCandidate($packageName, $targetPackageVersion = null, $preferredStability = 'stable', $ignorePlatformReqs = false, $repoSetFlags = 0) public function findBestCandidate($packageName, $targetPackageVersion = null, $preferredStability = 'stable', $ignorePlatformReqs = false, $repoSetFlags = 0)

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* This file is part of Composer. * This file is part of Composer.
* *

View File

@ -15,8 +15,8 @@ namespace Composer\Platform;
class Runtime class Runtime
{ {
/** /**
* @param string $constant * @param string $constant
* @param class-string $class * @param class-string $class
* @return bool * @return bool
*/ */
public function hasConstant($constant, $class = null) public function hasConstant($constant, $class = null)
@ -25,8 +25,8 @@ class Runtime
} }
/** /**
* @param bool $constant * @param bool $constant
* @param class-string $class * @param class-string $class
* @return mixed * @return mixed
*/ */
public function getConstant($constant, $class = null) public function getConstant($constant, $class = null)
@ -35,7 +35,7 @@ class Runtime
} }
/** /**
* @param string $fn * @param string $fn
* @return bool * @return bool
*/ */
public function hasFunction($fn) public function hasFunction($fn)
@ -44,8 +44,8 @@ class Runtime
} }
/** /**
* @param callable $callable * @param callable $callable
* @param array $arguments * @param array $arguments
* @return mixed * @return mixed
*/ */
public function invoke($callable, array $arguments = array()) public function invoke($callable, array $arguments = array())
@ -54,7 +54,7 @@ class Runtime
} }
/** /**
* @param class-string $class * @param class-string $class
* @return bool * @return bool
*/ */
public function hasClass($class) public function hasClass($class)
@ -63,8 +63,8 @@ class Runtime
} }
/** /**
* @param class-string $class * @param class-string $class
* @param array $arguments * @param array $arguments
* @return object * @return object
*/ */
public function construct($class, array $arguments = array()) public function construct($class, array $arguments = array())
@ -74,6 +74,7 @@ class Runtime
} }
$refl = new \ReflectionClass($class); $refl = new \ReflectionClass($class);
return $refl->newInstanceArgs($arguments); return $refl->newInstanceArgs($arguments);
} }
@ -84,7 +85,7 @@ class Runtime
} }
/** /**
* @param string $extension * @param string $extension
* @return string * @return string
*/ */
public function getExtensionVersion($extension) public function getExtensionVersion($extension)
@ -93,7 +94,7 @@ class Runtime
} }
/** /**
* @param string $extension * @param string $extension
* @return string * @return string
*/ */
public function getExtensionInfo($extension) public function getExtensionInfo($extension)

View File

@ -18,8 +18,8 @@ namespace Composer\Platform;
class Version class Version
{ {
/** /**
* @param string $opensslVersion * @param string $opensslVersion
* @param bool $isFips * @param bool $isFips
* @return string|null * @return string|null
*/ */
public static function parseOpenssl($opensslVersion, &$isFips) public static function parseOpenssl($opensslVersion, &$isFips)
@ -38,7 +38,7 @@ class Version
} }
/** /**
* @param string $libjpegVersion * @param string $libjpegVersion
* @return string|null * @return string|null
*/ */
public static function parseLibjpeg($libjpegVersion) public static function parseLibjpeg($libjpegVersion)
@ -51,7 +51,7 @@ class Version
} }
/** /**
* @param string $zoneinfoVersion * @param string $zoneinfoVersion
* @return string|null * @return string|null
*/ */
public static function parseZoneinfoVersion($zoneinfoVersion) public static function parseZoneinfoVersion($zoneinfoVersion)
@ -66,16 +66,16 @@ class Version
/** /**
* "" => 0, "a" => 1, "zg" => 33 * "" => 0, "a" => 1, "zg" => 33
* *
* @param string $alpha * @param string $alpha
* @return int * @return int
*/ */
private static function convertAlphaVersionToIntVersion($alpha) private static function convertAlphaVersionToIntVersion($alpha)
{ {
return strlen($alpha) * (-ord('a')+1) + array_sum(array_map('ord', str_split($alpha))); return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
} }
/** /**
* @param int $versionId * @param int $versionId
* @return string * @return string
*/ */
public static function convertLibxpmVersionId($versionId) public static function convertLibxpmVersionId($versionId)
@ -84,7 +84,7 @@ class Version
} }
/** /**
* @param int $versionId * @param int $versionId
* @return string * @return string
*/ */
public static function convertOpenldapVersionId($versionId) public static function convertOpenldapVersionId($versionId)

View File

@ -22,7 +22,6 @@ use Composer\Package\PackageInterface;
*/ */
class PostFileDownloadEvent extends Event class PostFileDownloadEvent extends Event
{ {
/** /**
* @var string * @var string
*/ */
@ -46,11 +45,11 @@ class PostFileDownloadEvent extends Event
/** /**
* Constructor. * Constructor.
* *
* @param string $name The event name * @param string $name The event name
* @param string $fileName The file name * @param string $fileName The file name
* @param string|null $checksum The checksum * @param string|null $checksum The checksum
* @param string $url The processed url * @param string $url The processed url
* @param PackageInterface $package The package. * @param PackageInterface $package The package.
*/ */
public function __construct($name, $fileName, $checksum, $url, PackageInterface $package) public function __construct($name, $fileName, $checksum, $url, PackageInterface $package)
{ {
@ -76,7 +75,8 @@ class PostFileDownloadEvent extends Event
* *
* @return string|null * @return string|null
*/ */
public function getChecksum() { public function getChecksum()
{
return $this->checksum; return $this->checksum;
} }
@ -85,18 +85,18 @@ class PostFileDownloadEvent extends Event
* *
* @return string * @return string
*/ */
public function getUrl() { public function getUrl()
{
return $this->url; return $this->url;
} }
/** /**
* Get the package. * Get the package.
* *
* @return \Composer\Package\PackageInterface * @return \Composer\Package\PackageInterface The package.
* The package.
*/ */
public function getPackage() { public function getPackage()
{
return $this->package; return $this->package;
} }
} }

View File

@ -50,11 +50,11 @@ class PreFileDownloadEvent extends Event
/** /**
* Constructor. * Constructor.
* *
* @param string $name The event name * @param string $name The event name
* @param HttpDownloader $httpDownloader * @param HttpDownloader $httpDownloader
* @param string $processedUrl * @param string $processedUrl
* @param string $type * @param string $type
* @param mixed $context * @param mixed $context
*/ */
public function __construct($name, HttpDownloader $httpDownloader, $processedUrl, $type, $context = null) public function __construct($name, HttpDownloader $httpDownloader, $processedUrl, $type, $context = null)
{ {

View File

@ -13,7 +13,6 @@
namespace Composer\Plugin; namespace Composer\Plugin;
use Composer\EventDispatcher\Event; use Composer\EventDispatcher\Event;
use Symfony\Component\Console\Input\InputInterface;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;

View File

@ -31,8 +31,8 @@ class ArrayRepository implements RepositoryInterface
protected $packages; protected $packages;
/** /**
* @var PackageInterface[] indexed by package unique name and used to cache hasPackage calls * @var PackageInterface[] indexed by package unique name and used to cache hasPackage calls
*/ */
protected $packageMap; protected $packageMap;
public function __construct(array $packages = array()) public function __construct(array $packages = array())

View File

@ -94,7 +94,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
$fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION); $fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
if (in_array($fileExtension, array('gz', 'tar', 'tgz'), true)) { if (in_array($fileExtension, array('gz', 'tar', 'tgz'), true)) {
$fileType = 'tar'; $fileType = 'tar';
} else if ($fileExtension === 'zip') { } elseif ($fileExtension === 'zip') {
$fileType = 'zip'; $fileType = 'zip';
} else { } else {
throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.'); throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.');

View File

@ -76,7 +76,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* TODO v3 should make this private once we can drop PHP 5.3 support * TODO v3 should make this private once we can drop PHP 5.3 support
* @private * @private
* @var array list of package names which are fresh and can be loaded from the cache directly in case loadPackage is called several times * @var array list of package names which are fresh and can be loaded from the cache directly in case loadPackage is called several times
* useful for v2 metadata repositories with lazy providers * useful for v2 metadata repositories with lazy providers
*/ */
public $freshMetadataUrls = array(); public $freshMetadataUrls = array();
@ -84,7 +84,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* TODO v3 should make this private once we can drop PHP 5.3 support * TODO v3 should make this private once we can drop PHP 5.3 support
* @private * @private
* @var array list of package names which returned a 404 and should not be re-fetched in case loadPackage is called several times * @var array list of package names which returned a 404 and should not be re-fetched in case loadPackage is called several times
* useful for v2 metadata repositories with lazy providers * useful for v2 metadata repositories with lazy providers
*/ */
public $packagesNotFoundCache = array(); public $packagesNotFoundCache = array();
/** /**
@ -527,7 +527,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
} }
/** /**
* @param string $name package name * @param string $name package name
* @return array|mixed * @return array|mixed
*/ */
private function whatProvides($name, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array()) private function whatProvides($name, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array())
@ -1244,19 +1244,21 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$io = $this->io; $io = $this->io;
$url = $this->url; $url = $this->url;
$cache = $this->cache; $cache = $this->cache;
$degradedMode =& $this->degradedMode; $degradedMode = &$this->degradedMode;
$repo = $this; $repo = $this;
$accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $repo) { $accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $repo) {
// package not found is acceptable for a v2 protocol repository // package not found is acceptable for a v2 protocol repository
if ($response->getStatusCode() === 404) { if ($response->getStatusCode() === 404) {
$repo->packagesNotFoundCache[$filename] = true; $repo->packagesNotFoundCache[$filename] = true;
return array('packages' => array()); return array('packages' => array());
} }
$json = $response->getBody(); $json = $response->getBody();
if ($json === '' && $response->getStatusCode() === 304) { if ($json === '' && $response->getStatusCode() === 304) {
$repo->freshMetadataUrls[$filename] = true; $repo->freshMetadataUrls[$filename] = true;
return true; return true;
} }
@ -1280,6 +1282,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$reject = function ($e) use (&$retries, $httpDownloader, $filename, $options, &$reject, $accept, $io, $url, &$degradedMode, $repo) { $reject = function ($e) use (&$retries, $httpDownloader, $filename, $options, &$reject, $accept, $io, $url, &$degradedMode, $repo) {
if ($e instanceof TransportException && $e->getStatusCode() === 404) { if ($e instanceof TransportException && $e->getStatusCode() === 404) {
$repo->packagesNotFoundCache[$filename] = true; $repo->packagesNotFoundCache[$filename] = true;
return false; return false;
} }
@ -1333,8 +1336,8 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* Checks if the package name is present in this lazy providers repo * Checks if the package name is present in this lazy providers repo
* *
* @param string $name * @param string $name
* @return bool true if the package name is present in availablePackages or matched by availablePackagePatterns * @return bool true if the package name is present in availablePackages or matched by availablePackagePatterns
*/ */
protected function lazyProvidersRepoContains($name) protected function lazyProvidersRepoContains($name)
{ {

View File

@ -41,7 +41,9 @@ class CompositeRepository implements RepositoryInterface
public function getRepoName() public function getRepoName()
{ {
return 'composite repo ('.implode(', ', array_map(function ($repo) { return $repo->getRepoName(); }, $this->repositories)).')'; return 'composite repo ('.implode(', ', array_map(function ($repo) {
return $repo->getRepoName();
}, $this->repositories)).')';
} }
/** /**

View File

@ -35,9 +35,9 @@ class FilesystemRepository extends WritableArrayRepository
/** /**
* Initializes filesystem repository. * Initializes filesystem repository.
* *
* @param JsonFile $repositoryFile repository json file * @param JsonFile $repositoryFile repository json file
* @param bool $dumpVersions * @param bool $dumpVersions
* @param ?RootPackageInterface $rootPackage Must be provided if $dumpVersions is true * @param ?RootPackageInterface $rootPackage Must be provided if $dumpVersions is true
*/ */
public function __construct(JsonFile $repositoryFile, $dumpVersions = false, RootPackageInterface $rootPackage = null) public function __construct(JsonFile $repositoryFile, $dumpVersions = false, RootPackageInterface $rootPackage = null)
{ {

View File

@ -16,11 +16,9 @@ use Composer\Package\Version\VersionParser;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Semver\Constraint\MatchAllConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Package\AliasPackage;
use Composer\Package\RootPackageInterface; use Composer\Package\RootPackageInterface;
use Composer\Package\Link; use Composer\Package\Link;
/** /**
* Installed repository is a composite of all installed repo types. * Installed repository is a composite of all installed repo types.
* *
@ -231,7 +229,9 @@ class InstalledRepository extends CompositeRepository
public function getRepoName() public function getRepoName()
{ {
return 'installed repo ('.implode(', ', array_map(function ($repo) { return $repo->getRepoName(); }, $this->getRepositories())).')'; return 'installed repo ('.implode(', ', array_map(function ($repo) {
return $repo->getRepoName();
}, $this->getRepositories())).')';
} }
/** /**

View File

@ -26,4 +26,3 @@ class LockArrayRepository extends ArrayRepository
return 'lock repo'; return 'lock repo';
} }
} }

View File

@ -12,17 +12,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\IO\IOInterface;
use Composer\Semver\VersionParser as SemverVersionParser;
use Composer\Package\Version\VersionParser;
use Composer\Package\CompletePackage;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Package\Link;
use Composer\Semver\Constraint\Constraint;
use Composer\Util\HttpDownloader;
use Composer\Config;
use Composer\Factory;
/** /**
* Builds list of package from PEAR channel. * Builds list of package from PEAR channel.
* *

View File

@ -186,7 +186,7 @@ class PlatformRepository extends ArrayRepository
$library = strtolower($sslMatches['library']); $library = strtolower($sslMatches['library']);
if ($library === 'openssl') { if ($library === 'openssl') {
$parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips); $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips);
$this->addLibrary($name.'-openssl'.($isFips ? '-fips': ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', array(), $isFips ? array('curl-openssl'): array()); $this->addLibrary($name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', array(), $isFips ? array('curl-openssl') : array());
} else { } else {
$this->addLibrary($name.'-'.$library, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', array('curl-openssl')); $this->addLibrary($name.'-'.$library, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', array('curl-openssl'));
} }
@ -315,7 +315,7 @@ class PlatformRepository extends ArrayRepository
case 'libxml': case 'libxml':
// ext/dom, ext/simplexml, ext/xmlreader and ext/xmlwriter use the same libxml as the ext/libxml // ext/dom, ext/simplexml, ext/xmlreader and ext/xmlwriter use the same libxml as the ext/libxml
$libxmlProvides = array_map(function($extension) { $libxmlProvides = array_map(function ($extension) {
return $extension . '-libxml'; return $extension . '-libxml';
}, array_intersect($loadedExtensions, array('dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter'))); }, array_intersect($loadedExtensions, array('dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter')));
$this->addLibrary($name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', array(), $libxmlProvides); $this->addLibrary($name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', array(), $libxmlProvides);
@ -441,7 +441,7 @@ class PlatformRepository extends ArrayRepository
case 'zip': case 'zip':
if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) { if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) {
$this->addLibrary($name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION','ZipArchive'), null, array('zip')); $this->addLibrary($name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION', 'ZipArchive'), null, array('zip'));
} }
break; break;
@ -549,7 +549,7 @@ class PlatformRepository extends ArrayRepository
if ($name === 'uuid') { if ($name === 'uuid') {
$ext->setReplaces(array( $ext->setReplaces(array(
new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()) new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()),
)); ));
} }
@ -557,7 +557,7 @@ class PlatformRepository extends ArrayRepository
} }
/** /**
* @param string $name * @param string $name
* @return string * @return string
*/ */
private function buildPackageName($name) private function buildPackageName($name)
@ -599,7 +599,7 @@ class PlatformRepository extends ArrayRepository
/** /**
* Check if a package name is a platform package. * Check if a package name is a platform package.
* *
* @param string $name * @param string $name
* @return bool * @return bool
*/ */
public static function isPlatformPackage($name) public static function isPlatformPackage($name)

View File

@ -70,8 +70,8 @@ interface RepositoryInterface extends \Countable
* - The packages returned are the packages found which match the constraints, acceptable stability and stability flags provided * - The packages returned are the packages found which match the constraints, acceptable stability and stability flags provided
* - The namesFound returned are names which should be considered as canonically found in this repository, that should not be looked up in any further lower priority repositories * - The namesFound returned are names which should be considered as canonically found in this repository, that should not be looked up in any further lower priority repositories
* *
* @param ConstraintInterface[] $packageNameMap package names pointing to constraints * @param ConstraintInterface[] $packageNameMap package names pointing to constraints
* @param int[] $acceptableStabilities array of stability => BasePackage::STABILITY_* value * @param int[] $acceptableStabilities array of stability => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities * @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value * @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags * @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags

View File

@ -20,12 +20,6 @@ use Composer\IO\IOInterface;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Version\VersionParser;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\LockArrayRepository;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\InstalledRepository;
use Composer\Semver\Constraint\ConstraintInterface; use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Package\Version\StabilityFilter; use Composer\Package\Version\StabilityFilter;
@ -83,7 +77,7 @@ class RepositorySet
* aliases, pinned references and other special cases. * aliases, pinned references and other special cases.
* *
* @param string $minimumStability * @param string $minimumStability
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value * @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, int> $stabilityFlags * @psalm-param array<string, int> $stabilityFlags
* @param array[] $rootAliases * @param array[] $rootAliases
* @psalm-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases * @psalm-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases
@ -126,7 +120,7 @@ class RepositorySet
* The first repos added have a higher priority. As soon as a package is found in any * The first repos added have a higher priority. As soon as a package is found in any
* repository the search for that package ends, and following repos will not be consulted. * repository the search for that package ends, and following repos will not be consulted.
* *
* @param RepositoryInterface $repo A package repository * @param RepositoryInterface $repo A package repository
*/ */
public function addRepository(RepositoryInterface $repo) public function addRepository(RepositoryInterface $repo)
{ {
@ -150,9 +144,9 @@ class RepositorySet
* *
* Returned in the order of repositories, matching priority * Returned in the order of repositories, matching priority
* *
* @param string $name * @param string $name
* @param ConstraintInterface|null $constraint * @param ConstraintInterface|null $constraint
* @param int $flags any of the ALLOW_* constants from this class to tweak what is returned * @param int $flags any of the ALLOW_* constants from this class to tweak what is returned
* @return array * @return array
*/ */
public function findPackages($name, ConstraintInterface $constraint = null, $flags = 0) public function findPackages($name, ConstraintInterface $constraint = null, $flags = 0)
@ -262,7 +256,6 @@ class RepositorySet
$aliasPackage->setRootPackageAlias(true); $aliasPackage->setRootPackageAlias(true);
$packages[] = $aliasPackage; $packages[] = $aliasPackage;
} }
} }
} }

View File

@ -144,7 +144,7 @@ abstract class BitbucketDriver extends VcsDriver
$hash = $branches[$label]; $hash = $branches[$label];
} }
if (! isset($hash)) { if (!isset($hash)) {
$composer['support']['source'] = sprintf( $composer['support']['source'] = sprintf(
'https://%s/%s/%s/src', 'https://%s/%s/%s/src',
$this->originUrl, $this->originUrl,

View File

@ -165,7 +165,7 @@ class FossilDriver extends VcsDriver
public function getChangeDate($identifier) public function getChangeDate($identifier)
{ {
$this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir); $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
list(,$date) = explode(' ', trim($output), 3); list(, $date) = explode(' ', trim($output), 3);
return new \DateTime($date, new \DateTimeZone('UTC')); return new \DateTime($date, new \DateTimeZone('UTC'));
} }

View File

@ -30,7 +30,7 @@ class GitBitbucketDriver extends BitbucketDriver
} }
if (null === $this->rootIdentifier) { if (null === $this->rootIdentifier) {
if (! $this->getRepoData()) { if (!$this->getRepoData()) {
return $this->fallbackDriver->getRootIdentifier(); return $this->fallbackDriver->getRootIdentifier();
} }

View File

@ -58,7 +58,7 @@ class GitHubDriver extends VcsDriver
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
$this->cache->setReadOnly($this->config->get('cache-read-only')); $this->cache->setReadOnly($this->config->get('cache-read-only'));
if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){ if ($this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'])) {
$this->setupGitDriver($this->url); $this->setupGitDriver($this->url);
return; return;
@ -150,7 +150,7 @@ class GitHubDriver extends VcsDriver
if (!isset($this->infoCache[$identifier])) { if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
$composer = JsonFile::parseJson($res); $composer = JsonFile::parseJson($res);
} else { } else {
$composer = $this->getBaseComposerInformation($identifier); $composer = $this->getBaseComposerInformation($identifier);
@ -193,7 +193,6 @@ class GitHubDriver extends VcsDriver
} }
foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) { foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
try { try {
$response = $this->httpDownloader->get($file, array( $response = $this->httpDownloader->get($file, array(
'retry-auth-failure' => false, 'retry-auth-failure' => false,

View File

@ -132,7 +132,7 @@ class GitLabDriver extends VcsDriver
if (!isset($this->infoCache[$identifier])) { if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
$composer = JsonFile::parseJson($res); $composer = JsonFile::parseJson($res);
} else { } else {
$composer = $this->getBaseComposerInformation($identifier); $composer = $this->getBaseComposerInformation($identifier);
@ -563,6 +563,7 @@ class GitLabDriver extends VcsDriver
if ($portNumber) { if ($portNumber) {
return $guessedDomain.':'.$portNumber; return $guessedDomain.':'.$portNumber;
} }
return $guessedDomain; return $guessedDomain;
} }

View File

@ -30,7 +30,7 @@ class HgBitbucketDriver extends BitbucketDriver
} }
if (null === $this->rootIdentifier) { if (null === $this->rootIdentifier) {
if (! $this->getRepoData()) { if (!$this->getRepoData()) {
return $this->fallbackDriver->getRootIdentifier(); return $this->fallbackDriver->getRootIdentifier();
} }

View File

@ -15,7 +15,6 @@ namespace Composer\Repository\Vcs;
use Composer\Cache; use Composer\Cache;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;
use Composer\Config; use Composer\Config;
use Composer\Factory;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
@ -52,11 +51,11 @@ abstract class VcsDriver implements VcsDriverInterface
/** /**
* Constructor. * Constructor.
* *
* @param array $repoConfig The repository configuration * @param array $repoConfig The repository configuration
* @param IOInterface $io The IO instance * @param IOInterface $io The IO instance
* @param Config $config The composer configuration * @param Config $config The composer configuration
* @param HttpDownloader $httpDownloader Remote Filesystem, injectable for mocking * @param HttpDownloader $httpDownloader Remote Filesystem, injectable for mocking
* @param ProcessExecutor $process Process instance, injectable for mocking * @param ProcessExecutor $process Process instance, injectable for mocking
*/ */
final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process) final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process)
{ {

Some files were not shown because too many files have changed in this diff Show More