1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 00:53:06 +00:00

Fixes from PHPStan (#7687)

* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
This commit is contained in:
Gabriel Caruso 2018-11-12 12:23:32 -02:00 committed by Jordi Boggiano
parent 38a34159ef
commit 2a13bb2649
86 changed files with 163 additions and 166 deletions

View file

@ -737,7 +737,7 @@ EOT
/**
* Display the tree
*
* @param $arrayTree
* @param array $arrayTree
*/
protected function displayPackageTree(array $arrayTree)
{
@ -782,7 +782,7 @@ EOT
/**
* Generate the package tree
*
* @param PackageInterface|string $package
* @param PackageInterface $package
* @param RepositoryInterface $installedRepo
* @param RepositoryInterface $distantRepos
* @return array
@ -792,38 +792,36 @@ EOT
RepositoryInterface $installedRepo,
RepositoryInterface $distantRepos
) {
if (is_object($package)) {
$requires = $package->getRequires();
ksort($requires);
$children = array();
foreach ($requires as $requireName => $require) {
$packagesInTree = array($package->getName(), $requireName);
$requires = $package->getRequires();
ksort($requires);
$children = array();
foreach ($requires as $requireName => $require) {
$packagesInTree = array($package->getName(), $requireName);
$treeChildDesc = array(
'name' => $requireName,
'version' => $require->getPrettyConstraint(),
);
$deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
if ($deepChildren) {
$treeChildDesc['requires'] = $deepChildren;
}
$children[] = $treeChildDesc;
}
$tree = array(
'name' => $package->getPrettyName(),
'version' => $package->getPrettyVersion(),
'description' => $package->getDescription(),
$treeChildDesc = array(
'name' => $requireName,
'version' => $require->getPrettyConstraint(),
);
if ($children) {
$tree['requires'] = $children;
$deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
if ($deepChildren) {
$treeChildDesc['requires'] = $deepChildren;
}
return $tree;
$children[] = $treeChildDesc;
}
$tree = array(
'name' => $package->getPrettyName(),
'version' => $package->getPrettyVersion(),
'description' => $package->getDescription(),
);
if ($children) {
$tree['requires'] = $children;
}
return $tree;
}
/**