1
0
Fork 0

Type annotations

pull/10177/head
Jordi Boggiano 2021-10-17 14:21:19 +02:00
parent 98f1465610
commit b209816056
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
15 changed files with 216 additions and 3 deletions

View File

@ -107,7 +107,10 @@ class Pool implements \Countable
} }
/** /**
* @see whatProvides * @param string $name The package name to be searched for
* @param ConstraintInterface $constraint A constraint that all returned
* packages must match or null to return all
* @return BasePackage[]
*/ */
private function computeWhatProvides($name, $constraint) private function computeWhatProvides($name, $constraint)
{ {
@ -126,6 +129,9 @@ class Pool implements \Countable
return $matches; return $matches;
} }
/**
* @return BasePackage
*/
public function literalToPackage($literal) public function literalToPackage($literal)
{ {
$packageId = abs($literal); $packageId = abs($literal);
@ -133,6 +139,9 @@ class Pool implements \Countable
return $this->packageById($packageId); return $this->packageById($packageId);
} }
/**
* @return string
*/
public function literalToPrettyString($literal, $installedMap) public function literalToPrettyString($literal, $installedMap)
{ {
$package = $this->literalToPackage($literal); $package = $this->literalToPackage($literal);
@ -195,6 +204,9 @@ class Pool implements \Countable
return false; return false;
} }
/**
* @return bool
*/
public function isUnacceptableFixedOrLockedPackage(BasePackage $package) public function isUnacceptableFixedOrLockedPackage(BasePackage $package)
{ {
return \in_array($package, $this->unacceptableFixedOrLockedPackages, true); return \in_array($package, $this->unacceptableFixedOrLockedPackages, true);

View File

@ -139,6 +139,9 @@ class PoolBuilder
$this->io = $io; $this->io = $io;
} }
/**
* @return Pool
*/
public function buildPool(array $repositories, Request $request) public function buildPool(array $repositories, Request $request)
{ {
if ($request->getUpdateAllowList()) { if ($request->getUpdateAllowList()) {
@ -261,6 +264,9 @@ class PoolBuilder
return $pool; return $pool;
} }
/**
* @return void
*/
private function markPackageNameForLoading(Request $request, $name, ConstraintInterface $constraint) private function markPackageNameForLoading(Request $request, $name, ConstraintInterface $constraint)
{ {
// Skip platform requires at this stage // Skip platform requires at this stage
@ -316,6 +322,9 @@ class PoolBuilder
unset($this->loadedPackages[$name]); unset($this->loadedPackages[$name]);
} }
/**
* @return void
*/
private function loadPackagesMarkedForLoading(Request $request, $repositories) private function loadPackagesMarkedForLoading(Request $request, $repositories)
{ {
foreach ($this->packagesToLoad as $name => $constraint) { foreach ($this->packagesToLoad as $name => $constraint) {
@ -348,6 +357,9 @@ class PoolBuilder
} }
} }
/**
* @return void
*/
private function loadPackage(Request $request, BasePackage $package, $propagateUpdate = true) private function loadPackage(Request $request, BasePackage $package, $propagateUpdate = true)
{ {
$index = $this->indexCounter++; $index = $this->indexCounter++;
@ -445,6 +457,7 @@ class PoolBuilder
/** /**
* Checks whether the update allow list allows this package in the lock file to be updated * Checks whether the update allow list allows this package in the lock file to be updated
*
* @return bool * @return bool
*/ */
private function isUpdateAllowed(PackageInterface $package) private function isUpdateAllowed(PackageInterface $package)
@ -469,6 +482,9 @@ class PoolBuilder
return false; return false;
} }
/**
* @return void
*/
private function warnAboutNonMatchingUpdateAllowList(Request $request) private function warnAboutNonMatchingUpdateAllowList(Request $request)
{ {
foreach ($this->updateAllowList as $pattern => $void) { foreach ($this->updateAllowList as $pattern => $void) {
@ -496,6 +512,8 @@ class PoolBuilder
/** /**
* Reverts the decision to use a locked package if a partial update with transitive dependencies * Reverts the decision to use a locked package if a partial update with transitive dependencies
* found that this package actually needs to be updated * found that this package actually needs to be updated
*
* @return void
*/ */
private function unlockPackage(Request $request, $name) private function unlockPackage(Request $request, $name)
{ {
@ -534,6 +552,9 @@ class PoolBuilder
} }
} }
/**
* @return void
*/
private function removeLoadedPackage(Request $request, PackageInterface $package, $index) private function removeLoadedPackage(Request $request, PackageInterface $package, $index)
{ {
unset($this->packages[$index]); unset($this->packages[$index]);

View File

@ -102,6 +102,7 @@ class Problem
/** /**
* @internal * @internal
* @return string
*/ */
public static function formatDeduplicatedRules($rules, $indent, RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array()) public static function formatDeduplicatedRules($rules, $indent, RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array())
{ {
@ -144,6 +145,9 @@ class Problem
return "\n$indent- ".implode("\n$indent- ", $result); return "\n$indent- ".implode("\n$indent- ", $result);
} }
/**
* @return bool
*/
public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool) public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool)
{ {
foreach ($this->reasons as $sectionRules) { foreach ($this->reasons as $sectionRules) {
@ -153,6 +157,8 @@ class Problem
} }
} }
} }
return false;
} }
/** /**
@ -160,6 +166,8 @@ class Problem
* *
* @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
*
* @return void
*/ */
protected function addReason($id, Rule $reason) protected function addReason($id, Rule $reason)
{ {
@ -172,6 +180,9 @@ class Problem
} }
} }
/**
* @return void
*/
public function nextSection() public function nextSection()
{ {
$this->section++; $this->section++;
@ -179,6 +190,7 @@ class Problem
/** /**
* @internal * @internal
* @return array{0: string, 1: string}
*/ */
public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, $constraint = null) public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, $constraint = null)
{ {
@ -331,6 +343,7 @@ class Problem
/** /**
* @internal * @internal
* @return string
*/ */
public static function getPackageList(array $packages, $isVerbose) public static function getPackageList(array $packages, $isVerbose)
{ {
@ -360,6 +373,11 @@ class Problem
return implode(', ', $prepared); return implode(', ', $prepared);
} }
/**
* @param string $version
* @param string $packageName
* @return string
*/
private static function getPlatformPackageVersion(Pool $pool, $packageName, $version) private static function getPlatformPackageVersion(Pool $pool, $packageName, $version)
{ {
$available = $pool->whatProvides($packageName); $available = $pool->whatProvides($packageName);
@ -410,6 +428,9 @@ class Problem
return $filtered; return $filtered;
} }
/**
* @return bool
*/
private static function hasMultipleNames(array $packages) private static function hasMultipleNames(array $packages)
{ {
$name = null; $name = null;
@ -424,6 +445,9 @@ class Problem
return false; return false;
} }
/**
* @return array{0: string, 1: string}
*/
private static function computeCheckForLowerPrioRepo($isVerbose, $packageName, $constraint, array $higherRepoPackages, array $allReposPackages, $reason) private static function computeCheckForLowerPrioRepo($isVerbose, $packageName, $constraint, array $higherRepoPackages, array $allReposPackages, $reason)
{ {
$nextRepoPackages = array(); $nextRepoPackages = array();

View File

@ -123,46 +123,73 @@ class Request
$this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies; $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
} }
/**
* @return string[]
*/
public function getUpdateAllowList() public function getUpdateAllowList()
{ {
return $this->updateAllowList; return $this->updateAllowList;
} }
/**
* @return bool
*/
public function getUpdateAllowTransitiveDependencies() public function getUpdateAllowTransitiveDependencies()
{ {
return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED; return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED;
} }
/**
* @return bool
*/
public function getUpdateAllowTransitiveRootDependencies() public function getUpdateAllowTransitiveRootDependencies()
{ {
return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS; return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
} }
/**
* @return array<string, ConstraintInterface>
*/
public function getRequires() public function getRequires()
{ {
return $this->requires; return $this->requires;
} }
/**
* @return array<string, PackageInterface>
*/
public function getFixedPackages() public function getFixedPackages()
{ {
return $this->fixedPackages; return $this->fixedPackages;
} }
/**
* @return bool
*/
public function isFixedPackage(PackageInterface $package) public function isFixedPackage(PackageInterface $package)
{ {
return isset($this->fixedPackages[spl_object_hash($package)]); return isset($this->fixedPackages[spl_object_hash($package)]);
} }
/**
* @return array<string, PackageInterface>
*/
public function getLockedPackages() public function getLockedPackages()
{ {
return $this->lockedPackages; return $this->lockedPackages;
} }
/**
* @return bool
*/
public function isLockedPackage(PackageInterface $package) public function isLockedPackage(PackageInterface $package)
{ {
return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]); return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]);
} }
/**
* @return array<string, PackageInterface>
*/
public function getFixedOrLockedPackages() public function getFixedOrLockedPackages()
{ {
return array_merge($this->fixedPackages, $this->lockedPackages); return array_merge($this->fixedPackages, $this->lockedPackages);
@ -170,6 +197,9 @@ class Request
// TODO look into removing the packageIds option, the only place true is used is for the installed map in the solver problems // TODO look into removing the packageIds option, the only place true is used is for the installed map in the solver problems
// some locked packages may not be in the pool so they have a package->id of -1 // some locked packages may not be in the pool so they have a package->id of -1
/**
* @return array<int|string, PackageInterface>
*/
public function getPresentMap($packageIds = false) public function getPresentMap($packageIds = false)
{ {
$presentMap = array(); $presentMap = array();
@ -187,6 +217,9 @@ class Request
return $presentMap; return $presentMap;
} }
/**
* @return PackageInterface[]
*/
public function getFixedPackagesMap() public function getFixedPackagesMap()
{ {
$fixedPackagesMap = array(); $fixedPackagesMap = array();
@ -198,6 +231,9 @@ class Request
return $fixedPackagesMap; return $fixedPackagesMap;
} }
/**
* @return ?LockArrayRepository
*/
public function getLockedRepository() public function getLockedRepository()
{ {
return $this->lockedRepository; return $this->lockedRepository;

View File

@ -100,12 +100,18 @@ class RuleSet implements \IteratorAggregate, \Countable
} }
} }
/**
* @return int
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function count() public function count()
{ {
return $this->nextRuleId; return $this->nextRuleId;
} }
/**
* @return Rule
*/
public function ruleById($id) public function ruleById($id)
{ {
return $this->ruleById[$id]; return $this->ruleById[$id];
@ -148,6 +154,9 @@ class RuleSet implements \IteratorAggregate, \Countable
return new RuleSetIterator($rules); return new RuleSetIterator($rules);
} }
/**
* @return RuleSetIterator
*/
public function getIteratorWithout($types) public function getIteratorWithout($types)
{ {
if (!\is_array($types)) { if (!\is_array($types)) {
@ -172,6 +181,9 @@ class RuleSet implements \IteratorAggregate, \Countable
return array_keys($types); return array_keys($types);
} }
/**
* @return string
*/
public function getPrettyString(RepositorySet $repositorySet = null, Request $request = null, Pool $pool = null, $isVerbose = false) public function getPrettyString(RepositorySet $repositorySet = null, Request $request = null, Pool $pool = null, $isVerbose = false)
{ {
$string = "\n"; $string = "\n";

View File

@ -122,6 +122,9 @@ class RuleSetGenerator
return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData); return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
} }
/**
* @return Rule
*/
protected function createMultiConflictRule(array $packages, $reason, $reasonData = null) protected function createMultiConflictRule(array $packages, $reason, $reasonData = null)
{ {
$literals = array(); $literals = array();
@ -144,6 +147,8 @@ class RuleSetGenerator
* *
* @param int $type A TYPE_* constant defining the rule type * @param int $type A TYPE_* constant defining the rule type
* @param Rule $newRule The rule about to be added * @param Rule $newRule The rule about to be added
*
* @return void
*/ */
private function addRule($type, Rule $newRule = null) private function addRule($type, Rule $newRule = null)
{ {
@ -154,6 +159,9 @@ class RuleSetGenerator
$this->rules->add($newRule, $type); $this->rules->add($newRule, $type);
} }
/**
* @return void
*/
protected function addRulesForPackage(BasePackage $package, $ignorePlatformReqs) protected function addRulesForPackage(BasePackage $package, $ignorePlatformReqs)
{ {
/** @var \SplQueue<BasePackage> */ /** @var \SplQueue<BasePackage> */
@ -202,6 +210,9 @@ class RuleSetGenerator
} }
} }
/**
* @return void
*/
protected function addConflictRules($ignorePlatformReqs = false) protected function addConflictRules($ignorePlatformReqs = false)
{ {
/** @var BasePackage $package */ /** @var BasePackage $package */
@ -237,6 +248,9 @@ class RuleSetGenerator
} }
} }
/**
* @return void
*/
protected function addRulesForRequest(Request $request, $ignorePlatformReqs) protected function addRulesForRequest(Request $request, $ignorePlatformReqs)
{ {
foreach ($request->getFixedPackages() as $package) { foreach ($request->getFixedPackages() as $package) {
@ -278,6 +292,9 @@ class RuleSetGenerator
} }
} }
/**
* @return void
*/
protected function addRulesForRootAliases($ignorePlatformReqs) protected function addRulesForRootAliases($ignorePlatformReqs)
{ {
foreach ($this->pool->getPackages() as $package) { foreach ($this->pool->getPackages() as $package) {
@ -295,6 +312,7 @@ class RuleSetGenerator
/** /**
* @param bool|array $ignorePlatformReqs * @param bool|array $ignorePlatformReqs
* @return RuleSet
*/ */
public function getRulesFor(Request $request, $ignorePlatformReqs = false) public function getRulesFor(Request $request, $ignorePlatformReqs = false)
{ {

View File

@ -42,18 +42,27 @@ class RuleSetIterator implements \Iterator
$this->rewind(); $this->rewind();
} }
/**
* @return Rule
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function current() public function current()
{ {
return $this->rules[$this->currentType][$this->currentOffset]; return $this->rules[$this->currentType][$this->currentOffset];
} }
/**
* @return RuleSet::TYPE_*|-1
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function key() public function key()
{ {
return $this->currentType; return $this->currentType;
} }
/**
* @return void
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function next() public function next()
{ {
@ -79,6 +88,9 @@ class RuleSetIterator implements \Iterator
} }
} }
/**
* @return void
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function rewind() public function rewind()
{ {
@ -99,6 +111,9 @@ class RuleSetIterator implements \Iterator
} while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType])); } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
} }
/**
* @return bool
*/
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function valid() public function valid()
{ {

View File

@ -76,6 +76,9 @@ class Solver
return \count($this->rules); return \count($this->rules);
} }
/**
* @return Pool
*/
public function getPool() public function getPool()
{ {
return $this->pool; return $this->pool;
@ -83,6 +86,9 @@ class Solver
// aka solver_makeruledecisions // aka solver_makeruledecisions
/**
* @return void
*/
private function makeAssertionRuleDecisions() private function makeAssertionRuleDecisions()
{ {
$decisionStart = \count($this->decisions) - 1; $decisionStart = \count($this->decisions) - 1;
@ -153,6 +159,9 @@ class Solver
} }
} }
/**
* @return void
*/
protected function setupFixedMap(Request $request) protected function setupFixedMap(Request $request)
{ {
$this->fixedMap = array(); $this->fixedMap = array();
@ -164,6 +173,8 @@ class Solver
/** /**
* @param Request $request * @param Request $request
* @param bool|array $ignorePlatformReqs * @param bool|array $ignorePlatformReqs
*
* @return void
*/ */
protected function checkForRootRequireProblems(Request $request, $ignorePlatformReqs) protected function checkForRootRequireProblems(Request $request, $ignorePlatformReqs)
{ {
@ -251,6 +262,8 @@ class Solver
* Reverts a decision at the given level. * Reverts a decision at the given level.
* *
* @param int $level * @param int $level
*
* @return void
*/ */
private function revert($level) private function revert($level)
{ {
@ -513,6 +526,9 @@ class Solver
return array($learnedLiterals[0], $ruleLevel, $newRule, $why); return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
} }
/**
* @return void
*/
private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen) private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen)
{ {
$why = spl_object_hash($conflictRule); $why = spl_object_hash($conflictRule);
@ -599,6 +615,8 @@ class Solver
* we have enabled or disabled some of our rules. We now re-enable all * we have enabled or disabled some of our rules. We now re-enable all
* of our learnt rules except the ones that were learnt from rules that * of our learnt rules except the ones that were learnt from rules that
* are now disabled. * are now disabled.
*
* @return void
*/ */
private function enableDisableLearnedRules() private function enableDisableLearnedRules()
{ {
@ -622,6 +640,9 @@ class Solver
} }
} }
/**
* @return void
*/
private function runSat() private function runSat()
{ {
$this->propagateIndex = 0; $this->propagateIndex = 0;

View File

@ -40,6 +40,9 @@ class SolverProblemsException extends \RuntimeException
parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED); parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED);
} }
/**
* @return string
*/
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $isDevExtraction = false) public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $isDevExtraction = false)
{ {
$installedMap = $request->getPresentMap(true); $installedMap = $request->getPresentMap(true);
@ -54,7 +57,7 @@ class SolverProblemsException extends \RuntimeException
$hasExtensionProblems = true; $hasExtensionProblems = true;
} }
$isCausedByLock |= $problem->isCausedByLock($repositorySet, $request, $pool); $isCausedByLock = $isCausedByLock || $problem->isCausedByLock($repositorySet, $request, $pool);
} }
$i = 1; $i = 1;
@ -93,11 +96,17 @@ class SolverProblemsException extends \RuntimeException
return $text; return $text;
} }
/**
* @return Problem[]
*/
public function getProblems() public function getProblems()
{ {
return $this->problems; return $this->problems;
} }
/**
* @return string
*/
private function createExtensionHint() private function createExtensionHint()
{ {
$paths = IniHelper::getAll(); $paths = IniHelper::getAll();
@ -113,6 +122,9 @@ class SolverProblemsException extends \RuntimeException
return $text; return $text;
} }
/**
* @return bool
*/
private function hasExtensionProblems(array $reasonSets) private function hasExtensionProblems(array $reasonSets)
{ {
foreach ($reasonSets as $reasonSet) { foreach ($reasonSets as $reasonSet) {

View File

@ -32,6 +32,9 @@ abstract class ArchiveDownloader extends FileDownloader
*/ */
public $cleanupExecuted = array(); public $cleanupExecuted = array();
/**
* @return PromiseInterface|null
*/
public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null) public function prepare($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
{ {
unset($this->cleanupExecuted[$package->getName()]); unset($this->cleanupExecuted[$package->getName()]);
@ -39,6 +42,9 @@ abstract class ArchiveDownloader extends FileDownloader
return parent::prepare($type, $package, $path, $prevPackage); return parent::prepare($type, $package, $path, $prevPackage);
} }
/**
* @return PromiseInterface|null
*/
public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null) public function cleanup($type, PackageInterface $package, $path, PackageInterface $prevPackage = null)
{ {
$this->cleanupExecuted[$package->getName()] = true; $this->cleanupExecuted[$package->getName()] = true;
@ -50,6 +56,7 @@ abstract class ArchiveDownloader extends FileDownloader
* {@inheritDoc} * {@inheritDoc}
* @throws \RuntimeException * @throws \RuntimeException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
* @return PromiseInterface
*/ */
public function install(PackageInterface $package, $path, $output = true) public function install(PackageInterface $package, $path, $output = true)
{ {

View File

@ -163,6 +163,9 @@ class DownloadManager
return $downloader; return $downloader;
} }
/**
* @return string
*/
public function getDownloaderType(DownloaderInterface $downloader) public function getDownloaderType(DownloaderInterface $downloader)
{ {
return array_search($downloader, $this->downloaders); return array_search($downloader, $this->downloaders);

View File

@ -218,6 +218,9 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
return trim($output) ?: null; return trim($output) ?: null;
} }
/**
* @return null|string
*/
public function getUnpushedChanges(PackageInterface $package, $path) public function getUnpushedChanges(PackageInterface $package, $path)
{ {
GitUtil::cleanEnv(); GitUtil::cleanEnv();
@ -590,6 +593,10 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
return is_dir($path.'/.git'); return is_dir($path.'/.git');
} }
/**
* @param string $reference
* @return string
*/
protected function getShortHash($reference) protected function getShortHash($reference)
{ {
if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) { if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {

View File

@ -52,6 +52,9 @@ class PerforceDownloader extends VcsDownloader
return \React\Promise\resolve(); return \React\Promise\resolve();
} }
/**
* @return string|null
*/
private function getLabelFromSourceReference($ref) private function getLabelFromSourceReference($ref)
{ {
$pos = strpos($ref, '@'); $pos = strpos($ref, '@');
@ -78,6 +81,9 @@ class PerforceDownloader extends VcsDownloader
$this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io); $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
} }
/**
* @return array<string, mixed>
*/
private function getRepoConfig(VcsRepository $repository) private function getRepoConfig(VcsRepository $repository)
{ {
return $repository->getRepoConfig(); return $repository->getRepoConfig();

View File

@ -77,6 +77,7 @@ class EventDispatcher
* Set whether script handlers are active or not * Set whether script handlers are active or not
* *
* @param bool $runScripts * @param bool $runScripts
* @return $this
*/ */
public function setRunScripts($runScripts = true) public function setRunScripts($runScripts = true)
{ {
@ -336,6 +337,9 @@ class EventDispatcher
return $returnMax; return $returnMax;
} }
/**
* @return int
*/
protected function executeTty($exec) protected function executeTty($exec)
{ {
if ($this->io->isInteractive()) { if ($this->io->isInteractive()) {
@ -345,6 +349,9 @@ class EventDispatcher
return $this->process->execute($exec); return $this->process->execute($exec);
} }
/**
* @return string
*/
protected function getPhpExecCommand() protected function getPhpExecCommand()
{ {
$finder = new PhpExecutableFinder(); $finder = new PhpExecutableFinder();
@ -536,7 +543,7 @@ class EventDispatcher
/** /**
* Pops the active event from the stack * Pops the active event from the stack
* *
* @return mixed * @return string|null
*/ */
protected function popEvent() protected function popEvent()
{ {

View File

@ -241,11 +241,17 @@ class Factory
return $config; return $config;
} }
/**
* @return string
*/
public static function getComposerFile() public static function getComposerFile()
{ {
return trim(getenv('COMPOSER')) ?: './composer.json'; return trim(getenv('COMPOSER')) ?: './composer.json';
} }
/**
* @return string
*/
public static function getLockFile($composerFile) public static function getLockFile($composerFile)
{ {
return "json" === pathinfo($composerFile, PATHINFO_EXTENSION) return "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
@ -253,6 +259,9 @@ class Factory
: $composerFile . '.lock'; : $composerFile . '.lock';
} }
/**
* @return array{highlight: OutputFormatterStyle, warning: OutputFormatterStyle}
*/
public static function createAdditionalStyles() public static function createAdditionalStyles()
{ {
return array( return array(
@ -596,6 +605,9 @@ class Factory
} }
} }
/**
* @return Package\Loader\RootPackageLoader
*/
protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io) protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io)
{ {
return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io); return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);