1
0
Fork 0

Add return types to private/internal methods

pull/10547/head
Jordi Boggiano 2022-02-18 11:22:01 +01:00
parent abdc6893a6
commit a16ed3d0ed
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
134 changed files with 365 additions and 359 deletions

View File

@ -441,7 +441,7 @@ EOF;
* @param array<string, true> $scannedFiles * @param array<string, true> $scannedFiles
* @return array<class-string, string> * @return array<class-string, string>
*/ */
private function addClassMapCode(Filesystem $filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles) private function addClassMapCode(Filesystem $filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles): array
{ {
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) { foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n"; $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
@ -464,7 +464,7 @@ EOF;
* @param array<string, true> $scannedFiles * @param array<string, true> $scannedFiles
* @return array<class-string, string> * @return array<class-string, string>
*/ */
private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles) private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles): array
{ {
if ($excluded) { if ($excluded) {
// filter excluded patterns here to only use those matching $dir // filter excluded patterns here to only use those matching $dir

View File

@ -157,7 +157,7 @@ class ClassMapGenerator
* @param ?IOInterface $io IO object * @param ?IOInterface $io IO object
* @return array<int, class-string> valid classes * @return array<int, class-string> valid classes
*/ */
private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io) private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io): array
{ {
$validClasses = array(); $validClasses = array();
$rejectedClasses = array(); $rejectedClasses = array();
@ -215,7 +215,7 @@ class ClassMapGenerator
* @throws \RuntimeException * @throws \RuntimeException
* @return array<int, class-string> The found classes * @return array<int, class-string> The found classes
*/ */
private static function findClasses($path) private static function findClasses($path): array
{ {
$extraTypes = self::getExtraTypes(); $extraTypes = self::getExtraTypes();
@ -296,7 +296,7 @@ class ClassMapGenerator
/** /**
* @return string * @return string
*/ */
private static function getExtraTypes() private static function getExtraTypes(): string
{ {
static $extraTypes = null; static $extraTypes = null;

View File

@ -78,7 +78,7 @@ class PhpFileCleaner
/** /**
* @return string * @return string
*/ */
public function clean() public function clean(): string
{ {
$clean = ''; $clean = '';
@ -260,7 +260,7 @@ class PhpFileCleaner
* @param string $char * @param string $char
* @return bool * @return bool
*/ */
private function peek($char) private function peek($char): bool
{ {
return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char; return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
} }
@ -270,7 +270,7 @@ class PhpFileCleaner
* @param ?array<int, string> $match * @param ?array<int, string> $match
* @return bool * @return bool
*/ */
private function match($regex, array &$match = null) private function match($regex, array &$match = null): bool
{ {
return Preg::isMatch($regex, $this->contents, $match, 0, $this->index); return Preg::isMatch($regex, $this->contents, $match, 0, $this->index);
} }

View File

@ -260,7 +260,8 @@ EOT
try { try {
$this->httpDownloader->get($proto . '://repo.packagist.org/packages.json'); $this->httpDownloader->get($proto . '://repo.packagist.org/packages.json');
} catch (TransportException $e) { } catch (TransportException $e) {
if ($hints = HttpDownloader::getExceptionHints($e)) { $hints = HttpDownloader::getExceptionHints($e);
if (null !== $hints && count($hints) > 0) {
foreach ($hints as $hint) { foreach ($hints as $hint) {
$result[] = $hint; $result[] = $hint;
} }
@ -436,7 +437,7 @@ EOT
/** /**
* @return string * @return string
*/ */
private function getCurlVersion() private function getCurlVersion(): string
{ {
if (extension_loaded('curl')) { if (extension_loaded('curl')) {
if (!HttpDownloader::isCurlEnabled()) { if (!HttpDownloader::isCurlEnabled()) {
@ -458,7 +459,7 @@ EOT
* *
* @return void * @return void
*/ */
private function outputResult($result) private function outputResult($result): void
{ {
$io = $this->getIO(); $io = $this->getIO();
if (true === $result) { if (true === $result) {

View File

@ -134,7 +134,7 @@ class FundCommand extends BaseCommand
* @param mixed[] $fundings * @param mixed[] $fundings
* @return mixed[] * @return mixed[]
*/ */
private function insertFundingData(array $fundings, CompletePackageInterface $package) private function insertFundingData(array $fundings, CompletePackageInterface $package): array
{ {
foreach ($package->getFunding() as $fundingOption) { foreach ($package->getFunding() as $fundingOption) {
list($vendor, $packageName) = explode('/', $package->getPrettyName()); list($vendor, $packageName) = explode('/', $package->getPrettyName());

View File

@ -101,7 +101,7 @@ EOT
* @param bool $showOnly * @param bool $showOnly
* @return bool * @return bool
*/ */
private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly) private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly): bool
{ {
$support = $package->getSupport(); $support = $package->getSupport();
$url = $support['source'] ?? $package->getSourceUrl(); $url = $support['source'] ?? $package->getSourceUrl();
@ -158,7 +158,7 @@ EOT
* *
* @return RepositoryInterface[] * @return RepositoryInterface[]
*/ */
private function initializeRepos() private function initializeRepos(): array
{ {
$composer = $this->tryComposer(); $composer = $this->tryComposer();

View File

@ -623,7 +623,7 @@ EOT
/** /**
* @return void * @return void
*/ */
private function updateDependencies(OutputInterface $output) private function updateDependencies(OutputInterface $output): void
{ {
try { try {
$updateCommand = $this->getApplication()->find('update'); $updateCommand = $this->getApplication()->find('update');
@ -637,7 +637,7 @@ EOT
/** /**
* @return void * @return void
*/ */
private function runDumpAutoloadCommand(OutputInterface $output) private function runDumpAutoloadCommand(OutputInterface $output): void
{ {
try { try {
$command = $this->getApplication()->find('dump-autoload'); $command = $this->getApplication()->find('dump-autoload');
@ -652,7 +652,7 @@ EOT
* @param array<string, string|array<string>> $options * @param array<string, string|array<string>> $options
* @return bool * @return bool
*/ */
private function hasDependencies($options) private function hasDependencies($options): bool
{ {
$requires = (array) $options['require']; $requires = (array) $options['require'];
$devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array(); $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();

View File

@ -163,7 +163,7 @@ EOT
* @param array<string, PackageInterface> $bucket * @param array<string, PackageInterface> $bucket
* @return array<string, PackageInterface> * @return array<string, PackageInterface>
*/ */
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()) private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()): array
{ {
$requires = array_keys($package->getRequires()); $requires = array_keys($package->getRequires());

View File

@ -296,7 +296,7 @@ EOT
* @param string $requireKey * @param string $requireKey
* @return string[] * @return string[]
*/ */
private function getInconsistentRequireKeys(array $newRequirements, $requireKey) private function getInconsistentRequireKeys(array $newRequirements, $requireKey): array
{ {
$requireKeys = $this->getPackagesByRequireKey(); $requireKeys = $this->getPackagesByRequireKey();
$inconsistentRequirements = array(); $inconsistentRequirements = array();
@ -315,7 +315,7 @@ EOT
/** /**
* @return array<string, string> * @return array<string, string>
*/ */
private function getPackagesByRequireKey() private function getPackagesByRequireKey(): array
{ {
$composerDefinition = $this->json->read(); $composerDefinition = $this->json->read();
$require = array(); $require = array();
@ -351,7 +351,7 @@ EOT
* @return int * @return int
* @throws \Exception * @throws \Exception
*/ */
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, $requireKey, $removeKey) private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, $requireKey, $removeKey): int
{ {
// Update packages // Update packages
$this->resetComposer(); $this->resetComposer();
@ -449,7 +449,7 @@ EOT
* @param bool $sortPackages * @param bool $sortPackages
* @return bool * @return bool
*/ */
private function updateFileCleanly(JsonFile $json, array $new, $requireKey, $removeKey, $sortPackages) private function updateFileCleanly(JsonFile $json, array $new, $requireKey, $removeKey, $sortPackages): bool
{ {
$contents = file_get_contents($json->getPath()); $contents = file_get_contents($json->getPath());

View File

@ -923,7 +923,7 @@ EOT
* @param array<string, string> $versions * @param array<string, string> $versions
* @return array<string, string|string[]|null> * @return array<string, string|string[]|null>
*/ */
private function appendVersions($json, array $versions) private function appendVersions($json, array $versions): array
{ {
uasort($versions, 'version_compare'); uasort($versions, 'version_compare');
$versions = array_keys(array_reverse($versions)); $versions = array_keys(array_reverse($versions));
@ -936,7 +936,7 @@ EOT
* @param array<string, string|string[]|null> $json * @param array<string, string|string[]|null> $json
* @return array<string, string|string[]|null> * @return array<string, string|string[]|null>
*/ */
private function appendLicenses($json, CompletePackageInterface $package) private function appendLicenses($json, CompletePackageInterface $package): array
{ {
if ($licenses = $package->getLicense()) { if ($licenses = $package->getLicense()) {
$spdxLicenses = new SpdxLicenses(); $spdxLicenses = new SpdxLicenses();
@ -963,7 +963,7 @@ EOT
* @param array<string, string|string[]|null> $json * @param array<string, string|string[]|null> $json
* @return array<string, string|string[]|null> * @return array<string, string|string[]|null>
*/ */
private function appendAutoload($json, CompletePackageInterface $package) private function appendAutoload($json, CompletePackageInterface $package): array
{ {
if ($package->getAutoload()) { if ($package->getAutoload()) {
$autoload = array(); $autoload = array();
@ -996,7 +996,7 @@ EOT
* @param array<string, string|string[]|null> $json * @param array<string, string|string[]|null> $json
* @return array<string, string|string[]|null> * @return array<string, string|string[]|null>
*/ */
private function appendLinks($json, CompletePackageInterface $package) private function appendLinks($json, CompletePackageInterface $package): array
{ {
foreach (Link::$TYPES as $linkType) { foreach (Link::$TYPES as $linkType) {
$json = $this->appendLink($json, $package, $linkType); $json = $this->appendLink($json, $package, $linkType);
@ -1010,7 +1010,7 @@ EOT
* @param string $linkType * @param string $linkType
* @return array<string, string|string[]|null> * @return array<string, string|string[]|null>
*/ */
private function appendLink($json, CompletePackageInterface $package, $linkType) private function appendLink($json, CompletePackageInterface $package, $linkType): array
{ {
$links = $package->{'get' . ucfirst($linkType)}(); $links = $package->{'get' . ucfirst($linkType)}();
@ -1240,7 +1240,7 @@ EOT
* @param string $updateStatus * @param string $updateStatus
* @return string * @return string
*/ */
private function updateStatusToVersionStyle($updateStatus) private function updateStatusToVersionStyle($updateStatus): string
{ {
// 'up-to-date' is printed green // 'up-to-date' is printed green
// 'semver-safe-update' is printed red // 'semver-safe-update' is printed red
@ -1251,7 +1251,7 @@ EOT
/** /**
* @return string * @return string
*/ */
private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package) private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package): string
{ {
if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) { if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
return 'up-to-date'; return 'up-to-date';
@ -1275,7 +1275,7 @@ EOT
* *
* @return void * @return void
*/ */
private function writeTreeLine($line) private function writeTreeLine($line): void
{ {
$io = $this->getIO(); $io = $this->getIO();
if (!$io->isDecorated()) { if (!$io->isDecorated()) {
@ -1326,7 +1326,7 @@ EOT
/** /**
* @return RepositorySet * @return RepositorySet
*/ */
private function getRepositorySet(Composer $composer) private function getRepositorySet(Composer $composer): RepositorySet
{ {
if (!$this->repositorySet) { if (!$this->repositorySet) {
$this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags()); $this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
@ -1342,7 +1342,7 @@ EOT
* @param array<PackageInterface> $bucket * @param array<PackageInterface> $bucket
* @return array<PackageInterface> * @return array<PackageInterface>
*/ */
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()) private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()): array
{ {
$requires = $package->getRequires(); $requires = $package->getRequires();

View File

@ -80,7 +80,7 @@ EOT
/** /**
* @return int * @return int
*/ */
private function doExecute(InputInterface $input) private function doExecute(InputInterface $input): int
{ {
// init repos // init repos
$composer = $this->requireComposer(); $composer = $this->requireComposer();

View File

@ -245,7 +245,7 @@ EOT
* @param array<string> $packages * @param array<string> $packages
* @return array<string> * @return array<string>
*/ */
private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages) private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages): array
{ {
if (!$input->isInteractive()) { if (!$input->isInteractive()) {
throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.'); throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
@ -312,7 +312,7 @@ EOT
* @param string $constraint * @param string $constraint
* @return Link * @return Link
*/ */
private function appendConstraintToLink(Link $link, $constraint) private function appendConstraintToLink(Link $link, $constraint): Link
{ {
$parser = new VersionParser; $parser = new VersionParser;
$oldPrettyString = $link->getConstraint()->getPrettyString(); $oldPrettyString = $link->getConstraint()->getPrettyString();

View File

@ -201,7 +201,7 @@ class Compiler
* @param \SplFileInfo $file * @param \SplFileInfo $file
* @return string * @return string
*/ */
private function getRelativeFilePath($file) private function getRelativeFilePath($file): string
{ {
$realPath = $file->getRealPath(); $realPath = $file->getRealPath();
$pathPrefix = dirname(__DIR__, 2).DIRECTORY_SEPARATOR; $pathPrefix = dirname(__DIR__, 2).DIRECTORY_SEPARATOR;
@ -258,7 +258,7 @@ class Compiler
* @param string $source A PHP string * @param string $source A PHP string
* @return string The PHP string with the whitespace removed * @return string The PHP string with the whitespace removed
*/ */
private function stripWhitespace($source) private function stripWhitespace($source): string
{ {
if (!function_exists('token_get_all')) { if (!function_exists('token_get_all')) {
return $source; return $source;
@ -289,7 +289,7 @@ class Compiler
/** /**
* @return string * @return string
*/ */
private function getStub() private function getStub(): string
{ {
$stub = <<<'EOF' $stub = <<<'EOF'
#!/usr/bin/env php #!/usr/bin/env php

View File

@ -531,7 +531,7 @@ class Config
* @param string $path * @param string $path
* @return string * @return string
*/ */
private function realpath($path) private function realpath($path): string
{ {
if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) { if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
return $path; return $path;

View File

@ -214,7 +214,7 @@ class JsonConfigSource implements ConfigSourceInterface
* *
* @return void * @return void
*/ */
private function manipulateJson($method, $fallback, ...$args) private function manipulateJson($method, $fallback, ...$args): void
{ {
if ($this->file->exists()) { if ($this->file->exists()) {
if (!is_writable($this->file->getPath())) { if (!is_writable($this->file->getPath())) {
@ -297,7 +297,7 @@ class JsonConfigSource implements ConfigSourceInterface
* @param mixed $value * @param mixed $value
* @return int * @return int
*/ */
private function arrayUnshiftRef(&$array, &$value) private function arrayUnshiftRef(&$array, &$value): int
{ {
$return = array_unshift($array, ''); $return = array_unshift($array, '');
$array[0] = &$value; $array[0] = &$value;

View File

@ -358,7 +358,7 @@ class Application extends BaseApplication
* @throws \RuntimeException * @throws \RuntimeException
* @return string * @return string
*/ */
private function getNewWorkingDir(InputInterface $input) private function getNewWorkingDir(InputInterface $input): string
{ {
$workingDir = $input->getParameterOption(array('--working-dir', '-d')); $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
if (false !== $workingDir && !is_dir($workingDir)) { if (false !== $workingDir && !is_dir($workingDir)) {
@ -371,7 +371,7 @@ class Application extends BaseApplication
/** /**
* @return void * @return void
*/ */
private function hintCommonErrors(\Exception $exception) private function hintCommonErrors(\Exception $exception): void
{ {
$io = $this->getIO(); $io = $this->getIO();
@ -408,7 +408,8 @@ class Application extends BaseApplication
$io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET); $io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET);
} }
if ($hints = HttpDownloader::getExceptionHints($exception)) { $hints = HttpDownloader::getExceptionHints($exception);
if (null !== $hints && count($hints) > 0) {
foreach ($hints as $hint) { foreach ($hints as $hint) {
$io->writeError($hint, true, IOInterface::QUIET); $io->writeError($hint, true, IOInterface::QUIET);
} }
@ -553,7 +554,7 @@ class Application extends BaseApplication
/** /**
* @return Command\BaseCommand[] * @return Command\BaseCommand[]
*/ */
private function getPluginCommands() private function getPluginCommands(): array
{ {
$commands = array(); $commands = array();

View File

@ -55,7 +55,7 @@ final class GithubActionError
* @param string $data * @param string $data
* @return string * @return string
*/ */
private function escapeData($data) private function escapeData($data): string
{ {
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85 // see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85
$data = str_replace("%", '%25', $data); $data = str_replace("%", '%25', $data);
@ -69,7 +69,7 @@ final class GithubActionError
* @param string $property * @param string $property
* @return string * @return string
*/ */
private function escapeProperty($property) private function escapeProperty($property): string
{ {
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94 // see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94
$property = str_replace("%", '%25', $property); $property = str_replace("%", '%25', $property);

View File

@ -106,7 +106,7 @@ class LockTransaction extends Transaction
* @param bool $updateMirrors * @param bool $updateMirrors
* @return BasePackage[] * @return BasePackage[]
*/ */
public function getNewLockPackages($devMode, $updateMirrors = false) public function getNewLockPackages($devMode, $updateMirrors = false): array
{ {
$packages = array(); $packages = array();
foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) { foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
@ -137,7 +137,7 @@ class LockTransaction extends Transaction
* @param array<array{package: string, version: string, alias: string, alias_normalized: string}> $aliases * @param array<array{package: string, version: string, alias: string, alias_normalized: string}> $aliases
* @return array<array{package: string, version: string, alias: string, alias_normalized: string}> * @return array<array{package: string, version: string, alias: string, alias_normalized: string}>
*/ */
public function getAliases($aliases) public function getAliases($aliases): array
{ {
$usedAliases = array(); $usedAliases = array();

View File

@ -159,7 +159,7 @@ class Pool implements \Countable
* packages must match or null to return all * packages must match or null to return all
* @return BasePackage[] * @return BasePackage[]
*/ */
private function computeWhatProvides($name, ConstraintInterface $constraint = null) private function computeWhatProvides($name, ConstraintInterface $constraint = null): array
{ {
if (!isset($this->packageByName[$name])) { if (!isset($this->packageByName[$name])) {
return array(); return array();

View File

@ -499,7 +499,7 @@ class PoolBuilder
* @param string $name packageName * @param string $name packageName
* @return bool * @return bool
*/ */
private function isRootRequire(Request $request, $name) private function isRootRequire(Request $request, $name): bool
{ {
$rootRequires = $request->getRequires(); $rootRequires = $request->getRequires();
@ -510,7 +510,7 @@ class PoolBuilder
* @param string $name * @param string $name
* @return string[] * @return string[]
*/ */
private function getSkippedRootRequires(Request $request, $name) private function getSkippedRootRequires(Request $request, $name): array
{ {
if (!isset($this->skippedLoad[$name])) { if (!isset($this->skippedLoad[$name])) {
return array(); return array();
@ -553,7 +553,7 @@ class PoolBuilder
* *
* @return bool * @return bool
*/ */
private function isUpdateAllowed(BasePackage $package) private function isUpdateAllowed(BasePackage $package): bool
{ {
foreach ($this->updateAllowList as $pattern => $void) { foreach ($this->updateAllowList as $pattern => $void) {
$patternRegexp = BasePackage::packageNameToRegexp($pattern); $patternRegexp = BasePackage::packageNameToRegexp($pattern);
@ -684,7 +684,7 @@ class PoolBuilder
/** /**
* @return Pool * @return Pool
*/ */
private function runOptimizer(Request $request, Pool $pool) private function runOptimizer(Request $request, Pool $pool): Pool
{ {
if (null === $this->poolOptimizer) { if (null === $this->poolOptimizer) {
return $pool; return $pool;

View File

@ -173,7 +173,7 @@ class PoolOptimizer
/** /**
* @return Pool Optimized pool * @return Pool Optimized pool
*/ */
private function applyRemovalsToPool(Pool $pool) private function applyRemovalsToPool(Pool $pool): Pool
{ {
$packages = array(); $packages = array();
$removedVersions = array(); $removedVersions = array();
@ -278,7 +278,7 @@ class PoolOptimizer
/** /**
* @return string * @return string
*/ */
private function calculateDependencyHash(BasePackage $package) private function calculateDependencyHash(BasePackage $package): string
{ {
$hash = ''; $hash = '';

View File

@ -117,7 +117,7 @@ class Problem
* @return string * @return string
* @internal * @internal
*/ */
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(); $messages = array();
$templates = array(); $templates = array();
@ -210,7 +210,7 @@ class Problem
* @param string $packageName * @param string $packageName
* @return array{0: string, 1: string} * @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)) { if (PlatformRepository::isPlatformPackage($packageName)) {
// handle php/php-*/hhvm // handle php/php-*/hhvm
@ -382,7 +382,7 @@ class Problem
* @param bool $useRemovedVersionGroup * @param bool $useRemovedVersionGroup
* @return string * @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(); $prepared = array();
$hasDefaultBranch = array(); $hasDefaultBranch = array();
@ -427,7 +427,7 @@ class Problem
* @param string $version the effective runtime version of the platform package * @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 * @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); $available = $pool->whatProvides($packageName);
@ -471,7 +471,7 @@ class Problem
* @param int $maxDev * @param int $maxDev
* @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, $maxDev = 16) private static function condenseVersionList(array $versions, $max, $maxDev = 16): array
{ {
if (count($versions) <= $max) { if (count($versions) <= $max) {
return $versions; return $versions;
@ -505,7 +505,7 @@ class Problem
* @param PackageInterface[] $packages * @param PackageInterface[] $packages
* @return bool * @return bool
*/ */
private static function hasMultipleNames(array $packages) private static function hasMultipleNames(array $packages): bool
{ {
$name = null; $name = null;
foreach ($packages as $package) { foreach ($packages as $package) {
@ -527,7 +527,7 @@ class Problem
* @param string $reason * @param string $reason
* @return array{0: string, 1: string} * @return array{0: string, 1: string}
*/ */
private static function computeCheckForLowerPrioRepo(Pool $pool, $isVerbose, $packageName, array $higherRepoPackages, array $allReposPackages, $reason, ConstraintInterface $constraint = null) private static function computeCheckForLowerPrioRepo(Pool $pool, $isVerbose, $packageName, array $higherRepoPackages, array $allReposPackages, $reason, ConstraintInterface $constraint = null): array
{ {
$nextRepoPackages = array(); $nextRepoPackages = array();
$nextRepo = null; $nextRepo = null;

View File

@ -232,7 +232,7 @@ abstract class Rule
* @internal * @internal
* @return BasePackage * @return BasePackage
*/ */
public function getSourcePackage(Pool $pool) public function getSourcePackage(Pool $pool): BasePackage
{ {
$literals = $this->getLiterals(); $literals = $this->getLiterals();
@ -498,7 +498,7 @@ abstract class Rule
/** /**
* @return BasePackage * @return BasePackage
*/ */
private function deduplicateDefaultBranchAlias(BasePackage $package) private function deduplicateDefaultBranchAlias(BasePackage $package): BasePackage
{ {
if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) { if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
$package = $package->getAliasOf(); $package = $package->getAliasOf();

View File

@ -302,7 +302,7 @@ class Solver
* @param string|int $literal * @param string|int $literal
* @return int * @return int
*/ */
private function setPropagateLearn($level, $literal, Rule $rule) private function setPropagateLearn($level, $literal, Rule $rule): int
{ {
$level++; $level++;
@ -351,7 +351,7 @@ class Solver
* @param int[] $decisionQueue * @param int[] $decisionQueue
* @return int * @return int
*/ */
private function selectAndInstall($level, array $decisionQueue, Rule $rule) private function selectAndInstall($level, array $decisionQueue, Rule $rule): int
{ {
// choose best package to install from decisionQueue // choose best package to install from decisionQueue
$literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage()); $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
@ -548,7 +548,7 @@ class Solver
/** /**
* @return int * @return int
*/ */
private function analyzeUnsolvable(Rule $conflictRule) private function analyzeUnsolvable(Rule $conflictRule): int
{ {
$problem = new Problem(); $problem = new Problem();
$problem->addRule($conflictRule); $problem->addRule($conflictRule);

View File

@ -109,7 +109,7 @@ class SolverProblemsException extends \RuntimeException
* @param string[] $missingExtensions * @param string[] $missingExtensions
* @return string * @return string
*/ */
private function createExtensionHint(array $missingExtensions) private function createExtensionHint(array $missingExtensions): string
{ {
$paths = IniHelper::getAll(); $paths = IniHelper::getAll();
@ -133,7 +133,7 @@ class SolverProblemsException extends \RuntimeException
* @param Rule[][] $reasonSets * @param Rule[][] $reasonSets
* @return string[] * @return string[]
*/ */
private function getExtensionProblems(array $reasonSets) private function getExtensionProblems(array $reasonSets): array
{ {
$missingExtensions = array(); $missingExtensions = array();
foreach ($reasonSets as $reasonSet) { foreach ($reasonSets as $reasonSet) {

View File

@ -60,7 +60,7 @@ class Transaction
/** /**
* @return OperationInterface[] * @return OperationInterface[]
*/ */
public function getOperations() public function getOperations(): array
{ {
return $this->operations; return $this->operations;
} }
@ -101,7 +101,7 @@ class Transaction
/** /**
* @return OperationInterface[] * @return OperationInterface[]
*/ */
protected function calculateOperations() protected function calculateOperations(): array
{ {
$operations = array(); $operations = array();
@ -218,7 +218,7 @@ class Transaction
* *
* @return array<string, PackageInterface> * @return array<string, PackageInterface>
*/ */
protected function getRootPackages() protected function getRootPackages(): array
{ {
$roots = $this->resultPackageMap; $roots = $this->resultPackageMap;
@ -244,7 +244,7 @@ class Transaction
/** /**
* @return PackageInterface[] * @return PackageInterface[]
*/ */
protected function getProvidersInResult(Link $link) protected function getProvidersInResult(Link $link): array
{ {
if (!isset($this->resultPackagesByName[$link->getTarget()])) { if (!isset($this->resultPackagesByName[$link->getTarget()])) {
return array(); return array();
@ -266,7 +266,7 @@ class Transaction
* @param OperationInterface[] $operations * @param OperationInterface[] $operations
* @return OperationInterface[] reordered operation list * @return OperationInterface[] reordered operation list
*/ */
private function movePluginsToFront(array $operations) private function movePluginsToFront(array $operations): array
{ {
$dlModifyingPluginsNoDeps = array(); $dlModifyingPluginsNoDeps = array();
$dlModifyingPluginsWithDeps = array(); $dlModifyingPluginsWithDeps = array();
@ -343,7 +343,7 @@ class Transaction
* @param OperationInterface[] $operations * @param OperationInterface[] $operations
* @return OperationInterface[] reordered operation list * @return OperationInterface[] reordered operation list
*/ */
private function moveUninstallsToFront(array $operations) private function moveUninstallsToFront(array $operations): array
{ {
$uninstOps = array(); $uninstOps = array();
foreach ($operations as $idx => $op) { foreach ($operations as $idx => $op) {

View File

@ -406,7 +406,7 @@ class DownloadManager
* @return string[] * @return string[]
* @phpstan-return array<'dist'|'source'>&non-empty-array * @phpstan-return array<'dist'|'source'>&non-empty-array
*/ */
private function getAvailableSources(PackageInterface $package, PackageInterface $prevPackage = null) private function getAvailableSources(PackageInterface $package, PackageInterface $prevPackage = null): array
{ {
$sourceType = $package->getSourceType(); $sourceType = $package->getSourceType();
$distType = $package->getDistType(); $distType = $package->getDistType();
@ -456,7 +456,7 @@ class DownloadManager
* *
* @return string * @return string
*/ */
private function normalizeTargetDir($dir) private function normalizeTargetDir($dir): string
{ {
if ($dir === '\\' || $dir === '/') { if ($dir === '\\' || $dir === '/') {
return $dir; return $dir;

View File

@ -295,7 +295,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
* *
* @return bool * @return bool
*/ */
private function safeJunctions() private function safeJunctions(): bool
{ {
// We need to call mklink, and rmdir on Windows 7 (version 6.1) // We need to call mklink, and rmdir on Windows 7 (version 6.1)
return function_exists('proc_open') && return function_exists('proc_open') &&

View File

@ -57,7 +57,7 @@ class PerforceDownloader extends VcsDownloader
* *
* @return string|null * @return string|null
*/ */
private function getLabelFromSourceReference($ref) private function getLabelFromSourceReference($ref): ?string
{ {
$pos = strpos($ref, '@'); $pos = strpos($ref, '@');
if (false !== $pos) { if (false !== $pos) {
@ -92,7 +92,7 @@ class PerforceDownloader extends VcsDownloader
/** /**
* @return array<string, mixed> * @return array<string, mixed>
*/ */
private function getRepoConfig(VcsRepository $repository) private function getRepoConfig(VcsRepository $repository): array
{ {
return $repository->getRepoConfig(); return $repository->getRepoConfig();
} }

View File

@ -346,7 +346,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
* *
* @return string[] * @return string[]
*/ */
private function prepareUrls(array $urls) private function prepareUrls(array $urls): array
{ {
foreach ($urls as $index => $url) { foreach ($urls as $index => $url) {
if (Filesystem::isLocalPath($url)) { if (Filesystem::isLocalPath($url)) {

View File

@ -105,7 +105,7 @@ class ZipDownloader extends ArchiveDownloader
* @param string $path Path where to extract file * @param string $path Path where to extract file
* @return PromiseInterface * @return PromiseInterface
*/ */
private function extractWithSystemUnzip(PackageInterface $package, $file, $path) private function extractWithSystemUnzip(PackageInterface $package, $file, $path): PromiseInterface
{ {
// Force Exception throwing if the other alternative extraction method is not available // Force Exception throwing if the other alternative extraction method is not available
$isLastChance = !self::$hasZipArchive; $isLastChance = !self::$hasZipArchive;
@ -172,7 +172,7 @@ class ZipDownloader extends ArchiveDownloader
* @param string $path Path where to extract file * @param string $path Path where to extract file
* @return PromiseInterface * @return PromiseInterface
*/ */
private function extractWithZipArchive(PackageInterface $package, $file, $path) private function extractWithZipArchive(PackageInterface $package, $file, $path): PromiseInterface
{ {
$processError = null; $processError = null;
$zipArchive = $this->zipArchiveObject ?: new ZipArchive(); $zipArchive = $this->zipArchiveObject ?: new ZipArchive();

View File

@ -556,7 +556,7 @@ class EventDispatcher
/** /**
* @return void * @return void
*/ */
private function ensureBinDirIsInPath() private function ensureBinDirIsInPath(): void
{ {
$pathEnv = 'PATH'; $pathEnv = 'PATH';
if (false === Platform::getEnv('PATH') && false !== Platform::getEnv('Path')) { if (false === Platform::getEnv('PATH') && false !== Platform::getEnv('Path')) {

View File

@ -696,7 +696,7 @@ class Factory
/** /**
* @return bool * @return bool
*/ */
private static function useXdg() private static function useXdg(): bool
{ {
foreach (array_keys($_SERVER) as $key) { foreach (array_keys($_SERVER) as $key) {
if (strpos($key, 'XDG_') === 0) { if (strpos($key, 'XDG_') === 0) {
@ -715,7 +715,7 @@ class Factory
* @throws \RuntimeException * @throws \RuntimeException
* @return string * @return string
*/ */
private static function getUserDir() private static function getUserDir(): string
{ {
$home = Platform::getEnv('HOME'); $home = Platform::getEnv('HOME');
if (!$home) { if (!$home) {

View File

@ -20,7 +20,7 @@ final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFil
* @param string $req * @param string $req
* @return bool * @return bool
*/ */
public function isIgnored($req) public function isIgnored($req): bool
{ {
return PlatformRepository::isPlatformPackage($req); return PlatformRepository::isPlatformPackage($req);
} }

View File

@ -55,7 +55,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
* @param string $req * @param string $req
* @return bool * @return bool
*/ */
public function isIgnored($req) public function isIgnored($req): bool
{ {
if (!PlatformRepository::isPlatformPackage($req)) { if (!PlatformRepository::isPlatformPackage($req)) {
return false; return false;
@ -68,7 +68,7 @@ final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFi
* @param string $req * @param string $req
* @return ConstraintInterface * @return ConstraintInterface
*/ */
public function filterConstraint($req, ConstraintInterface $constraint) public function filterConstraint($req, ConstraintInterface $constraint): ConstraintInterface
{ {
if (!PlatformRepository::isPlatformPackage($req)) { if (!PlatformRepository::isPlatformPackage($req)) {
return $constraint; return $constraint;

View File

@ -18,7 +18,7 @@ final class IgnoreNothingPlatformRequirementFilter implements PlatformRequiremen
* @param string $req * @param string $req
* @return false * @return false
*/ */
public function isIgnored($req) public function isIgnored($req): bool
{ {
return false; return false;
} }

View File

@ -19,7 +19,7 @@ final class PlatformRequirementFilterFactory
* *
* @return PlatformRequirementFilterInterface * @return PlatformRequirementFilterInterface
*/ */
public static function fromBoolOrList($boolOrList) public static function fromBoolOrList($boolOrList): PlatformRequirementFilterInterface
{ {
if (is_bool($boolOrList)) { if (is_bool($boolOrList)) {
return $boolOrList ? self::ignoreAll() : self::ignoreNothing(); return $boolOrList ? self::ignoreAll() : self::ignoreNothing();
@ -40,7 +40,7 @@ final class PlatformRequirementFilterFactory
/** /**
* @return PlatformRequirementFilterInterface * @return PlatformRequirementFilterInterface
*/ */
public static function ignoreAll() public static function ignoreAll(): PlatformRequirementFilterInterface
{ {
return new IgnoreAllPlatformRequirementFilter(); return new IgnoreAllPlatformRequirementFilter();
} }
@ -48,7 +48,7 @@ final class PlatformRequirementFilterFactory
/** /**
* @return PlatformRequirementFilterInterface * @return PlatformRequirementFilterInterface
*/ */
public static function ignoreNothing() public static function ignoreNothing(): PlatformRequirementFilterInterface
{ {
return new IgnoreNothingPlatformRequirementFilter(); return new IgnoreNothingPlatformRequirementFilter();
} }

View File

@ -157,7 +157,7 @@ class ConsoleIO extends BaseIO
* *
* @return void * @return void
*/ */
private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false) private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false): void
{ {
$sfVerbosity = $this->verbosityMap[$verbosity]; $sfVerbosity = $this->verbosityMap[$verbosity];
if ($sfVerbosity > $this->output->getVerbosity()) { if ($sfVerbosity > $this->output->getVerbosity()) {
@ -216,7 +216,7 @@ class ConsoleIO extends BaseIO
* *
* @return void * @return void
*/ */
private function doOverwrite($messages, $newline, $size, $stderr, $verbosity) private function doOverwrite($messages, $newline, $size, $stderr, $verbosity): void
{ {
// messages can be an array, let's convert it to string anyway // messages can be an array, let's convert it to string anyway
$messages = implode($newline ? "\n" : '', (array) $messages); $messages = implode($newline ? "\n" : '', (array) $messages);
@ -345,7 +345,7 @@ class ConsoleIO extends BaseIO
/** /**
* @return OutputInterface * @return OutputInterface
*/ */
private function getErrorOutput() private function getErrorOutput(): OutputInterface
{ {
if ($this->output instanceof ConsoleOutputInterface) { if ($this->output instanceof ConsoleOutputInterface) {
return $this->output->getErrorOutput(); return $this->output->getErrorOutput();

View File

@ -789,7 +789,7 @@ class Installer
* *
* @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases * @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases
*/ */
private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null) private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null): RepositorySet
{ {
if ($forUpdate) { if ($forUpdate) {
$minimumStability = $this->package->getMinimumStability(); $minimumStability = $this->package->getMinimumStability();
@ -858,7 +858,7 @@ class Installer
* *
* @return DefaultPolicy * @return DefaultPolicy
*/ */
private function createPolicy($forUpdate) private function createPolicy($forUpdate): DefaultPolicy
{ {
$preferStable = null; $preferStable = null;
$preferLowest = null; $preferLowest = null;
@ -882,7 +882,7 @@ class Installer
* @param RootPackageInterface&BasePackage $rootPackage * @param RootPackageInterface&BasePackage $rootPackage
* @return Request * @return Request
*/ */
private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, LockArrayRepository $lockedRepository = null) private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, LockArrayRepository $lockedRepository = null): Request
{ {
$request = new Request($lockedRepository); $request = new Request($lockedRepository);
@ -953,7 +953,7 @@ class Installer
* *
* @phpstan-return list<array{package: string, version: string, alias: string, alias_normalized: string}> * @phpstan-return list<array{package: string, version: string, alias: string, alias_normalized: string}>
*/ */
private function getRootAliases($forUpdate) private function getRootAliases($forUpdate): array
{ {
if ($forUpdate) { if ($forUpdate) {
$aliases = $this->package->getAliases(); $aliases = $this->package->getAliases();
@ -969,7 +969,7 @@ class Installer
* *
* @return array<string, string> * @return array<string, string>
*/ */
private function extractPlatformRequirements(array $links) private function extractPlatformRequirements(array $links): array
{ {
$platformReqs = array(); $platformReqs = array();
foreach ($links as $link) { foreach ($links as $link) {
@ -1009,7 +1009,7 @@ class Installer
/** /**
* @return PoolOptimizer|null * @return PoolOptimizer|null
*/ */
private function createPoolOptimizer(PolicyInterface $policy) private function createPoolOptimizer(PolicyInterface $policy): ?PoolOptimizer
{ {
// Not the best architectural decision here, would need to be able // Not the best architectural decision here, would need to be able
// to configure from the outside of Installer but this is only // to configure from the outside of Installer but this is only

View File

@ -316,7 +316,7 @@ class InstallationManager
* *
* @return void * @return void
*/ */
private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, $devMode, $runScripts, array $allOperations) private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, $devMode, $runScripts, array $allOperations): void
{ {
$promises = array(); $promises = array();
@ -400,7 +400,7 @@ class InstallationManager
* *
* @return void * @return void
*/ */
private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts, array $allOperations) private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts, array $allOperations): void
{ {
$promises = array(); $promises = array();
$postExecCallbacks = array(); $postExecCallbacks = array();
@ -481,7 +481,7 @@ class InstallationManager
* *
* @return void * @return void
*/ */
private function waitOnPromises(array $promises) private function waitOnPromises(array $promises): void
{ {
$progress = null; $progress = null;
if ( if (
@ -700,7 +700,7 @@ class InstallationManager
/** /**
* @return void * @return void
*/ */
private function markForNotification(PackageInterface $package) private function markForNotification(PackageInterface $package): void
{ {
if ($package->getNotificationUrl()) { if ($package->getNotificationUrl()) {
$this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package; $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;

View File

@ -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 * @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[] * @return mixed[]
*/ */
private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null) private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): array
{ {
$suggestedPackages = $this->getPackages(); $suggestedPackages = $this->getPackages();
$installedNames = array(); $installedNames = array();
@ -220,7 +220,7 @@ class SuggestedPackagesReporter
* @param string $string * @param string $string
* @return string * @return string
*/ */
private function escapeOutput($string) private function escapeOutput($string): string
{ {
return OutputFormatter::escape( return OutputFormatter::escape(
$this->removeControlCharacters($string) $this->removeControlCharacters($string)
@ -231,7 +231,7 @@ class SuggestedPackagesReporter
* @param string $string * @param string $string
* @return string * @return string
*/ */
private function removeControlCharacters($string) private function removeControlCharacters($string): string
{ {
return Preg::replace( return Preg::replace(
'/[[:cntrl:]]/', '/[[:cntrl:]]/',

View File

@ -256,7 +256,7 @@ class JsonFile
* @throws \RuntimeException * @throws \RuntimeException
* @return void * @return void
*/ */
private static function throwEncodeError($code) private static function throwEncodeError($code): void
{ {
switch ($code) { switch ($code) {
case JSON_ERROR_DEPTH: case JSON_ERROR_DEPTH:

View File

@ -133,7 +133,7 @@ class JsonManipulator
* @param array<string> $packages * @param array<string> $packages
* @return void * @return void
*/ */
private function sortPackages(array &$packages = array()) private function sortPackages(array &$packages = array()): void
{ {
$prefix = function ($requirement) { $prefix = function ($requirement) {
if (PlatformRepository::isPlatformPackage($requirement)) { if (PlatformRepository::isPlatformPackage($requirement)) {

View File

@ -86,7 +86,7 @@ class ZipArchiver implements ArchiverInterface
/** /**
* @return bool * @return bool
*/ */
private function compressionAvailable() private function compressionAvailable(): bool
{ {
return class_exists('ZipArchive'); return class_exists('ZipArchive');
} }

View File

@ -148,7 +148,7 @@ class ArrayDumper
* *
* @return array<string, mixed> * @return array<string, mixed>
*/ */
private function dumpValues(PackageInterface $package, array $keys, array $data) private function dumpValues(PackageInterface $package, array $keys, array $data): array
{ {
foreach ($keys as $method => $key) { foreach ($keys as $method => $key) {
if (is_numeric($method)) { if (is_numeric($method)) {

View File

@ -321,7 +321,7 @@ class ArrayLoader implements LoaderInterface
* *
* @return void * @return void
*/ */
private function configureCachedLinks(&$linkCache, $package, array $config) private function configureCachedLinks(&$linkCache, $package, array $config): void
{ {
$name = $package->getName(); $name = $package->getName();
$prettyVersion = $package->getPrettyVersion(); $prettyVersion = $package->getPrettyVersion();
@ -385,7 +385,7 @@ class ArrayLoader implements LoaderInterface
* @param string $prettyConstraint constraint string * @param string $prettyConstraint constraint string
* @return Link * @return Link
*/ */
private function createLink($source, $sourceVersion, $description, $target, $prettyConstraint) private function createLink($source, $sourceVersion, $description, $target, $prettyConstraint): Link
{ {
if (!\is_string($prettyConstraint)) { if (!\is_string($prettyConstraint)) {
throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')'); throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');

View File

@ -194,7 +194,7 @@ class RootPackageLoader extends ArrayLoader
* *
* @return list<array{package: string, version: string, alias: string, alias_normalized: string}> * @return list<array{package: string, version: string, alias: string, alias_normalized: string}>
*/ */
private function extractAliases(array $requires, array $aliases) private function extractAliases(array $requires, array $aliases): array
{ {
foreach ($requires as $reqName => $reqVersion) { foreach ($requires as $reqName => $reqVersion) {
if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) { if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
@ -224,7 +224,7 @@ class RootPackageLoader extends ArrayLoader
* @phpstan-param array<string, BasePackage::STABILITY_*> $stabilityFlags * @phpstan-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @phpstan-return array<string, BasePackage::STABILITY_*> * @phpstan-return array<string, BasePackage::STABILITY_*>
*/ */
public static function extractStabilityFlags(array $requires, $minimumStability, array $stabilityFlags) public static function extractStabilityFlags(array $requires, $minimumStability, array $stabilityFlags): array
{ {
$stabilities = BasePackage::$stabilities; $stabilities = BasePackage::$stabilities;
/** @var int $minimumStability */ /** @var int $minimumStability */
@ -286,7 +286,7 @@ class RootPackageLoader extends ArrayLoader
* *
* @return array<string, string> * @return array<string, string>
*/ */
public static function extractReferences(array $requires, array $references) public static function extractReferences(array $requires, array $references): array
{ {
foreach ($requires as $reqName => $reqVersion) { foreach ($requires as $reqName => $reqVersion) {
$reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion); $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);

View File

@ -494,7 +494,7 @@ class ValidatingArrayLoader implements LoaderInterface
* @phpstan-param non-empty-string $property * @phpstan-param non-empty-string $property
* @phpstan-param non-empty-string $regex * @phpstan-param non-empty-string $regex
*/ */
private function validateRegex($property, $regex, $mandatory = false) private function validateRegex($property, $regex, $mandatory = false): bool
{ {
if (!$this->validateString($property, $mandatory)) { if (!$this->validateString($property, $mandatory)) {
return false; return false;
@ -523,7 +523,7 @@ class ValidatingArrayLoader implements LoaderInterface
* *
* @phpstan-param non-empty-string $property * @phpstan-param non-empty-string $property
*/ */
private function validateString($property, $mandatory = false) private function validateString($property, $mandatory = false): bool
{ {
if (isset($this->config[$property]) && !is_string($this->config[$property])) { if (isset($this->config[$property]) && !is_string($this->config[$property])) {
$this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given'; $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
@ -552,7 +552,7 @@ class ValidatingArrayLoader implements LoaderInterface
* *
* @phpstan-param non-empty-string $property * @phpstan-param non-empty-string $property
*/ */
private function validateArray($property, $mandatory = false) private function validateArray($property, $mandatory = false): bool
{ {
if (isset($this->config[$property]) && !is_array($this->config[$property])) { if (isset($this->config[$property]) && !is_array($this->config[$property])) {
$this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given'; $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
@ -583,7 +583,7 @@ class ValidatingArrayLoader implements LoaderInterface
* @phpstan-param non-empty-string $property * @phpstan-param non-empty-string $property
* @phpstan-param non-empty-string|null $regex * @phpstan-param non-empty-string|null $regex
*/ */
private function validateFlatArray($property, $regex = null, $mandatory = false) private function validateFlatArray($property, $regex = null, $mandatory = false): bool
{ {
if (!$this->validateArray($property, $mandatory)) { if (!$this->validateArray($property, $mandatory)) {
return false; return false;
@ -617,7 +617,7 @@ class ValidatingArrayLoader implements LoaderInterface
* *
* @phpstan-param non-empty-string $property * @phpstan-param non-empty-string $property
*/ */
private function validateUrl($property, $mandatory = false) private function validateUrl($property, $mandatory = false): bool
{ {
if (!$this->validateString($property, $mandatory)) { if (!$this->validateString($property, $mandatory)) {
return false; return false;
@ -639,7 +639,7 @@ class ValidatingArrayLoader implements LoaderInterface
* *
* @return bool * @return bool
*/ */
private function filterUrl($value, array $schemes = array('http', 'https')) private function filterUrl($value, array $schemes = array('http', 'https')): bool
{ {
if ($value === '') { if ($value === '') {
return true; return true;

View File

@ -419,7 +419,7 @@ class Locker
* *
* @phpstan-return list<array<string, mixed>> * @phpstan-return list<array<string, mixed>>
*/ */
private function lockPackages(array $packages) private function lockPackages(array $packages): array
{ {
$locked = array(); $locked = array();
@ -477,7 +477,7 @@ class Locker
* @param PackageInterface $package The package to scan. * @param PackageInterface $package The package to scan.
* @return string|null The formatted datetime or null if none was found. * @return string|null The formatted datetime or null if none was found.
*/ */
private function getPackageTime(PackageInterface $package) private function getPackageTime(PackageInterface $package): ?string
{ {
if (!function_exists('proc_open')) { if (!function_exists('proc_open')) {
return null; return null;

View File

@ -788,7 +788,7 @@ class Package extends BasePackage
* @param string $source * @param string $source
* @return array<string, Link> * @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.'); 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.');
$newLinks = array(); $newLinks = array();

View File

@ -103,7 +103,7 @@ class VersionGuesser
* @return array * @return array
* @phpstan-return Version * @phpstan-return Version
*/ */
private function postprocess(array $versionData) private function postprocess(array $versionData): array
{ {
if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) { if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {
unset($versionData['feature_version'], $versionData['feature_pretty_version']); unset($versionData['feature_version'], $versionData['feature_pretty_version']);
@ -126,7 +126,7 @@ class VersionGuesser
* *
* @return array{version: string|null, commit: string|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null} * @return array{version: string|null, commit: string|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null}
*/ */
private function guessGitVersion(array $packageConfig, $path) private function guessGitVersion(array $packageConfig, $path): array
{ {
GitUtil::cleanEnv(); GitUtil::cleanEnv();
$commit = null; $commit = null;
@ -211,7 +211,7 @@ class VersionGuesser
* *
* @return array{version: string, pretty_version: string}|null * @return array{version: string, pretty_version: string}|null
*/ */
private function versionFromGitTags($path) private function versionFromGitTags($path): ?array
{ {
// try to fetch current version from git tags // try to fetch current version from git tags
if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) { if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
@ -232,7 +232,7 @@ class VersionGuesser
* *
* @return array{version: string|null, commit: ''|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null}|null * @return array{version: string|null, commit: ''|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null}|null
*/ */
private function guessHgVersion(array $packageConfig, $path) private function guessHgVersion(array $packageConfig, $path): ?array
{ {
// try to fetch current version from hg branch // try to fetch current version from hg branch
if (0 === $this->process->execute('hg branch', $output, $path)) { if (0 === $this->process->execute('hg branch', $output, $path)) {
@ -276,7 +276,7 @@ class VersionGuesser
* *
* @return array{version: string|null, pretty_version: string|null} * @return array{version: string|null, pretty_version: string|null}
*/ */
private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path) private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path): array
{ {
$prettyVersion = $version; $prettyVersion = $version;
@ -340,7 +340,7 @@ class VersionGuesser
* *
* @return bool * @return bool
*/ */
private function isFeatureBranch(array $packageConfig, $branchName) private function isFeatureBranch(array $packageConfig, $branchName): bool
{ {
$nonFeatureBranches = ''; $nonFeatureBranches = '';
if (!empty($packageConfig['non-feature-branches'])) { if (!empty($packageConfig['non-feature-branches'])) {
@ -355,7 +355,7 @@ class VersionGuesser
* *
* @return array{version: string|null, commit: '', pretty_version: string|null} * @return array{version: string|null, commit: '', pretty_version: string|null}
*/ */
private function guessFossilVersion($path) private function guessFossilVersion($path): array
{ {
$version = null; $version = null;
$prettyVersion = null; $prettyVersion = null;
@ -385,7 +385,7 @@ class VersionGuesser
* *
* @return array{version: string, commit: '', pretty_version: string}|null * @return array{version: string, commit: '', pretty_version: string}|null
*/ */
private function guessSvnVersion(array $packageConfig, $path) private function guessSvnVersion(array $packageConfig, $path): ?array
{ {
SvnUtil::cleanEnv(); SvnUtil::cleanEnv();

View File

@ -211,7 +211,7 @@ class VersionSelector
* *
* @return string * @return string
*/ */
private function transformVersion($version, $prettyVersion, $stability) private function transformVersion($version, $prettyVersion, $stability): string
{ {
// attempt to transform 2.1.1 to 2.1 // attempt to transform 2.1.1 to 2.1
// this allows you to upgrade through minor versions // this allows you to upgrade through minor versions
@ -242,7 +242,7 @@ class VersionSelector
/** /**
* @return VersionParser * @return VersionParser
*/ */
private function getParser() private function getParser(): VersionParser
{ {
if ($this->parser === null) { if ($this->parser === null) {
$this->parser = new VersionParser(); $this->parser = new VersionParser();

View File

@ -71,7 +71,7 @@ class Version
* @param string $alpha * @param string $alpha
* @return int * @return int
*/ */
private static function convertAlphaVersionToIntVersion($alpha) private static function convertAlphaVersionToIntVersion($alpha): int
{ {
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)));
} }
@ -100,7 +100,7 @@ class Version
* *
* @return string * @return string
*/ */
private static function convertVersionId($versionId, $base) private static function convertVersionId($versionId, $base): string
{ {
return sprintf( return sprintf(
'%d.%d.%d', '%d.%d.%d',

View File

@ -530,7 +530,7 @@ class PluginManager
* *
* @return array<string, PackageInterface> Map of package names to packages * @return array<string, PackageInterface> Map of package names to packages
*/ */
private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package) private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package): array
{ {
foreach ($package->getRequires() as $requireLink) { foreach ($package->getRequires() as $requireLink) {
foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) { foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) {
@ -552,7 +552,7 @@ class PluginManager
* *
* @return string Install path * @return string Install path
*/ */
private function getInstallPath(PackageInterface $package, $global = false) private function getInstallPath(PackageInterface $package, $global = false): string
{ {
if (!$global) { if (!$global) {
return $this->composer->getInstallationManager()->getInstallPath($package); return $this->composer->getInstallationManager()->getInstallPath($package);
@ -647,7 +647,7 @@ class PluginManager
* @param array<string, bool>|bool|null $allowPluginsConfig * @param array<string, bool>|bool|null $allowPluginsConfig
* @return array<non-empty-string, bool>|null * @return array<non-empty-string, bool>|null
*/ */
private function parseAllowedPlugins($allowPluginsConfig) private function parseAllowedPlugins($allowPluginsConfig): ?array
{ {
if (null === $allowPluginsConfig) { if (null === $allowPluginsConfig) {
return null; return null;
@ -674,7 +674,7 @@ class PluginManager
* @param bool $isGlobalPlugin * @param bool $isGlobalPlugin
* @return bool * @return bool
*/ */
private function isPluginAllowed($package, $isGlobalPlugin) private function isPluginAllowed($package, $isGlobalPlugin): bool
{ {
static $warned = array(); static $warned = array();
$rules = $isGlobalPlugin ? $this->allowGlobalPluginRules : $this->allowPluginRules; $rules = $isGlobalPlugin ? $this->allowGlobalPluginRules : $this->allowPluginRules;

View File

@ -53,7 +53,7 @@ class StrictConfirmationQuestion extends Question
* *
* @return callable * @return callable
*/ */
private function getDefaultNormalizer() private function getDefaultNormalizer(): callable
{ {
$default = $this->getDefault(); $default = $this->getDefault();
$trueRegex = $this->trueAnswerRegex; $trueRegex = $this->trueAnswerRegex;
@ -84,7 +84,7 @@ class StrictConfirmationQuestion extends Question
* *
* @return callable * @return callable
*/ */
private function getDefaultValidator() private function getDefaultValidator(): callable
{ {
return function ($answer) { return function ($answer) {
if (!is_bool($answer)) { if (!is_bool($answer)) {

View File

@ -73,7 +73,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return void * @return void
*/ */
private function scanDirectory($path) private function scanDirectory($path): void
{ {
$io = $this->io; $io = $this->io;
@ -102,7 +102,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return ?BasePackage * @return ?BasePackage
*/ */
private function getComposerInformation(\SplFileInfo $file) private function getComposerInformation(\SplFileInfo $file): ?BasePackage
{ {
$json = null; $json = null;
$fileType = null; $fileType = null;

View File

@ -39,6 +39,7 @@ use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
use Composer\MetadataMinifier\MetadataMinifier; use Composer\MetadataMinifier\MetadataMinifier;
use Composer\Util\Url; use Composer\Util\Url;
use React\Promise\PromiseInterface;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>
@ -399,7 +400,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return list<string> * @return list<string>
*/ */
private function getVendorNames() private function getVendorNames(): array
{ {
$cacheKey = 'vendor-list.txt'; $cacheKey = 'vendor-list.txt';
$cacheAge = $this->cache->getAge($cacheKey); $cacheAge = $this->cache->getAge($cacheKey);
@ -430,7 +431,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* @param string|null $packageFilter * @param string|null $packageFilter
* @return list<string> * @return list<string>
*/ */
private function loadPackageList($packageFilter = null) private function loadPackageList($packageFilter = null): array
{ {
if (null === $this->listUrl) { if (null === $this->listUrl) {
throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList'); throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList');
@ -640,7 +641,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return string[] * @return string[]
*/ */
private function getProviderNames() private function getProviderNames(): array
{ {
$this->loadRootServerFile(); $this->loadRootServerFile();
@ -677,7 +678,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return bool * @return bool
*/ */
private function hasProviders() private function hasProviders(): bool
{ {
$this->loadRootServerFile(); $this->loadRootServerFile();
@ -694,7 +695,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return array<string, BasePackage> * @return array<string, BasePackage>
*/ */
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()): array
{ {
$packagesSource = null; $packagesSource = null;
if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) { if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) {
@ -862,7 +863,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return array{namesFound: array<string, true>, packages: array<string, BasePackage>} * @return array{namesFound: array<string, true>, packages: array<string, BasePackage>}
*/ */
private function loadAsyncPackages(array $packageNames, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array()) private function loadAsyncPackages(array $packageNames, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array()): array
{ {
$this->loadRootServerFile(); $this->loadRootServerFile();
@ -972,7 +973,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return bool * @return bool
*/ */
private function isVersionAcceptable($constraint, $name, $versionData, array $acceptableStabilities = null, array $stabilityFlags = null) private function isVersionAcceptable($constraint, $name, $versionData, array $acceptableStabilities = null, array $stabilityFlags = null): bool
{ {
$versions = array($versionData['version_normalized']); $versions = array($versionData['version_normalized']);
@ -998,7 +999,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return string * @return string
*/ */
private function getPackagesJsonUrl() private function getPackagesJsonUrl(): string
{ {
$jsonUrlParts = parse_url($this->url); $jsonUrlParts = parse_url($this->url);
@ -1135,7 +1136,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return string * @return string
*/ */
private function canonicalizeUrl($url) private function canonicalizeUrl($url): string
{ {
if ('/' === $url[0]) { if ('/' === $url[0]) {
if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) { if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
@ -1151,7 +1152,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return mixed[] * @return mixed[]
*/ */
private function loadDataFromServer() private function loadDataFromServer(): array
{ {
$data = $this->loadRootServerFile(); $data = $this->loadRootServerFile();
@ -1161,7 +1162,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/** /**
* @return bool * @return bool
*/ */
private function hasPartialPackages() private function hasPartialPackages(): bool
{ {
if ($this->hasPartialPackages && null === $this->partialPackagesByName) { if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
$this->initializePartialPackages(); $this->initializePartialPackages();
@ -1175,7 +1176,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return void * @return void
*/ */
private function loadProviderListings($data) private function loadProviderListings($data): void
{ {
if (isset($data['providers'])) { if (isset($data['providers'])) {
if (!is_array($this->providerListing)) { if (!is_array($this->providerListing)) {
@ -1205,7 +1206,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return mixed[] * @return mixed[]
*/ */
private function loadIncludes($data) private function loadIncludes($data): array
{ {
$packages = array(); $packages = array();
@ -1250,7 +1251,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return list<CompletePackage|CompleteAliasPackage> * @return list<CompletePackage|CompleteAliasPackage>
*/ */
private function createPackages(array $packages, $source = null) private function createPackages(array $packages, $source = null): array
{ {
if (!$packages) { if (!$packages) {
return array(); return array();
@ -1457,10 +1458,8 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* @param string $filename * @param string $filename
* @param string $cacheKey * @param string $cacheKey
* @param string|null $lastModifiedTime * @param string|null $lastModifiedTime
*
* @return \React\Promise\PromiseInterface
*/ */
private function asyncFetchFile($filename, $cacheKey, $lastModifiedTime = null) private function asyncFetchFile($filename, $cacheKey, $lastModifiedTime = null): PromiseInterface
{ {
if (isset($this->packagesNotFoundCache[$filename])) { if (isset($this->packagesNotFoundCache[$filename])) {
return \React\Promise\resolve(array('packages' => array())); return \React\Promise\resolve(array('packages' => array()));
@ -1566,7 +1565,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
* *
* @return void * @return void
*/ */
private function initializePartialPackages() private function initializePartialPackages(): void
{ {
$rootData = $this->loadRootServerFile(); $rootData = $this->loadRootServerFile();

View File

@ -173,7 +173,7 @@ class FilesystemRepository extends WritableArrayRepository
* *
* @return string * @return string
*/ */
private function dumpToPhpCode(array $array = array(), $level = 0) private function dumpToPhpCode(array $array = array(), $level = 0): string
{ {
$lines = "array(\n"; $lines = "array(\n";
$level++; $level++;
@ -211,7 +211,7 @@ class FilesystemRepository extends WritableArrayRepository
* *
* @return ?array<mixed> * @return ?array<mixed>
*/ */
private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, $devMode, $repoDir) private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, $devMode, $repoDir): ?array
{ {
if (!$this->dumpVersions) { if (!$this->dumpVersions) {
return null; return null;

View File

@ -195,7 +195,7 @@ class FilterRepository implements RepositoryInterface
* *
* @return bool * @return bool
*/ */
private function isAllowed($name) private function isAllowed($name): bool
{ {
if (!$this->only && !$this->exclude) { if (!$this->only && !$this->exclude) {
return true; return true;

View File

@ -240,7 +240,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
* *
* @return string[] * @return string[]
*/ */
private function getUrlMatches() private function getUrlMatches(): array
{ {
$flags = GLOB_MARK | GLOB_ONLYDIR; $flags = GLOB_MARK | GLOB_ONLYDIR;

View File

@ -586,7 +586,7 @@ class PlatformRepository extends ArrayRepository
* *
* @return CompletePackage * @return CompletePackage
*/ */
private function addOverriddenPackage(array $override, $name = null) private function addOverriddenPackage(array $override, $name = null): CompletePackage
{ {
$version = $this->versionParser->normalize($override['version']); $version = $this->versionParser->normalize($override['version']);
$package = new CompletePackage($name ?: $override['name'], $version, $override['version']); $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
@ -653,7 +653,7 @@ class PlatformRepository extends ArrayRepository
* @param string $name * @param string $name
* @return string * @return string
*/ */
private function buildPackageName($name) private function buildPackageName($name): string
{ {
return 'ext-' . str_replace(' ', '-', strtolower($name)); return 'ext-' . str_replace(' ', '-', strtolower($name));
} }
@ -725,7 +725,7 @@ class PlatformRepository extends ArrayRepository
* @internal * @internal
* @return string|null * @return string|null
*/ */
public static function getPlatformPhpVersion() public static function getPlatformPhpVersion(): ?string
{ {
return self::$lastSeenPlatformPhp; return self::$lastSeenPlatformPhp;
} }

View File

@ -145,7 +145,7 @@ class RepositoryFactory
* *
* @return RepositoryInterface[] * @return RepositoryInterface[]
*/ */
private static function createRepos(RepositoryManager $rm, array $repoConfigs) private static function createRepos(RepositoryManager $rm, array $repoConfigs): array
{ {
$repos = array(); $repos = array();

View File

@ -336,7 +336,7 @@ class RepositorySet
* *
* @return array<string, array<string, array{alias: string, alias_normalized: string}>> * @return array<string, array<string, array{alias: string, alias_normalized: string}>>
*/ */
private static function getRootAliasesPerPackage(array $aliases) private static function getRootAliasesPerPackage(array $aliases): array
{ {
$normalizedAliases = array(); $normalizedAliases = array();

View File

@ -333,7 +333,7 @@ class GitLabDriver extends VcsDriver
* @param string $string * @param string $string
* @return string * @return string
*/ */
private function urlEncodeAll($string) private function urlEncodeAll($string): string
{ {
$encoded = ''; $encoded = '';
for ($i = 0; isset($string[$i]); $i++) { for ($i = 0; isset($string[$i]); $i++) {

View File

@ -55,7 +55,7 @@ class PerforceDriver extends VcsDriver
* *
* @return void * @return void
*/ */
private function initPerforce($repoConfig) private function initPerforce($repoConfig): void
{ {
if (!empty($this->perforce)) { if (!empty($this->perforce)) {
return; return;

View File

@ -542,7 +542,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
/** /**
* @return bool * @return bool
*/ */
private function shouldRethrowTransportException(TransportException $e) private function shouldRethrowTransportException(TransportException $e): bool
{ {
return in_array($e->getCode(), array(401, 403, 429), true) || $e->getCode() >= 500; return in_array($e->getCode(), array(401, 403, 429), true) || $e->getCode() >= 500;
} }

View File

@ -121,7 +121,7 @@ class Event extends BaseEvent
* @param BaseEvent $event * @param BaseEvent $event
* @return BaseEvent * @return BaseEvent
*/ */
private function calculateOriginatingEvent(BaseEvent $event) private function calculateOriginatingEvent(BaseEvent $event): BaseEvent
{ {
if ($event instanceof Event && $event->getOriginatingEvent()) { if ($event instanceof Event && $event->getOriginatingEvent()) {
return $this->calculateOriginatingEvent($event->getOriginatingEvent()); return $this->calculateOriginatingEvent($event->getOriginatingEvent());

View File

@ -95,7 +95,7 @@ class Versions
/** /**
* @return array<string, array<int, array{path: string, version: string, min-php: int}>> * @return array<string, array<int, array{path: string, version: string, min-php: int}>>
*/ */
private function getVersionsData() private function getVersionsData(): array
{ {
if (!$this->versionsData) { if (!$this->versionsData) {
if ($this->config->get('disable-tls') === true) { if ($this->config->get('disable-tls') === true) {

View File

@ -92,7 +92,7 @@ class Bitbucket
/** /**
* @return bool * @return bool
*/ */
private function requestAccessToken() private function requestAccessToken(): bool
{ {
try { try {
$response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, array( $response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, array(
@ -246,7 +246,7 @@ class Bitbucket
* @param string $originUrl * @param string $originUrl
* @return bool * @return bool
*/ */
private function getTokenFromConfig($originUrl) private function getTokenFromConfig($originUrl): bool
{ {
$authConfig = $this->config->get('bitbucket-oauth'); $authConfig = $this->config->get('bitbucket-oauth');

View File

@ -177,7 +177,7 @@ class Filesystem
* *
* @return bool|null Returns null, when no edge case was hit. Otherwise a bool whether removal was successful * @return bool|null Returns null, when no edge case was hit. Otherwise a bool whether removal was successful
*/ */
private function removeEdgeCases($directory, $fallbackToPhp = true) private function removeEdgeCases($directory, $fallbackToPhp = true): ?bool
{ {
if ($this->isSymlinkedDirectory($directory)) { if ($this->isSymlinkedDirectory($directory)) {
return $this->unlinkSymlinkedDirectory($directory); return $this->unlinkSymlinkedDirectory($directory);
@ -711,7 +711,7 @@ class Filesystem
* *
* @return bool * @return bool
*/ */
private function unlinkImplementation($path) private function unlinkImplementation($path): bool
{ {
if (Platform::isWindows() && is_dir($path) && is_link($path)) { if (Platform::isWindows() && is_dir($path) && is_link($path)) {
return rmdir($path); return rmdir($path);
@ -767,7 +767,7 @@ class Filesystem
* *
* @return bool * @return bool
*/ */
private function unlinkSymlinkedDirectory($directory) private function unlinkSymlinkedDirectory($directory): bool
{ {
$resolved = $this->resolveSymlinkedDirectorySymlink($directory); $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
@ -781,7 +781,7 @@ class Filesystem
* *
* @return string resolved path to symbolic link or original pathname (unresolved) * @return string resolved path to symbolic link or original pathname (unresolved)
*/ */
private function resolveSymlinkedDirectorySymlink($pathname) private function resolveSymlinkedDirectorySymlink($pathname): string
{ {
if (!is_dir($pathname)) { if (!is_dir($pathname)) {
return $pathname; return $pathname;
@ -926,7 +926,7 @@ class Filesystem
* *
* @return bool * @return bool
*/ */
private function filesAreEqual($a, $b) private function filesAreEqual($a, $b): bool
{ {
// Check if filesize is different // Check if filesize is different
if (filesize($a) !== filesize($b)) { if (filesize($a) !== filesize($b)) {

View File

@ -349,7 +349,7 @@ class Git
* *
* @return bool * @return bool
*/ */
private function checkRefIsInMirror($dir, $ref) private function checkRefIsInMirror($dir, $ref): bool
{ {
if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') { if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
$escapedRef = ProcessExecutor::escape($ref.'^{commit}'); $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
@ -368,7 +368,7 @@ class Git
* *
* @return bool * @return bool
*/ */
private function isAuthenticationFailure($url, &$match) private function isAuthenticationFailure($url, &$match): bool
{ {
if (!Preg::isMatch('{^(https?://)([^/]+)(.*)$}i', $url, $match)) { if (!Preg::isMatch('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
return false; return false;
@ -441,7 +441,7 @@ class Git
* *
* @return never * @return never
*/ */
private function throwException($message, $url) private function throwException($message, $url): void
{ {
// git might delete a directory when it fails and php will not know // git might delete a directory when it fails and php will not know
clearstatcache(); clearstatcache();
@ -476,7 +476,7 @@ class Git
* *
* @return string * @return string
*/ */
private function maskCredentials($error, array $credentials) private function maskCredentials($error, array $credentials): string
{ {
$maskedCredentials = array(); $maskedCredentials = array();

View File

@ -169,7 +169,7 @@ class GitLab
* *
* @see https://docs.gitlab.com/ee/api/oauth2.html#resource-owner-password-credentials-flow * @see https://docs.gitlab.com/ee/api/oauth2.html#resource-owner-password-credentials-flow
*/ */
private function createToken($scheme, $originUrl) private function createToken($scheme, $originUrl): array
{ {
$username = $this->io->ask('Username: '); $username = $this->io->ask('Username: ');
$password = $this->io->askAndHideAnswer('Password: '); $password = $this->io->askAndHideAnswer('Password: ');

View File

@ -89,7 +89,7 @@ class Hg
* *
* @return never * @return never
*/ */
private function throwException($message, $url) private function throwException($message, $url): void
{ {
if (null === self::getVersion($this->process)) { 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())); 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()));

View File

@ -133,7 +133,7 @@ class CurlDownloader
* *
* @return int internal job id * @return int internal job id
*/ */
public function download($resolve, $reject, $origin, $url, $options, $copyTo = null) public function download($resolve, $reject, $origin, $url, $options, $copyTo = null): int
{ {
$attributes = array(); $attributes = array();
if (isset($options['retry-auth-failure'])) { if (isset($options['retry-auth-failure'])) {
@ -156,7 +156,7 @@ class CurlDownloader
* *
* @return int internal job id * @return int internal job id
*/ */
private function initDownload($resolve, $reject, $origin, $url, $options, $copyTo = null, array $attributes = array()) private function initDownload($resolve, $reject, $origin, $url, $options, $copyTo = null, array $attributes = array()): int
{ {
// set defaults in a PHPStan-happy way (array_merge is not well supported) // set defaults in a PHPStan-happy way (array_merge is not well supported)
$attributes['retryAuthFailure'] = $attributes['retryAuthFailure'] ?? true; $attributes['retryAuthFailure'] = $attributes['retryAuthFailure'] ?? true;
@ -489,7 +489,7 @@ class CurlDownloader
* @param Job $job * @param Job $job
* @return string * @return string
*/ */
private function handleRedirect(array $job, Response $response) private function handleRedirect(array $job, Response $response): string
{ {
if ($locationHeader = $response->getHeader('location')) { if ($locationHeader = $response->getHeader('location')) {
if (parse_url($locationHeader, PHP_URL_SCHEME)) { if (parse_url($locationHeader, PHP_URL_SCHEME)) {
@ -524,7 +524,7 @@ class CurlDownloader
* @param Job $job * @param Job $job
* @return array{retry: bool, storeAuth: string|bool} * @return array{retry: bool, storeAuth: string|bool}
*/ */
private function isAuthenticatedRetryNeeded(array $job, Response $response) private function isAuthenticatedRetryNeeded(array $job, Response $response): array
{ {
if (in_array($response->getStatusCode(), array(401, 403)) && $job['attributes']['retryAuthFailure']) { if (in_array($response->getStatusCode(), array(401, 403)) && $job['attributes']['retryAuthFailure']) {
$result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders()); $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders());
@ -596,7 +596,7 @@ class CurlDownloader
* @param string $errorMessage * @param string $errorMessage
* @return TransportException * @return TransportException
*/ */
private function failResponse(array $job, Response $response, $errorMessage) private function failResponse(array $job, Response $response, $errorMessage): TransportException
{ {
if (null !== $job['filename']) { if (null !== $job['filename']) {
@unlink($job['filename'].'~'); @unlink($job['filename'].'~');

View File

@ -27,7 +27,7 @@ class ProxyHelper
* *
* @throws \RuntimeException on malformed url * @throws \RuntimeException on malformed url
*/ */
public static function getProxyData() public static function getProxyData(): array
{ {
$httpProxy = null; $httpProxy = null;
$httpsProxy = null; $httpsProxy = null;
@ -64,7 +64,7 @@ class ProxyHelper
* *
* @return array{http: array{proxy: string, header?: string}} * @return array{http: array{proxy: string, header?: string}}
*/ */
public static function getContextOptions($proxyUrl) public static function getContextOptions($proxyUrl): array
{ {
$proxy = parse_url($proxyUrl); $proxy = parse_url($proxyUrl);
@ -114,7 +114,7 @@ class ProxyHelper
* *
* @return string|null The found value * @return string|null The found value
*/ */
private static function getProxyEnv(array $names, &$name) private static function getProxyEnv(array $names, &$name): ?string
{ {
foreach ($names as $name) { foreach ($names as $name) {
if (!empty($_SERVER[$name])) { if (!empty($_SERVER[$name])) {
@ -133,7 +133,7 @@ class ProxyHelper
* @throws \RuntimeException on malformed url * @throws \RuntimeException on malformed url
* @return string The formatted proxy url * @return string The formatted proxy url
*/ */
private static function checkProxy($proxyUrl, $envName) private static function checkProxy($proxyUrl, $envName): string
{ {
$error = sprintf('malformed %s url', $envName); $error = sprintf('malformed %s url', $envName);
$proxy = parse_url($proxyUrl); $proxy = parse_url($proxyUrl);
@ -161,7 +161,7 @@ class ProxyHelper
* *
* @return string The formatted value * @return string The formatted value
*/ */
private static function formatParsedUrl(array $proxy, $includeAuth) private static function formatParsedUrl(array $proxy, $includeAuth): string
{ {
$proxyUrl = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : ''; $proxyUrl = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : '';

View File

@ -58,7 +58,7 @@ class ProxyManager
/** /**
* @return ProxyManager * @return ProxyManager
*/ */
public static function getInstance() public static function getInstance(): ProxyManager
{ {
if (!self::$instance) { if (!self::$instance) {
self::$instance = new self(); self::$instance = new self();
@ -83,7 +83,7 @@ class ProxyManager
* @param string $requestUrl * @param string $requestUrl
* @return RequestProxy * @return RequestProxy
*/ */
public function getProxyForRequest($requestUrl) public function getProxyForRequest($requestUrl): RequestProxy
{ {
if ($this->error) { if ($this->error) {
throw new TransportException('Unable to use a proxy: '.$this->error); throw new TransportException('Unable to use a proxy: '.$this->error);
@ -113,7 +113,7 @@ class ProxyManager
* *
* @return bool If false any error will be in $message * @return bool If false any error will be in $message
*/ */
public function isProxying() public function isProxying(): bool
{ {
return $this->hasProxy; return $this->hasProxy;
} }
@ -123,7 +123,7 @@ class ProxyManager
* *
* @return string|null Safe proxy URL or an error message if setting up proxy failed or null if no proxy was configured * @return string|null Safe proxy URL or an error message if setting up proxy failed or null if no proxy was configured
*/ */
public function getFormattedProxy() public function getFormattedProxy(): ?string
{ {
return $this->hasProxy ? $this->info : $this->error; return $this->hasProxy ? $this->info : $this->error;
} }
@ -167,7 +167,7 @@ class ProxyManager
* *
* @return non-empty-string * @return non-empty-string
*/ */
private function setData($url, $scheme) private function setData($url, $scheme): string
{ {
$safeProxy = Url::sanitize($url); $safeProxy = Url::sanitize($url);
$this->fullProxy[$scheme] = $url; $this->fullProxy[$scheme] = $url;
@ -184,7 +184,7 @@ class ProxyManager
* @param string $requestUrl * @param string $requestUrl
* @return bool * @return bool
*/ */
private function noProxy($requestUrl) private function noProxy($requestUrl): bool
{ {
return $this->noProxyHandler && $this->noProxyHandler->test($requestUrl); return $this->noProxyHandler && $this->noProxyHandler->test($requestUrl);
} }

View File

@ -47,7 +47,7 @@ class RequestProxy
* *
* @return mixed[] * @return mixed[]
*/ */
public function getContextOptions() public function getContextOptions(): array
{ {
return $this->contextOptions; return $this->contextOptions;
} }
@ -58,7 +58,7 @@ class RequestProxy
* @param string|null $format Output format specifier * @param string|null $format Output format specifier
* @return string Safe proxy, no proxy or empty * @return string Safe proxy, no proxy or empty
*/ */
public function getFormattedUrl($format = '') public function getFormattedUrl($format = ''): string
{ {
$result = ''; $result = '';
if ($this->formattedUrl) { if ($this->formattedUrl) {
@ -74,7 +74,7 @@ class RequestProxy
* *
* @return string Proxy url or empty * @return string Proxy url or empty
*/ */
public function getUrl() public function getUrl(): string
{ {
return $this->url; return $this->url;
} }
@ -84,7 +84,7 @@ class RequestProxy
* *
* @return bool False if not secure or there is no proxy * @return bool False if not secure or there is no proxy
*/ */
public function isSecure() public function isSecure(): bool
{ {
return $this->isSecure; return $this->isSecure;
} }

View File

@ -191,7 +191,7 @@ class HttpDownloader
* *
* @return array{Job, PromiseInterface} * @return array{Job, PromiseInterface}
*/ */
private function addJob($request, $sync = false) private function addJob($request, $sync = false): array
{ {
$request['options'] = array_replace_recursive($this->options, $request['options']); $request['options'] = array_replace_recursive($this->options, $request['options']);
@ -291,7 +291,7 @@ class HttpDownloader
* @param int $id * @param int $id
* @return void * @return void
*/ */
private function startJob($id) private function startJob($id): void
{ {
$job = &$this->jobs[$id]; $job = &$this->jobs[$id];
if ($job['status'] !== self::STATUS_QUEUED) { if ($job['status'] !== self::STATUS_QUEUED) {
@ -355,7 +355,7 @@ class HttpDownloader
* *
* @return void * @return void
*/ */
public function enableAsync() public function enableAsync(): void
{ {
$this->allowAsync = true; $this->allowAsync = true;
} }
@ -366,7 +366,7 @@ class HttpDownloader
* @param int|null $index For internal use only, the job id * @param int|null $index For internal use only, the job id
* @return int number of active (queued or started) jobs * @return int number of active (queued or started) jobs
*/ */
public function countActiveJobs($index = null) public function countActiveJobs($index = null): int
{ {
if ($this->runningJobs < $this->maxJobs) { if ($this->runningJobs < $this->maxJobs) {
foreach ($this->jobs as $job) { foreach ($this->jobs as $job) {
@ -400,7 +400,7 @@ class HttpDownloader
* @param int $index Job id * @param int $index Job id
* @return Response * @return Response
*/ */
private function getResponse($index) private function getResponse($index): Response
{ {
if (!isset($this->jobs[$index])) { if (!isset($this->jobs[$index])) {
throw new \LogicException('Invalid request id'); throw new \LogicException('Invalid request id');
@ -428,7 +428,7 @@ class HttpDownloader
* @param array{warning?: string, info?: string, warning-versions?: string, info-versions?: string, warnings?: array<array{versions: string, message: string}>, infos?: array<array{versions: string, message: string}>} $data * @param array{warning?: string, info?: string, warning-versions?: string, info-versions?: string, warnings?: array<array{versions: string, message: string}>, infos?: array<array{versions: string, message: string}>} $data
* @return void * @return void
*/ */
public static function outputWarnings(IOInterface $io, $url, $data) public static function outputWarnings(IOInterface $io, $url, $data): void
{ {
// legacy warning/info keys // legacy warning/info keys
foreach (array('warning', 'info') as $type) { foreach (array('warning', 'info') as $type) {
@ -473,7 +473,7 @@ class HttpDownloader
* *
* @return ?string[] * @return ?string[]
*/ */
public static function getExceptionHints(\Exception $e) public static function getExceptionHints(\Exception $e): ?array
{ {
if (!$e instanceof TransportException) { if (!$e instanceof TransportException) {
return null; return null;
@ -507,7 +507,7 @@ class HttpDownloader
* @param Job $job * @param Job $job
* @return bool * @return bool
*/ */
private function canUseCurl(array $job) private function canUseCurl(array $job): bool
{ {
if (!$this->curl) { if (!$this->curl) {
return false; return false;
@ -528,7 +528,7 @@ class HttpDownloader
* @internal * @internal
* @return bool * @return bool
*/ */
public static function isCurlEnabled() public static function isCurlEnabled(): bool
{ {
return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init'); return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
} }

View File

@ -186,7 +186,7 @@ class NoProxyPattern
* *
* @return null|stdClass Null if the hostname is invalid * @return null|stdClass Null if the hostname is invalid
*/ */
private function getRule($index, $hostName) private function getRule($index, $hostName): ?stdClass
{ {
if (array_key_exists($index, $this->rules)) { if (array_key_exists($index, $this->rules)) {
return $this->rules[$index]; return $this->rules[$index];
@ -213,7 +213,7 @@ class NoProxyPattern
* *
* @return bool False if the host contains invalid data * @return bool False if the host contains invalid data
*/ */
private function ipCheckData($host, &$ipdata, $allowPrefix = false) private function ipCheckData($host, &$ipdata, $allowPrefix = false): bool
{ {
$ipdata = null; $ipdata = null;
$netmask = null; $netmask = null;
@ -262,7 +262,7 @@ class NoProxyPattern
* *
* @return mixed[] in_addr, size * @return mixed[] in_addr, size
*/ */
private function ipGetAddr($host) private function ipGetAddr($host): array
{ {
$ip = inet_pton($host); $ip = inet_pton($host);
$size = strlen($ip); $size = strlen($ip);
@ -279,7 +279,7 @@ class NoProxyPattern
* *
* @return string * @return string
*/ */
private function ipGetMask($prefix, $size) private function ipGetMask($prefix, $size): string
{ {
$mask = ''; $mask = '';
@ -305,7 +305,7 @@ class NoProxyPattern
* *
* @return string[] network in_addr, binary mask * @return string[] network in_addr, binary mask
*/ */
private function ipGetNetwork($rangeIp, $size, $prefix) private function ipGetNetwork($rangeIp, $size, $prefix): array
{ {
$netmask = $this->ipGetMask($prefix, $size); $netmask = $this->ipGetMask($prefix, $size);
@ -335,7 +335,7 @@ class NoProxyPattern
* *
* @return string Mapped or existing in_addr * @return string Mapped or existing in_addr
*/ */
private function ipMapTo6($binary, $size) private function ipMapTo6($binary, $size): string
{ {
if ($size === 4) { if ($size === 4) {
$prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2); $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
@ -354,7 +354,7 @@ class NoProxyPattern
* *
* @return stdClass * @return stdClass
*/ */
private function makeData($host, $port, $ipdata) private function makeData($host, $port, $ipdata): stdClass
{ {
return (object) array( return (object) array(
'host' => $host, 'host' => $host,
@ -373,7 +373,7 @@ class NoProxyPattern
* *
* @return stdClass * @return stdClass
*/ */
private function makeIpData($ip, $size, $netmask) private function makeIpData($ip, $size, $netmask): stdClass
{ {
return (object) array( return (object) array(
'ip' => $ip, 'ip' => $ip,
@ -389,7 +389,7 @@ class NoProxyPattern
* *
* @return mixed[] host, port, if there was error * @return mixed[] host, port, if there was error
*/ */
private function splitHostPort($hostName) private function splitHostPort($hostName): array
{ {
// host, port, err // host, port, err
$error = array('', '', true); $error = array('', '', true);
@ -439,7 +439,7 @@ class NoProxyPattern
* *
* @return bool * @return bool
*/ */
private function validateInt($int, $min, $max) private function validateInt($int, $min, $max): bool
{ {
$options = array( $options = array(
'options' => array( 'options' => array(

View File

@ -216,7 +216,7 @@ class Platform
* *
* @return bool * @return bool
*/ */
private static function isVirtualBoxGuest() private static function isVirtualBoxGuest(): bool
{ {
if (null === self::$isVirtualBoxGuest) { if (null === self::$isVirtualBoxGuest) {
self::$isVirtualBoxGuest = false; self::$isVirtualBoxGuest = false;

View File

@ -100,7 +100,7 @@ class ProcessExecutor
* @param mixed $output * @param mixed $output
* @return int * @return int
*/ */
private function doExecute($command, $cwd, $tty, &$output = null) private function doExecute($command, $cwd, $tty, &$output = null): int
{ {
$this->outputCommandRun($command, $cwd, false); $this->outputCommandRun($command, $cwd, false);
@ -210,7 +210,7 @@ class ProcessExecutor
* @param int $id * @param int $id
* @return void * @return void
*/ */
private function startJob($id) private function startJob($id): void
{ {
$job = &$this->jobs[$id]; $job = &$this->jobs[$id];
if ($job['status'] !== self::STATUS_QUEUED) { if ($job['status'] !== self::STATUS_QUEUED) {
@ -269,7 +269,7 @@ class ProcessExecutor
* *
* @return void * @return void
*/ */
public function enableAsync() public function enableAsync(): void
{ {
$this->allowAsync = true; $this->allowAsync = true;
} }
@ -280,7 +280,7 @@ class ProcessExecutor
* @param ?int $index job id * @param ?int $index job id
* @return int number of active (queued or started) jobs * @return int number of active (queued or started) jobs
*/ */
public function countActiveJobs($index = null) public function countActiveJobs($index = null): int
{ {
// tick // tick
foreach ($this->jobs as $job) { foreach ($this->jobs as $job) {
@ -437,7 +437,7 @@ class ProcessExecutor
* *
* @return string * @return string
*/ */
private static function escapeArgument($argument) private static function escapeArgument($argument): string
{ {
if ('' === ($argument = (string) $argument)) { if ('' === ($argument = (string) $argument)) {
return escapeshellarg($argument); return escapeshellarg($argument);

View File

@ -106,7 +106,7 @@ class RemoteFilesystem
* *
* @return bool true * @return bool true
*/ */
public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array()) public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array()): bool
{ {
return $this->get($originUrl, $fileUrl, $options, $fileName, $progress); return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
} }
@ -131,7 +131,7 @@ class RemoteFilesystem
* *
* @return mixed[] Options * @return mixed[] Options
*/ */
public function getOptions() public function getOptions(): array
{ {
return $this->options; return $this->options;
} }
@ -142,7 +142,7 @@ class RemoteFilesystem
* @param mixed[] $options * @param mixed[] $options
* @return void * @return void
*/ */
public function setOptions(array $options) public function setOptions(array $options): void
{ {
$this->options = array_replace_recursive($this->options, $options); $this->options = array_replace_recursive($this->options, $options);
} }
@ -152,7 +152,7 @@ class RemoteFilesystem
* *
* @return bool * @return bool
*/ */
public function isTlsDisabled() public function isTlsDisabled(): bool
{ {
return $this->disableTls === true; return $this->disableTls === true;
} }
@ -162,7 +162,7 @@ class RemoteFilesystem
* *
* @return string[] * @return string[]
*/ */
public function getLastHeaders() public function getLastHeaders(): array
{ {
return $this->lastHeaders; return $this->lastHeaders;
} }
@ -171,7 +171,7 @@ class RemoteFilesystem
* @param string[] $headers array of returned headers like from getLastHeaders() * @param string[] $headers array of returned headers like from getLastHeaders()
* @return int|null * @return int|null
*/ */
public static function findStatusCode(array $headers) public static function findStatusCode(array $headers): ?int
{ {
$value = null; $value = null;
foreach ($headers as $header) { foreach ($headers as $header) {
@ -189,7 +189,7 @@ class RemoteFilesystem
* @param string[] $headers array of returned headers like from getLastHeaders() * @param string[] $headers array of returned headers like from getLastHeaders()
* @return string|null * @return string|null
*/ */
public function findStatusMessage(array $headers) public function findStatusMessage(array $headers): ?string
{ {
$value = null; $value = null;
foreach ($headers as $header) { foreach ($headers as $header) {
@ -554,7 +554,7 @@ class RemoteFilesystem
* *
* @throws TransportException * @throws TransportException
*/ */
protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax) protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax): void
{ {
switch ($notificationCode) { switch ($notificationCode) {
case STREAM_NOTIFY_FAILURE: case STREAM_NOTIFY_FAILURE:
@ -592,7 +592,7 @@ class RemoteFilesystem
* *
* @return void * @return void
*/ */
protected function promptAuthAndRetry($httpStatus, $reason = null, $headers = array()) protected function promptAuthAndRetry($httpStatus, $reason = null, $headers = array()): void
{ {
$result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers); $result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers);
@ -610,7 +610,7 @@ class RemoteFilesystem
* *
* @return mixed[] * @return mixed[]
*/ */
protected function getOptionsForUrl($originUrl, $additionalOptions) protected function getOptionsForUrl($originUrl, $additionalOptions): array
{ {
$tlsOptions = array(); $tlsOptions = array();
$headers = array(); $headers = array();
@ -698,7 +698,7 @@ class RemoteFilesystem
* *
* @return string|null * @return string|null
*/ */
private function decodeResult($result, $http_response_header) private function decodeResult($result, $http_response_header): ?string
{ {
// decode gzip // decode gzip
if ($result && extension_loaded('zlib')) { if ($result && extension_loaded('zlib')) {
@ -722,7 +722,7 @@ class RemoteFilesystem
* *
* @return string|null * @return string|null
*/ */
private function normalizeResult($result) private function normalizeResult($result): ?string
{ {
if ($result === false) { if ($result === false) {
return null; return null;

View File

@ -63,7 +63,7 @@ final class StreamContextFactory
* @phpstan-return array{http: array{header: string[], proxy?: string, request_fulluri: bool}, ssl?: mixed[]} * @phpstan-return array{http: array{header: string[], proxy?: string, request_fulluri: bool}, ssl?: mixed[]}
* @return array formatted as a stream context array * @return array formatted as a stream context array
*/ */
public static function initOptions($url, array $options, $forCurl = false) public static function initOptions($url, array $options, $forCurl = false): array
{ {
// Make sure the headers are in an array form // Make sure the headers are in an array form
if (!isset($options['http']['header'])) { if (!isset($options['http']['header'])) {
@ -134,7 +134,7 @@ final class StreamContextFactory
* *
* @return mixed[] * @return mixed[]
*/ */
public static function getTlsDefaults(array $options, LoggerInterface $logger = null) public static function getTlsDefaults(array $options, LoggerInterface $logger = null): array
{ {
$ciphers = implode(':', array( $ciphers = implode(':', array(
'ECDHE-RSA-AES128-GCM-SHA256', 'ECDHE-RSA-AES128-GCM-SHA256',
@ -240,7 +240,7 @@ final class StreamContextFactory
* @param string|string[] $header * @param string|string[] $header
* @return string[] * @return string[]
*/ */
private static function fixHttpHeaderField($header) private static function fixHttpHeaderField($header): array
{ {
if (!is_array($header)) { if (!is_array($header)) {
$header = explode("\r\n", $header); $header = explode("\r\n", $header);

View File

@ -140,7 +140,7 @@ class Svn
* *
* @return ?string * @return ?string
*/ */
private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose) private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose): ?string
{ {
// Regenerate the command at each try, to use the newly user-provided credentials // Regenerate the command at each try, to use the newly user-provided credentials
$command = $this->getCommand($svnCommand, $url, $path); $command = $this->getCommand($svnCommand, $url, $path);
@ -337,7 +337,7 @@ class Svn
* *
* @return bool * @return bool
*/ */
private function createAuthFromConfig() private function createAuthFromConfig(): bool
{ {
if (!$this->config->has('http-basic')) { if (!$this->config->has('http-basic')) {
return $this->hasAuth = false; return $this->hasAuth = false;
@ -363,7 +363,7 @@ class Svn
* *
* @return bool * @return bool
*/ */
private function createAuthFromUrl() private function createAuthFromUrl(): bool
{ {
$uri = parse_url($this->url); $uri = parse_url($this->url);
if (empty($uri['user'])) { if (empty($uri['user'])) {

View File

@ -40,7 +40,7 @@ class Tar
* *
* @return string * @return string
*/ */
private static function extractComposerJsonFromFolder(\PharData $phar) private static function extractComposerJsonFromFolder(\PharData $phar): string
{ {
if (isset($phar['composer.json'])) { if (isset($phar['composer.json'])) {
return $phar['composer.json']->getContent(); return $phar['composer.json']->getContent();

View File

@ -30,7 +30,7 @@ final class TlsHelper
* *
* @return bool * @return bool
*/ */
public static function checkCertificateHost($certificate, $hostname, &$cn = null) public static function checkCertificateHost($certificate, $hostname, &$cn = null): bool
{ {
$names = self::getCertificateNames($certificate); $names = self::getCertificateNames($certificate);
@ -61,7 +61,7 @@ final class TlsHelper
* *
* @return array{cn: string, san: string[]}|null * @return array{cn: string, san: string[]}|null
*/ */
public static function getCertificateNames($certificate) public static function getCertificateNames($certificate): ?array
{ {
if (is_array($certificate)) { if (is_array($certificate)) {
$info = $certificate; $info = $certificate;
@ -136,7 +136,7 @@ final class TlsHelper
* @param string $certificate * @param string $certificate
* @return string * @return string
*/ */
public static function getCertificateFingerprint($certificate) public static function getCertificateFingerprint($certificate): string
{ {
$pubkey = openssl_get_publickey($certificate); $pubkey = openssl_get_publickey($certificate);
if ($pubkey === false) { if ($pubkey === false) {
@ -161,7 +161,7 @@ final class TlsHelper
* *
* @return bool * @return bool
*/ */
public static function isOpensslParseSafe() public static function isOpensslParseSafe(): bool
{ {
return CaBundle::isOpensslParseSafe(); return CaBundle::isOpensslParseSafe();
} }
@ -173,7 +173,7 @@ final class TlsHelper
* *
* @return callable|null * @return callable|null
*/ */
private static function certNameMatcher($certName) private static function certNameMatcher($certName): ?callable
{ {
$wildcards = substr_count($certName, '*'); $wildcards = substr_count($certName, '*');

View File

@ -65,7 +65,7 @@ class Zip
* *
* @return int * @return int
*/ */
private static function locateFile(\ZipArchive $zip, $filename) private static function locateFile(\ZipArchive $zip, $filename): int
{ {
// return root composer.json if it is there and is a file // return root composer.json if it is there and is a file
if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) { if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) {

View File

@ -179,7 +179,7 @@ class AllFunctionalTest extends TestCase
/** /**
* @return array<string, array<string>> * @return array<string, array<string>>
*/ */
public function getTestFiles() public function getTestFiles(): array
{ {
$tests = array(); $tests = array();
foreach (Finder::create()->in(__DIR__.'/Fixtures/functional')->name('*.test')->files() as $file) { foreach (Finder::create()->in(__DIR__.'/Fixtures/functional')->name('*.test')->files() as $file) {
@ -193,7 +193,7 @@ class AllFunctionalTest extends TestCase
* @param string $file * @param string $file
* @return array{RUN: string, EXPECT?: string, EXPECT-EXIT-CODE?: int, EXPECT-REGEX?: string, EXPECT-REGEXES?: string, TEST?: string} * @return array{RUN: string, EXPECT?: string, EXPECT-EXIT-CODE?: int, EXPECT-REGEX?: string, EXPECT-REGEXES?: string, TEST?: string}
*/ */
private function parseTestFile($file) private function parseTestFile($file): array
{ {
$tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE); $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE);
$data = array(); $data = array();
@ -255,7 +255,7 @@ class AllFunctionalTest extends TestCase
* @param string $output * @param string $output
* @return string * @return string
*/ */
private function cleanOutput($output) private function cleanOutput($output): string
{ {
$processed = ''; $processed = '';

View File

@ -1741,7 +1741,7 @@ EOF;
/** /**
* @return array<string, mixed[]> * @return array<string, mixed[]>
*/ */
public function platformCheckProvider() public function platformCheckProvider(): array
{ {
$versionParser = new VersionParser(); $versionParser = new VersionParser();

View File

@ -42,7 +42,7 @@ class ClassLoaderTest extends TestCase
* *
* @return array<array<string>> Array of parameter sets to test with. * @return array<array<string>> Array of parameter sets to test with.
*/ */
public function getLoadClassTests() public function getLoadClassTests(): array
{ {
return array( return array(
array('Namespaced\\Foo'), array('Namespaced\\Foo'),

View File

@ -38,7 +38,7 @@ class ClassMapGeneratorTest extends TestCase
/** /**
* @return array<array<string|array<string>>> * @return array<array<string|array<string>>>
*/ */
public function getTestCreateMapTests() public function getTestCreateMapTests(): array
{ {
$classmap = array( $classmap = array(
'Foo\\Bar\\A' => realpath(__DIR__) . '/Fixtures/classmap/sameNsMultipleClasses.php', 'Foo\\Bar\\A' => realpath(__DIR__) . '/Fixtures/classmap/sameNsMultipleClasses.php',

View File

@ -89,7 +89,7 @@ class RunScriptCommandTest extends TestCase
} }
/** @return bool[][] **/ /** @return bool[][] **/
public function getDevOptions() public function getDevOptions(): array
{ {
return array( return array(
array(true, true), array(true, true),
@ -100,7 +100,7 @@ class RunScriptCommandTest extends TestCase
} }
/** @return Composer **/ /** @return Composer **/
private function createComposerInstance() private function createComposerInstance(): Composer
{ {
$composer = new Composer; $composer = new Composer;
$config = new Config; $config = new Config;

View File

@ -29,7 +29,7 @@ class JsonConfigSourceTest extends TestCase
* *
* @return string * @return string
*/ */
protected function fixturePath($name) protected function fixturePath($name): string
{ {
return __DIR__.'/Fixtures/'.$name; return __DIR__.'/Fixtures/'.$name;
} }
@ -160,7 +160,7 @@ class JsonConfigSourceTest extends TestCase
* *
* @phpstan-return array{string, string, string, string, string} * @phpstan-return array{string, string, string, string, string}
*/ */
protected function addLinkDataArguments($type, $name, $value, $fixtureBasename, $before) protected function addLinkDataArguments($type, $name, $value, $fixtureBasename, $before): array
{ {
return array( return array(
$before, $before,
@ -217,7 +217,7 @@ class JsonConfigSourceTest extends TestCase
* *
* @phpstan-return array{string, string, string, string} * @phpstan-return array{string, string, string, string}
*/ */
protected function removeLinkDataArguments($type, $name, $fixtureBasename, $after = null) protected function removeLinkDataArguments($type, $name, $fixtureBasename, $after = null): array
{ {
return array( return array(
$this->fixturePath('removeLink/'.$fixtureBasename.'.json'), $this->fixturePath('removeLink/'.$fixtureBasename.'.json'),

View File

@ -269,7 +269,7 @@ class ConfigTest extends TestCase
/** /**
* @return string[][] List of test URLs that should pass strict security * @return string[][] List of test URLs that should pass strict security
*/ */
public function allowedUrlProvider() public function allowedUrlProvider(): array
{ {
$urls = array( $urls = array(
'https://packagist.org', 'https://packagist.org',
@ -290,7 +290,7 @@ class ConfigTest extends TestCase
/** /**
* @return string[][] List of test URLs that should not pass strict security * @return string[][] List of test URLs that should not pass strict security
*/ */
public function prohibitedUrlProvider() public function prohibitedUrlProvider(): array
{ {
$urls = array( $urls = array(
'http://packagist.org', 'http://packagist.org',

View File

@ -149,7 +149,7 @@ class PoolBuilderTest extends TestCase
* @param array<int, BasePackage> $packageIds * @param array<int, BasePackage> $packageIds
* @return string[] * @return string[]
*/ */
private function getPackageResultSet(Pool $pool, $packageIds) private function getPackageResultSet(Pool $pool, $packageIds): array
{ {
$result = array(); $result = array();
for ($i = 1, $count = count($pool); $i <= $count; $i++) { for ($i = 1, $count = count($pool); $i <= $count; $i++) {
@ -184,7 +184,7 @@ class PoolBuilderTest extends TestCase
/** /**
* @return array<string, array<string>> * @return array<string, array<string>>
*/ */
public function getIntegrationTests() public function getIntegrationTests(): array
{ {
$fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/'); $fixturesDir = realpath(__DIR__.'/Fixtures/poolbuilder/');
$tests = array(); $tests = array();
@ -223,7 +223,7 @@ class PoolBuilderTest extends TestCase
* @param string $fixturesDir * @param string $fixturesDir
* @return array<string, string> * @return array<string, string>
*/ */
protected function readTestFile(\SplFileInfo $file, $fixturesDir) protected function readTestFile(\SplFileInfo $file, $fixturesDir): array
{ {
$tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE);

View File

@ -100,7 +100,7 @@ class PoolOptimizerTest extends TestCase
* @param string $fixturesDir * @param string $fixturesDir
* @return mixed[] * @return mixed[]
*/ */
protected function readTestFile(\SplFileInfo $file, $fixturesDir) protected function readTestFile(\SplFileInfo $file, $fixturesDir): array
{ {
$tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE); $tokens = Preg::split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file->getRealPath()), -1, PREG_SPLIT_DELIM_CAPTURE);
@ -154,7 +154,7 @@ class PoolOptimizerTest extends TestCase
* @param BasePackage[] $packages * @param BasePackage[] $packages
* @return string[] * @return string[]
*/ */
private function reducePackagesInfoForComparison(array $packages) private function reducePackagesInfoForComparison(array $packages): array
{ {
$packagesInfo = array(); $packagesInfo = array();
@ -171,7 +171,7 @@ class PoolOptimizerTest extends TestCase
* @param mixed[][] $packagesData * @param mixed[][] $packagesData
* @return BasePackage[] * @return BasePackage[]
*/ */
private function loadPackages(array $packagesData) private function loadPackages(array $packagesData): array
{ {
$packages = array(); $packages = array();
@ -189,7 +189,7 @@ class PoolOptimizerTest extends TestCase
* @param mixed[] $packageData * @param mixed[] $packageData
* @return BasePackage * @return BasePackage
*/ */
private function loadPackage(array $packageData) private function loadPackage(array $packageData): BasePackage
{ {
$loader = new ArrayLoader(); $loader = new ArrayLoader();

View File

@ -61,7 +61,7 @@ class PoolTest extends TestCase
* @param array<\Composer\Package\BasePackage>|null $packages * @param array<\Composer\Package\BasePackage>|null $packages
* @return \Composer\DependencyResolver\Pool * @return \Composer\DependencyResolver\Pool
*/ */
protected function createPool($packages = array()) protected function createPool($packages = array()): \Composer\DependencyResolver\Pool
{ {
return new Pool($packages); return new Pool($packages);
} }

View File

@ -43,7 +43,7 @@ class FileDownloaderTest extends TestCase
* @param \Composer\Util\Filesystem $filesystem * @param \Composer\Util\Filesystem $filesystem
* @return \Composer\Downloader\FileDownloader * @return \Composer\Downloader\FileDownloader
*/ */
protected function getDownloader($io = null, $config = null, $eventDispatcher = null, $cache = null, $httpDownloader = null, $filesystem = null) protected function getDownloader($io = null, $config = null, $eventDispatcher = null, $cache = null, $httpDownloader = null, $filesystem = null): \Composer\Downloader\FileDownloader
{ {
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$config = $config ?: $this->config; $config = $config ?: $this->config;

View File

@ -42,7 +42,7 @@ class FossilDownloaderTest extends TestCase
* @param \Composer\Util\Filesystem $filesystem * @param \Composer\Util\Filesystem $filesystem
* @return FossilDownloader * @return FossilDownloader
*/ */
protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null) protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null): FossilDownloader
{ {
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$config = $config ?: $this->getMockBuilder('Composer\Config')->getMock(); $config = $config ?: $this->getMockBuilder('Composer\Config')->getMock();

View File

@ -62,7 +62,7 @@ class GitDownloaderTest extends TestCase
* @param ?\Composer\Config $config * @param ?\Composer\Config $config
* @return \Composer\Config * @return \Composer\Config
*/ */
protected function setupConfig($config = null) protected function setupConfig($config = null): \Composer\Config
{ {
if (!$config) { if (!$config) {
$config = new Config(); $config = new Config();
@ -82,7 +82,7 @@ class GitDownloaderTest extends TestCase
* @param \Composer\Util\Filesystem $filesystem * @param \Composer\Util\Filesystem $filesystem
* @return GitDownloader * @return GitDownloader
*/ */
protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null) protected function getDownloaderMock($io = null, $config = null, $executor = null, $filesystem = null): GitDownloader
{ {
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$executor = $executor ?: $this->getProcessExecutorMock(); $executor = $executor ?: $this->getProcessExecutorMock();
@ -647,7 +647,7 @@ composer https://github.com/old/url (push)
* @param string $cmd * @param string $cmd
* @return string * @return string
*/ */
private function winCompat($cmd) private function winCompat($cmd): string
{ {
if (Platform::isWindows()) { if (Platform::isWindows()) {
$cmd = str_replace('cd ', 'cd /D ', $cmd); $cmd = str_replace('cd ', 'cd /D ', $cmd);

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