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()): string
{
$messages = array();
$templates = array();
@ -210,7 +210,7 @@ class Problem
* @param string $packageName
* @return array{0: string, 1: string}
*/
public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, ConstraintInterface $constraint = null)
public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, ConstraintInterface $constraint = null): array
{
if (PlatformRepository::isPlatformPackage($packageName)) {
// handle php/php-*/hhvm
@ -382,7 +382,7 @@ class Problem
* @param bool $useRemovedVersionGroup
* @return string
*/
public static function getPackageList(array $packages, $isVerbose, Pool $pool = null, ConstraintInterface $constraint = null, $useRemovedVersionGroup = false)
public static function getPackageList(array $packages, $isVerbose, Pool $pool = null, ConstraintInterface $constraint = null, $useRemovedVersionGroup = false): string
{
$prepared = array();
$hasDefaultBranch = array();
@ -427,7 +427,7 @@ class Problem
* @param string $version the effective runtime version of the platform package
* @return ?string a version string or null if it appears the package was artificially disabled
*/
private static function getPlatformPackageVersion(Pool $pool, $packageName, $version)
private static function getPlatformPackageVersion(Pool $pool, $packageName, $version): ?string
{
$available = $pool->whatProvides($packageName);
@ -471,7 +471,7 @@ class Problem
* @param int $maxDev
* @return list<string> a list of pretty versions and '...' where versions were removed
*/
private static function condenseVersionList(array $versions, $max, $maxDev = 16)
private static function condenseVersionList(array $versions, $max, $maxDev = 16): array
{
if (count($versions) <= $max) {
return $versions;
@ -505,7 +505,7 @@ class Problem
* @param PackageInterface[] $packages
* @return bool
*/
private static function hasMultipleNames(array $packages)
private static function hasMultipleNames(array $packages): bool
@ -183,7 +183,7 @@ class SuggestedPackagesReporter
* @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 mixed[]
*/
private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null)
private function createLink($source, $sourceVersion, $description, $target, $prettyConstraint)
private function createLink($source, $sourceVersion, $description, $target, $prettyConstraint): Link
{
if (!\is_string($prettyConstraint)) {
throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');
@ -788,7 +788,7 @@ class Package extends BasePackage
* @param string $source
* @return array<string,Link>
*/
private function convertLinksToMap(array $links, $source)
private function convertLinksToMap(array $links, $source): array
{
trigger_error('Package::'.$source.' must be called with a map of lowercased package name => Link object, got a indexed array, this is deprecated and you should fix your usage.');
private function throwException($message, $url): void
{
if (null === self::getVersion($this->process)) {
throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));