From d1c8a4d1b419889a4f53ab58173bc875a102b6f0 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 12 Oct 2021 22:47:23 +0200 Subject: [PATCH] Lots of typing improvements --- src/Composer/Autoload/ClassMapGenerator.php | 4 +- src/Composer/Cache.php | 7 ++ .../Command/BaseDependencyCommand.php | 2 +- src/Composer/Compiler.php | 5 +- src/Composer/Config.php | 7 ++ src/Composer/Config/ConfigSourceInterface.php | 25 +++++-- .../DependencyResolver/PolicyInterface.php | 12 ++++ .../Downloader/DownloaderInterface.php | 1 + .../EventSubscriberInterface.php | 2 +- src/Composer/IO/IOInterface.php | 70 ++++++++++++------- src/Composer/InstalledVersions.php | 13 ++++ src/Composer/Installer.php | 23 +++++- .../Installer/BinaryPresenceInterface.php | 2 + src/Composer/Package/AliasPackage.php | 6 ++ .../Archiver/ArchivableFilesFilter.php | 1 + .../Package/Archiver/ArchiverInterface.php | 9 +-- .../Package/Archiver/BaseExcludeFilter.php | 2 +- .../Package/Archiver/PharArchiver.php | 2 + src/Composer/Package/Archiver/ZipArchiver.php | 3 +- src/Composer/Package/BasePackage.php | 1 + src/Composer/Package/Comparer/Comparer.php | 3 + src/Composer/Package/CompletePackage.php | 18 ++++- .../Package/CompletePackageInterface.php | 22 +++--- src/Composer/Package/Loader/ArrayLoader.php | 2 + .../Loader/InvalidPackageException.php | 3 + src/Composer/Package/Loader/JsonLoader.php | 1 + .../Package/Loader/LoaderInterface.php | 19 +++-- .../Package/Loader/RootPackageLoader.php | 10 ++- .../Package/Loader/ValidatingArrayLoader.php | 9 ++- src/Composer/Package/Locker.php | 6 +- src/Composer/Package/Package.php | 4 +- src/Composer/Package/PackageInterface.php | 16 +++-- src/Composer/Package/RootPackage.php | 6 ++ src/Composer/Package/RootPackageInterface.php | 58 +++++++++++---- .../Package/Version/VersionParser.php | 2 + .../Package/Version/VersionSelector.php | 4 ++ src/Composer/Plugin/PluginInterface.php | 6 ++ .../Repository/ComposerRepository.php | 4 +- .../ConfigurableRepositoryInterface.php | 3 + .../Repository/Vcs/PerforceDriver.php | 2 - .../Repository/Vcs/VcsDriverInterface.php | 22 +++--- .../Repository/VersionCacheInterface.php | 6 +- .../WritableRepositoryInterface.php | 6 ++ src/Composer/Util/AuthHelper.php | 7 +- src/Composer/Util/Http/ProxyManager.php | 15 ++-- src/Composer/Util/Perforce.php | 16 +++++ 46 files changed, 361 insertions(+), 106 deletions(-) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 1bb204362..0451077fb 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -33,7 +33,7 @@ class ClassMapGenerator /** * Generate a class map file * - * @param \Traversable|array $dirs Directories or a single path to search in + * @param \Traversable|array $dirs Directories or a single path to search in * @param string $file The name of the class map file */ public static function dump($dirs, $file) @@ -58,6 +58,8 @@ class ClassMapGenerator * * @throws \RuntimeException When the path is neither an existing file nor directory * @return array A class map array + * + * @phpstan-param \Traversable<\SplFileInfo>|string|array $path */ public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array()) { diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index a3aaebf57..c02a636a2 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -24,12 +24,19 @@ use Symfony\Component\Finder\Finder; */ class Cache { + /** @var bool|null */ private static $cacheCollected = null; + /** @var IOInterface */ private $io; + /** @var string */ private $root; + /** @var bool */ private $enabled = true; + /** @var string */ private $allowlist; + /** @var Filesystem */ private $filesystem; + /** @var bool */ private $readOnly; /** diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index 962c1b2ce..e116b79ed 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -203,7 +203,7 @@ class BaseDependencyCommand extends BaseCommand /** * @var PackageInterface $package * @var Link $link - * @var array|bool $children + * @var mixed[]|bool $children */ list($package, $link, $children) = $result; diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 8476a529f..da5e1d842 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -27,8 +27,11 @@ use Seld\PharUtils\Linter; */ class Compiler { + /** @var string */ private $version; + /** @var string */ private $branchAliasVersion = ''; + /** @var \DateTime */ private $versionDate; /** @@ -313,7 +316,7 @@ EOF; // add warning once the phar is older than 60 days if (preg_match('{^[a-f0-9]+$}', $this->version)) { - $warningTime = $this->versionDate->format('U') + 60 * 86400; + $warningTime = ((int) $this->versionDate->format('U')) + 60 * 86400; $stub .= "define('COMPOSER_DEV_WARNING_TIME', $warningTime);\n"; } diff --git a/src/Composer/Config.php b/src/Composer/Config.php index 4cb7ab8ae..30110331f 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -25,6 +25,7 @@ class Config { const RELATIVE_PATHS = 1; + /** @var array */ public static $defaultConfig = array( 'process-timeout' => 300, 'use-include-path' => false, @@ -77,6 +78,7 @@ class Config // bearer ); + /** @var array */ public static $defaultRepositories = array( 'packagist.org' => array( 'type' => 'composer', @@ -84,14 +86,19 @@ class Config ), ); + /** @var array */ private $config; + /** @var ?string */ private $baseDir; + /** @var array */ private $repositories; /** @var ConfigSourceInterface */ private $configSource; /** @var ConfigSourceInterface */ private $authConfigSource; + /** @var bool */ private $useEnvironment; + /** @var array */ private $warnedHosts = array(); /** diff --git a/src/Composer/Config/ConfigSourceInterface.php b/src/Composer/Config/ConfigSourceInterface.php index e1ef38de0..111d5d53c 100644 --- a/src/Composer/Config/ConfigSourceInterface.php +++ b/src/Composer/Config/ConfigSourceInterface.php @@ -23,8 +23,11 @@ interface ConfigSourceInterface /** * Add a repository * - * @param string $name Name - * @param array|false $config Configuration + * @param string $name Name + * @param mixed[]|false $config Configuration + * @param bool $append Whether the repo should be appended (true) or prepended (false) + * + * @return void */ public function addRepository($name, $config, $append = true); @@ -32,14 +35,18 @@ interface ConfigSourceInterface * Remove a repository * * @param string $name + * + * @return void */ public function removeRepository($name); /** * Add a config setting * - * @param string $name Name - * @param string|array $value Value + * @param string $name Name + * @param mixed $value Value + * + * @return void */ public function addConfigSetting($name, $value); @@ -47,6 +54,8 @@ interface ConfigSourceInterface * Remove a config setting * * @param string $name + * + * @return void */ public function removeConfigSetting($name); @@ -55,6 +64,8 @@ interface ConfigSourceInterface * * @param string $name Name * @param string $value Value + * + * @return void */ public function addProperty($name, $value); @@ -62,6 +73,8 @@ interface ConfigSourceInterface * Remove a property * * @param string $name + * + * @return void */ public function removeProperty($name); @@ -71,6 +84,8 @@ interface ConfigSourceInterface * @param string $type Type (require, require-dev, provide, suggest, replace, conflict) * @param string $name Name * @param string $value Value + * + * @return void */ public function addLink($type, $name, $value); @@ -79,6 +94,8 @@ interface ConfigSourceInterface * * @param string $type Type (require, require-dev, provide, suggest, replace, conflict) * @param string $name Name + * + * @return void */ public function removeLink($type, $name); diff --git a/src/Composer/DependencyResolver/PolicyInterface.php b/src/Composer/DependencyResolver/PolicyInterface.php index b10a43e9f..48ce24e16 100644 --- a/src/Composer/DependencyResolver/PolicyInterface.php +++ b/src/Composer/DependencyResolver/PolicyInterface.php @@ -13,13 +13,25 @@ namespace Composer\DependencyResolver; use Composer\Package\PackageInterface; +use Composer\Semver\Constraint\Constraint; /** * @author Nils Adermann */ interface PolicyInterface { + /** + * @param string $operator + * @return bool + * + * @phpstan-param Constraint::STR_OP_* $operator + */ public function versionCompare(PackageInterface $a, PackageInterface $b, $operator); + /** + * @param int[] $literals + * @param ?string $requiredPackage + * @return int[] + */ public function selectPreferredPackages(Pool $pool, array $literals, $requiredPackage = null); } diff --git a/src/Composer/Downloader/DownloaderInterface.php b/src/Composer/Downloader/DownloaderInterface.php index ef2357958..b19f902a8 100644 --- a/src/Composer/Downloader/DownloaderInterface.php +++ b/src/Composer/Downloader/DownloaderInterface.php @@ -33,6 +33,7 @@ interface DownloaderInterface /** * This should do any network-related tasks to prepare for an upcoming install/update * + * @param string $path download path * @return PromiseInterface|null */ public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null); diff --git a/src/Composer/EventDispatcher/EventSubscriberInterface.php b/src/Composer/EventDispatcher/EventSubscriberInterface.php index 6b0c4ca06..4de66c80b 100644 --- a/src/Composer/EventDispatcher/EventSubscriberInterface.php +++ b/src/Composer/EventDispatcher/EventSubscriberInterface.php @@ -42,7 +42,7 @@ interface EventSubscriberInterface * * array('eventName' => array('methodName', $priority)) * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) * - * @return array The event names to listen to + * @return array> The event names to listen to */ public static function getSubscribedEvents(); } diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index fd2a2d503..cf19321c2 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -66,56 +66,68 @@ interface IOInterface extends LoggerInterface /** * Writes a message to the output. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function write($messages, $newline = true, $verbosity = self::NORMAL); /** * Writes a message to the error output. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function writeError($messages, $newline = true, $verbosity = self::NORMAL); /** * Writes a message to the output, without formatting it. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL); /** * Writes a message to the error output, without formatting it. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL); /** * Overwrites a previous message to the output. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $size The size of line - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $size The size of line + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL); /** * Overwrites a previous message to the error output. * - * @param string|array $messages The message as an array of lines or a single string - * @param bool $newline Whether to add a newline or not - * @param int $size The size of line - * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * @param string|string[] $messages The message as an array of lines or a single string + * @param bool $newline Whether to add a newline or not + * @param int $size The size of line + * @param int $verbosity Verbosity level from the VERBOSITY_* constants + * + * @return void */ public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL); @@ -172,21 +184,21 @@ interface IOInterface extends LoggerInterface * Asks the user to select a value. * * @param string $question The question to ask - * @param array $choices List of choices to pick from + * @param string[] $choices List of choices to pick from * @param bool|string $default The default answer if the user enters nothing * @param bool|int $attempts Max number of times to ask before giving up (false by default, which means infinite) * @param string $errorMessage Message which will be shown if invalid value from choice list would be picked * @param bool $multiselect Select more than one value separated by comma * * @throws \InvalidArgumentException - * @return int|string|array|bool The selected value or values (the key of the choices array) + * @return int|string|string[]|bool The selected value or values (the key of the choices array) */ public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false); /** * Get all authentication information entered. * - * @return array The map of authentication data + * @return array The map of authentication data */ public function getAuthentications(); @@ -204,16 +216,18 @@ interface IOInterface extends LoggerInterface * * @param string $repositoryName The unique name of repository * - * @return array The 'username' and 'password' + * @return array{username: string|null, password: string|null} */ public function getAuthentication($repositoryName); /** * Set the authentication information for the repository. * - * @param string $repositoryName The unique name of repository - * @param string $username The username - * @param string $password The password + * @param string $repositoryName The unique name of repository + * @param string $username The username + * @param ?string $password The password + * + * @return void */ public function setAuthentication($repositoryName, $username, $password = null); @@ -221,6 +235,8 @@ interface IOInterface extends LoggerInterface * Loads authentications from a config instance * * @param Config $config + * + * @return void */ public function loadConfiguration(Config $config); } diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index 7c5502ca4..d50e0c9fc 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -24,8 +24,21 @@ use Composer\Semver\VersionParser; */ class InstalledVersions { + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ private static $installed; + + /** + * @var bool|null + */ private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ private static $installedByVendor = array(); /** diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index d04005132..fab317822 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -117,23 +117,41 @@ class Installer */ protected $autoloadGenerator; + /** @var bool */ protected $preferSource = false; + /** @var bool */ protected $preferDist = false; + /** @var bool */ protected $optimizeAutoloader = false; + /** @var bool */ protected $classMapAuthoritative = false; + /** @var bool */ protected $apcuAutoloader = false; - protected $apcuAutoloaderPrefix; + /** @var string|null */ + protected $apcuAutoloaderPrefix = null; + /** @var bool */ protected $devMode = false; + /** @var bool */ protected $dryRun = false; + /** @var bool */ protected $verbose = false; + /** @var bool */ protected $update = false; + /** @var bool */ protected $install = true; + /** @var bool */ protected $dumpAutoloader = true; + /** @var bool */ protected $runScripts = true; + /** @var bool|string[] */ protected $ignorePlatformReqs = false; + /** @var bool */ protected $preferStable = false; + /** @var bool */ protected $preferLowest = false; + /** @var bool */ protected $writeLock; + /** @var bool */ protected $executeOperations = true; /** @var bool */ @@ -141,9 +159,10 @@ class Installer /** * Array of package names/globs flagged for update * - * @var array|null + * @var string[]|null */ protected $updateAllowList = null; + /** @var Request::UPDATE_* */ protected $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED; /** diff --git a/src/Composer/Installer/BinaryPresenceInterface.php b/src/Composer/Installer/BinaryPresenceInterface.php index 2749ffafd..61907f778 100644 --- a/src/Composer/Installer/BinaryPresenceInterface.php +++ b/src/Composer/Installer/BinaryPresenceInterface.php @@ -25,6 +25,8 @@ interface BinaryPresenceInterface * Make sure binaries are installed for a given package. * * @param PackageInterface $package package instance + * + * @return void */ public function ensureBinariesPresence(PackageInterface $package); } diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index c993230c6..7b9ab2c14 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -20,11 +20,17 @@ use Composer\Package\Version\VersionParser; */ class AliasPackage extends BasePackage { + /** @var string */ protected $version; + /** @var string */ protected $prettyVersion; + /** @var bool */ protected $dev; + /** @var bool */ protected $rootPackageAlias = false; + /** @var string */ protected $stability; + /** @var bool */ protected $hasSelfVersionRequires = false; /** @var BasePackage */ diff --git a/src/Composer/Package/Archiver/ArchivableFilesFilter.php b/src/Composer/Package/Archiver/ArchivableFilesFilter.php index f49486a04..863b6e99b 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFilter.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFilter.php @@ -17,6 +17,7 @@ use PharData; class ArchivableFilesFilter extends FilterIterator { + /** @var string[] */ private $dirs = array(); /** diff --git a/src/Composer/Package/Archiver/ArchiverInterface.php b/src/Composer/Package/Archiver/ArchiverInterface.php index 4e5fa54f9..4ea8dc485 100644 --- a/src/Composer/Package/Archiver/ArchiverInterface.php +++ b/src/Composer/Package/Archiver/ArchiverInterface.php @@ -22,10 +22,11 @@ interface ArchiverInterface /** * Create an archive from the sources. * - * @param string $sources The sources directory - * @param string $target The target file - * @param string $format The format used for archive - * @param array $excludes A list of patterns for files to exclude + * @param string $sources The sources directory + * @param string $target The target file + * @param string $format The format used for archive + * @param string[] $excludes A list of patterns for files to exclude + * @param bool $ignoreFilters Whether to ignore filters when looking for files * * @return string The path to the written archive file */ diff --git a/src/Composer/Package/Archiver/BaseExcludeFilter.php b/src/Composer/Package/Archiver/BaseExcludeFilter.php index a67ad272a..0d9fda409 100644 --- a/src/Composer/Package/Archiver/BaseExcludeFilter.php +++ b/src/Composer/Package/Archiver/BaseExcludeFilter.php @@ -25,7 +25,7 @@ abstract class BaseExcludeFilter protected $sourcePath; /** - * @var array + * @var array array of [$pattern, $negate, $stripLeadingSlash] arrays */ protected $excludePatterns; diff --git a/src/Composer/Package/Archiver/PharArchiver.php b/src/Composer/Package/Archiver/PharArchiver.php index 955d1b3c9..2767642ff 100644 --- a/src/Composer/Package/Archiver/PharArchiver.php +++ b/src/Composer/Package/Archiver/PharArchiver.php @@ -19,6 +19,7 @@ namespace Composer\Package\Archiver; */ class PharArchiver implements ArchiverInterface { + /** @var array */ protected static $formats = array( 'zip' => \Phar::ZIP, 'tar' => \Phar::TAR, @@ -26,6 +27,7 @@ class PharArchiver implements ArchiverInterface 'tar.bz2' => \Phar::TAR, ); + /** @var array */ protected static $compressFormats = array( 'tar.gz' => \Phar::GZ, 'tar.bz2' => \Phar::BZ2, diff --git a/src/Composer/Package/Archiver/ZipArchiver.php b/src/Composer/Package/Archiver/ZipArchiver.php index c0ce41d65..3be7ccc71 100644 --- a/src/Composer/Package/Archiver/ZipArchiver.php +++ b/src/Composer/Package/Archiver/ZipArchiver.php @@ -20,8 +20,9 @@ use Composer\Util\Filesystem; */ class ZipArchiver implements ArchiverInterface { + /** @var array */ protected static $formats = array( - 'zip' => 1, + 'zip' => true, ); /** diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 04a57f5bc..a104f4726 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -40,6 +40,7 @@ abstract class BasePackage implements PackageInterface const STABILITY_ALPHA = 15; const STABILITY_DEV = 20; + /** @var array */ public static $stabilities = array( 'stable' => self::STABILITY_STABLE, 'RC' => self::STABILITY_RC, diff --git a/src/Composer/Package/Comparer/Comparer.php b/src/Composer/Package/Comparer/Comparer.php index 652a94d28..be23bedf6 100644 --- a/src/Composer/Package/Comparer/Comparer.php +++ b/src/Composer/Package/Comparer/Comparer.php @@ -19,8 +19,11 @@ namespace Composer\Package\Comparer; */ class Comparer { + /** @var string Source directory */ private $source; + /** @var string Target directory */ private $update; + /** @var array{changed?: string[], removed?: string[], added?: string[]} */ private $changed; public function setSource($source) diff --git a/src/Composer/Package/CompletePackage.php b/src/Composer/Package/CompletePackage.php index dc0b115c3..b125fc142 100644 --- a/src/Composer/Package/CompletePackage.php +++ b/src/Composer/Package/CompletePackage.php @@ -19,17 +19,29 @@ namespace Composer\Package; */ class CompletePackage extends Package implements CompletePackageInterface { + /** @var mixed[] */ protected $repositories = array(); + /** @var string[] */ protected $license = array(); + /** @var string[] */ protected $keywords = array(); + /** @var array */ protected $authors = array(); - protected $description; - protected $homepage; + /** @var ?string */ + protected $description = null; + /** @var ?string */ + protected $homepage = null; + /** @var array Map of script name to array of handlers */ protected $scripts = array(); + /** @var array{issues?: string, forum?: string, wiki?: string, source?: string, email?: string, irc?: string, docs?: string, rss?: string, chat?: string} */ protected $support = array(); + /** @var array */ protected $funding = array(); + /** @var bool|string */ protected $abandoned = false; - protected $archiveName; + /** @var ?string */ + protected $archiveName = null; + /** @var string[] */ protected $archiveExcludes = array(); /** diff --git a/src/Composer/Package/CompletePackageInterface.php b/src/Composer/Package/CompletePackageInterface.php index 0d9425496..00e4a088e 100644 --- a/src/Composer/Package/CompletePackageInterface.php +++ b/src/Composer/Package/CompletePackageInterface.php @@ -22,7 +22,7 @@ interface CompletePackageInterface extends PackageInterface /** * Returns the scripts of this package * - * @return array array('script name' => array('listeners')) + * @return array Map of script name to array of handlers */ public function getScripts(); @@ -35,14 +35,14 @@ interface CompletePackageInterface extends PackageInterface /** * Returns an array of repositories * - * @return array Repositories + * @return mixed[] Repositories */ public function getRepositories(); /** * Set the repositories * - * @param array $repositories + * @param mixed[] $repositories * @return void */ public function setRepositories(array $repositories); @@ -80,7 +80,7 @@ interface CompletePackageInterface extends PackageInterface /** * Returns the package description * - * @return string + * @return ?string */ public function getDescription(); @@ -95,7 +95,7 @@ interface CompletePackageInterface extends PackageInterface /** * Returns the package homepage * - * @return string + * @return ?string */ public function getHomepage(); @@ -127,14 +127,14 @@ interface CompletePackageInterface extends PackageInterface /** * Returns the support information * - * @return array + * @return array{issues?: string, forum?: string, wiki?: string, source?: string, email?: string, irc?: string, docs?: string, rss?: string, chat?: string} */ public function getSupport(); /** * Set the support information * - * @param array $support + * @param array{issues?: string, forum?: string, wiki?: string, source?: string, email?: string, irc?: string, docs?: string, rss?: string, chat?: string} $support * @return void */ public function setSupport(array $support); @@ -144,14 +144,14 @@ interface CompletePackageInterface extends PackageInterface * * Each item will contain type and url keys * - * @return array + * @return array */ public function getFunding(); /** * Set the funding * - * @param array $funding + * @param array $funding * @return void */ public function setFunding(array $funding); @@ -179,7 +179,7 @@ interface CompletePackageInterface extends PackageInterface /** * Returns default base filename for archive * - * @return array + * @return ?string */ public function getArchiveName(); @@ -194,7 +194,7 @@ interface CompletePackageInterface extends PackageInterface /** * Returns a list of patterns to exclude from package archives * - * @return array + * @return string[] */ public function getArchiveExcludes(); diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 4367b9a3a..0e164b865 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -31,7 +31,9 @@ use Composer\Package\Version\VersionParser; */ class ArrayLoader implements LoaderInterface { + /** @var VersionParser */ protected $versionParser; + /** @var bool */ protected $loadOptions; public function __construct(VersionParser $parser = null, $loadOptions = false) diff --git a/src/Composer/Package/Loader/InvalidPackageException.php b/src/Composer/Package/Loader/InvalidPackageException.php index 2f0c845c6..1e9164dd6 100644 --- a/src/Composer/Package/Loader/InvalidPackageException.php +++ b/src/Composer/Package/Loader/InvalidPackageException.php @@ -17,8 +17,11 @@ namespace Composer\Package\Loader; */ class InvalidPackageException extends \Exception { + /** @var string[] */ private $errors; + /** @var string[] */ private $warnings; + /** @var mixed[] package config */ private $data; public function __construct(array $errors, array $warnings, array $data) diff --git a/src/Composer/Package/Loader/JsonLoader.php b/src/Composer/Package/Loader/JsonLoader.php index 66f75c034..9e9ae689e 100644 --- a/src/Composer/Package/Loader/JsonLoader.php +++ b/src/Composer/Package/Loader/JsonLoader.php @@ -21,6 +21,7 @@ use Composer\Package\CompleteAliasPackage; */ class JsonLoader { + /** @var LoaderInterface */ private $loader; public function __construct(LoaderInterface $loader) diff --git a/src/Composer/Package/Loader/LoaderInterface.php b/src/Composer/Package/Loader/LoaderInterface.php index 295ddf95b..9a89d68aa 100644 --- a/src/Composer/Package/Loader/LoaderInterface.php +++ b/src/Composer/Package/Loader/LoaderInterface.php @@ -12,6 +12,12 @@ namespace Composer\Package\Loader; +use Composer\Package\CompletePackageInterface; +use Composer\Package\CompletePackage; +use Composer\Package\CompleteAliasPackage; +use Composer\Package\RootAliasPackage; +use Composer\Package\RootPackage; + /** * Defines a loader that takes an array to create package instances * @@ -22,9 +28,14 @@ interface LoaderInterface /** * Converts a package from an array to a real instance * - * @param array $package Package config - * @param string $class Package class to use - * @return \Composer\Package\PackageInterface + * @template PackageClass of CompletePackageInterface + * + * @param mixed[] $config package data + * @param string $class FQCN to be instantiated + * + * @return CompletePackage|CompleteAliasPackage|RootPackage|RootAliasPackage + * + * @phpstan-param class-string $class */ - public function load(array $package, $class = 'Composer\Package\CompletePackage'); + public function load(array $config, $class = 'Composer\Package\CompletePackage'); } diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index f2e7ebf86..2089df17f 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -59,10 +59,11 @@ class RootPackageLoader extends ArrayLoader /** * @template PackageClass of RootPackage - * @param array $config package data - * @param class-string $class FQCN to be instantiated + * * @param string $cwd cwd of the root package to be used to guess the version if it is not provided * @return RootPackage|RootAliasPackage + * + * @phpstan-param class-string $class */ public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null) { @@ -183,6 +184,9 @@ class RootPackageLoader extends ArrayLoader return $package; } + /** + * @return array + */ private function extractAliases(array $requires, array $aliases) { foreach ($requires as $reqName => $reqVersion) { @@ -203,6 +207,7 @@ class RootPackageLoader extends ArrayLoader /** * @internal + * @return array */ public static function extractStabilityFlags(array $requires, $minimumStability, array $stabilityFlags) { @@ -259,6 +264,7 @@ class RootPackageLoader extends ArrayLoader /** * @internal + * @return array */ public static function extractReferences(array $requires, array $references) { diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 62fa84943..8b04a4df5 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -27,12 +27,19 @@ class ValidatingArrayLoader implements LoaderInterface const CHECK_UNBOUND_CONSTRAINTS = 1; const CHECK_STRICT_CONSTRAINTS = 2; + /** @var LoaderInterface */ private $loader; + /** @var VersionParser */ private $versionParser; + /** @var string[] */ private $errors; + /** @var string[] */ private $warnings; + /** @var mixed[] */ private $config; + /** @var bool */ private $strictName; + /** @var int One or more of self::CHECK_* constants */ private $flags; public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0) @@ -388,7 +395,7 @@ class ValidatingArrayLoader implements LoaderInterface } $package = $this->loader->load($this->config, $class); - $this->config = null; + $this->config = array(); return $package; } diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 2ab1e2052..49894ffc3 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -46,8 +46,10 @@ class Locker private $dumper; /** @var ProcessExecutor */ private $process; - private $lockDataCache; - private $virtualFileWritten; + /** @var mixed[]|null */ + private $lockDataCache = null; + /** @var bool */ + private $virtualFileWritten = false; /** * Initializes packages locker. diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index 2b3ccb1aa..7881978c1 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -34,7 +34,7 @@ class Package extends BasePackage protected $sourceUrl; /** @var ?string */ protected $sourceReference; - /** @var ?array */ + /** @var ?array */ protected $sourceMirrors; /** @var ?string */ protected $distType; @@ -44,7 +44,7 @@ class Package extends BasePackage protected $distReference; /** @var ?string */ protected $distSha1Checksum; - /** @var ?array */ + /** @var ?array */ protected $distMirrors; /** @var string */ protected $version; diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index c3df0fd63..cad79a8e0 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -55,6 +55,8 @@ interface PackageInterface * Allows the solver to set an id for this package to refer to it. * * @param int $id + * + * @return void */ public function setId($id); @@ -98,6 +100,8 @@ interface PackageInterface * * @param string $type source/dist * @phpstan-param 'source'|'dist'|null $type + * + * @return void */ public function setInstallationSource($type); @@ -140,12 +144,12 @@ interface PackageInterface /** * Returns the source mirrors of this package * - * @return ?array + * @return ?array */ public function getSourceMirrors(); /** - * @param ?array $mirrors + * @param ?array $mirrors * @return void */ public function setSourceMirrors($mirrors); @@ -188,12 +192,12 @@ interface PackageInterface /** * Returns the dist mirrors of this package * - * @return ?array + * @return ?array */ public function getDistMirrors(); /** - * @param ?array $mirrors + * @param ?array $mirrors * @return void */ public function setDistMirrors($mirrors); @@ -326,6 +330,8 @@ interface PackageInterface * Stores a reference to the repository that owns the package * * @param RepositoryInterface $repository + * + * @return void */ public function setRepository(RepositoryInterface $repository); @@ -386,6 +392,8 @@ interface PackageInterface /** * Configures the list of options to download package dist files * + * @param mixed[] $options + * * @return void */ public function setTransportOptions(array $options); diff --git a/src/Composer/Package/RootPackage.php b/src/Composer/Package/RootPackage.php index 945bfd17e..25f062056 100644 --- a/src/Composer/Package/RootPackage.php +++ b/src/Composer/Package/RootPackage.php @@ -21,11 +21,17 @@ class RootPackage extends CompletePackage implements RootPackageInterface { const DEFAULT_PRETTY_VERSION = '1.0.0+no-version-set'; + /** @var string */ protected $minimumStability = 'stable'; + /** @var bool */ protected $preferStable = false; + /** @var array Map of package name to stability constant */ protected $stabilityFlags = array(); + /** @var mixed[] */ protected $config = array(); + /** @var array Map of package name to reference/commit hash */ protected $references = array(); + /** @var array */ protected $aliases = array(); /** diff --git a/src/Composer/Package/RootPackageInterface.php b/src/Composer/Package/RootPackageInterface.php index ecd72e444..1092832dc 100644 --- a/src/Composer/Package/RootPackageInterface.php +++ b/src/Composer/Package/RootPackageInterface.php @@ -22,7 +22,7 @@ interface RootPackageInterface extends CompletePackageInterface /** * Returns a set of package names and their aliases * - * @return array + * @return array */ public function getAliases(); @@ -38,7 +38,7 @@ interface RootPackageInterface extends CompletePackageInterface * * array('foo/bar' => 'dev') * - * @return array + * @return array */ public function getStabilityFlags(); @@ -47,7 +47,7 @@ interface RootPackageInterface extends CompletePackageInterface * * array('foo/bar' => 'abcd1234') * - * @return array + * @return array */ public function getReferences(); @@ -61,7 +61,7 @@ interface RootPackageInterface extends CompletePackageInterface /** * Returns the root package's configuration * - * @return array + * @return mixed[] */ public function getConfig(); @@ -69,6 +69,8 @@ interface RootPackageInterface extends CompletePackageInterface * Set the required packages * * @param Link[] $requires A set of package links + * + * @return void */ public function setRequires(array $requires); @@ -76,6 +78,8 @@ interface RootPackageInterface extends CompletePackageInterface * Set the recommended packages * * @param Link[] $devRequires A set of package links + * + * @return void */ public function setDevRequires(array $devRequires); @@ -83,6 +87,8 @@ interface RootPackageInterface extends CompletePackageInterface * Set the conflicting packages * * @param Link[] $conflicts A set of package links + * + * @return void */ public function setConflicts(array $conflicts); @@ -90,6 +96,8 @@ interface RootPackageInterface extends CompletePackageInterface * Set the provided virtual packages * * @param Link[] $provides A set of package links + * + * @return void */ public function setProvides(array $provides); @@ -97,34 +105,44 @@ interface RootPackageInterface extends CompletePackageInterface * Set the packages this one replaces * * @param Link[] $replaces A set of package links + * + * @return void */ public function setReplaces(array $replaces); /** * Set the repositories * - * @param array $repositories + * @param mixed[] $repositories + * + * @return void */ public function setRepositories(array $repositories); /** * Set the autoload mapping * - * @param array $autoload Mapping of autoloading rules + * @param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $autoload Mapping of autoloading rules + * + * @return void */ public function setAutoload(array $autoload); /** * Set the dev autoload mapping * - * @param array $devAutoload Mapping of dev autoloading rules + * @param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $devAutoload Mapping of dev autoloading rules + * + * @return void */ public function setDevAutoload(array $devAutoload); /** * Set the stabilityFlags * - * @param array $stabilityFlags + * @param array $stabilityFlags + * + * @return void */ public function setStabilityFlags(array $stabilityFlags); @@ -132,6 +150,8 @@ interface RootPackageInterface extends CompletePackageInterface * Set the minimumStability * * @param string $minimumStability + * + * @return void */ public function setMinimumStability($minimumStability); @@ -139,39 +159,51 @@ interface RootPackageInterface extends CompletePackageInterface * Set the preferStable * * @param bool $preferStable + * + * @return void */ public function setPreferStable($preferStable); /** * Set the config * - * @param array $config + * @param mixed[] $config + * + * @return void */ public function setConfig(array $config); /** * Set the references * - * @param array $references + * @param array $references + * + * @return void */ public function setReferences(array $references); /** * Set the aliases * - * @param array $aliases + * @param array $aliases + * + * @return void */ public function setAliases(array $aliases); /** * Set the suggested packages * - * @param array $suggests A set of package names/comments + * @param array $suggests A set of package names/comments + * + * @return void */ public function setSuggests(array $suggests); /** - * @param array $extra + * @param mixed[] $extra + * + * @return void */ public function setExtra(array $extra); } diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index df3e9feb2..455162726 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -15,11 +15,13 @@ namespace Composer\Package\Version; use Composer\Repository\PlatformRepository; use Composer\Semver\VersionParser as SemverVersionParser; use Composer\Semver\Semver; +use Composer\Semver\Constraint\ConstraintInterface; class VersionParser extends SemverVersionParser { const DEFAULT_BRANCH_ALIAS = '9999999-dev'; + /** @var array Constraint parsing cache */ private static $constraints = array(); /** diff --git a/src/Composer/Package/Version/VersionSelector.php b/src/Composer/Package/Version/VersionSelector.php index ab5355d1a..641575488 100644 --- a/src/Composer/Package/Version/VersionSelector.php +++ b/src/Composer/Package/Version/VersionSelector.php @@ -21,6 +21,7 @@ use Composer\Package\Dumper\ArrayDumper; use Composer\Repository\RepositorySet; use Composer\Repository\PlatformRepository; use Composer\Semver\Constraint\Constraint; +use Composer\Semver\Constraint\ConstraintInterface; /** * Selects the best possible version for a package @@ -30,10 +31,13 @@ use Composer\Semver\Constraint\Constraint; */ class VersionSelector { + /** @var RepositorySet */ private $repositorySet; + /** @var array */ private $platformConstraints = array(); + /** @var VersionParser */ private $parser; /** diff --git a/src/Composer/Plugin/PluginInterface.php b/src/Composer/Plugin/PluginInterface.php index 305a784bc..c7c42c5f9 100644 --- a/src/Composer/Plugin/PluginInterface.php +++ b/src/Composer/Plugin/PluginInterface.php @@ -39,6 +39,8 @@ interface PluginInterface * * @param Composer $composer * @param IOInterface $io + * + * @return void */ public function activate(Composer $composer, IOInterface $io); @@ -51,6 +53,8 @@ interface PluginInterface * * @param Composer $composer * @param IOInterface $io + * + * @return void */ public function deactivate(Composer $composer, IOInterface $io); @@ -61,6 +65,8 @@ interface PluginInterface * * @param Composer $composer * @param IOInterface $io + * + * @return void */ public function uninstall(Composer $composer, IOInterface $io); } diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 75b3aabec..3310da516 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -91,9 +91,9 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito private $allowSslDowngrade = false; /** @var ?EventDispatcher */ private $eventDispatcher; - /** @var ?array */ + /** @var ?array> */ private $sourceMirrors; - /** @var ?array */ + /** @var ?array */ private $distMirrors; /** @var bool */ private $degradedMode = false; diff --git a/src/Composer/Repository/ConfigurableRepositoryInterface.php b/src/Composer/Repository/ConfigurableRepositoryInterface.php index ff202dc88..46a535830 100644 --- a/src/Composer/Repository/ConfigurableRepositoryInterface.php +++ b/src/Composer/Repository/ConfigurableRepositoryInterface.php @@ -19,5 +19,8 @@ namespace Composer\Repository; */ interface ConfigurableRepositoryInterface { + /** + * @return mixed[] + */ public function getRepoConfig(); } diff --git a/src/Composer/Repository/Vcs/PerforceDriver.php b/src/Composer/Repository/Vcs/PerforceDriver.php index 76249fd54..c6f9fc816 100644 --- a/src/Composer/Repository/Vcs/PerforceDriver.php +++ b/src/Composer/Repository/Vcs/PerforceDriver.php @@ -47,8 +47,6 @@ class PerforceDriver extends VcsDriver $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); - - return true; } private function initPerforce($repoConfig) diff --git a/src/Composer/Repository/Vcs/VcsDriverInterface.php b/src/Composer/Repository/Vcs/VcsDriverInterface.php index 22cb33007..cdddd022b 100644 --- a/src/Composer/Repository/Vcs/VcsDriverInterface.php +++ b/src/Composer/Repository/Vcs/VcsDriverInterface.php @@ -22,14 +22,16 @@ interface VcsDriverInterface { /** * Initializes the driver (git clone, svn checkout, fetch info etc) + * + * @return void */ public function initialize(); /** * Return the composer.json file information * - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array containing all infos from the composer.json file + * @param string $identifier Any identifier to a specific branch/tag/commit + * @return mixed[] containing all infos from the composer.json file */ public function getComposerInformation($identifier); @@ -60,26 +62,28 @@ interface VcsDriverInterface /** * Return list of branches in the repository * - * @return array Branch names as keys, identifiers as values + * @return array Branch names as keys, identifiers as values */ public function getBranches(); /** * Return list of tags in the repository * - * @return array Tag names as keys, identifiers as values + * @return array Tag names as keys, identifiers as values */ public function getTags(); /** - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array|null With type, url reference and shasum keys. + * @param string $identifier Any identifier to a specific branch/tag/commit + * + * @return array{type: string, url: string, reference: string, shasum: string}|null */ public function getDist($identifier); /** - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array With type, url and reference keys. + * @param string $identifier Any identifier to a specific branch/tag/commit + * + * @return array{type: string, url: string, reference: string} */ public function getSource($identifier); @@ -101,6 +105,8 @@ interface VcsDriverInterface /** * Performs any cleanup necessary as the driver is not longer needed + * + * @return void */ public function cleanup(); diff --git a/src/Composer/Repository/VersionCacheInterface.php b/src/Composer/Repository/VersionCacheInterface.php index 3b05fb8ff..80de9833c 100644 --- a/src/Composer/Repository/VersionCacheInterface.php +++ b/src/Composer/Repository/VersionCacheInterface.php @@ -15,9 +15,9 @@ namespace Composer\Repository; interface VersionCacheInterface { /** - * @param string $version - * @param string $identifier - * @return array|null|false Package version data if found, false to indicate the identifier is known but has no package, null for an unknown identifier + * @param string $version + * @param string $identifier + * @return mixed[]|null|false Package version data if found, false to indicate the identifier is known but has no package, null for an unknown identifier */ public function getVersionPackage($version, $identifier); } diff --git a/src/Composer/Repository/WritableRepositoryInterface.php b/src/Composer/Repository/WritableRepositoryInterface.php index f1d8b9e95..376af2108 100644 --- a/src/Composer/Repository/WritableRepositoryInterface.php +++ b/src/Composer/Repository/WritableRepositoryInterface.php @@ -26,6 +26,7 @@ interface WritableRepositoryInterface extends RepositoryInterface * Writes repository (f.e. to the disc). * * @param bool $devMode Whether dev requirements were included or not in this installation + * @return void */ public function write($devMode, InstallationManager $installationManager); @@ -33,6 +34,7 @@ interface WritableRepositoryInterface extends RepositoryInterface * Adds package to the repository. * * @param PackageInterface $package package instance + * @return void */ public function addPackage(PackageInterface $package); @@ -40,6 +42,7 @@ interface WritableRepositoryInterface extends RepositoryInterface * Removes package from the repository. * * @param PackageInterface $package package instance + * @return void */ public function removePackage(PackageInterface $package); @@ -52,11 +55,14 @@ interface WritableRepositoryInterface extends RepositoryInterface /** * Forces a reload of all packages. + * + * @return void */ public function reload(); /** * @param string[] $devPackageNames + * @return void */ public function setDevPackageNames(array $devPackageNames); diff --git a/src/Composer/Util/AuthHelper.php b/src/Composer/Util/AuthHelper.php index b8dc44407..4c012ba92 100644 --- a/src/Composer/Util/AuthHelper.php +++ b/src/Composer/Util/AuthHelper.php @@ -120,8 +120,11 @@ class AuthHelper $message = "\n".'Could not fetch '.$url.', enter your ' . $origin . ' credentials ' .($statusCode === 401 ? 'to access private repos' : 'to go over the API rate limit'); $gitLabUtil = new GitLab($this->io, $this->config, null); - if ($this->io->hasAuthentication($origin) && ($auth = $this->io->getAuthentication($origin)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) { - throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode); + if ($this->io->hasAuthentication($origin)) { + $auth = $this->io->getAuthentication($origin); + if (in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) { + throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode); + } } if (!$gitLabUtil->authorizeOAuth($origin) diff --git a/src/Composer/Util/Http/ProxyManager.php b/src/Composer/Util/Http/ProxyManager.php index 586b08e83..659c715c8 100644 --- a/src/Composer/Util/Http/ProxyManager.php +++ b/src/Composer/Util/Http/ProxyManager.php @@ -22,13 +22,20 @@ use Composer\Util\Url; */ class ProxyManager { - private $error; + /** @var ?string */ + private $error = null; + /** @var array{http: ?string, https: ?string} */ private $fullProxy; + /** @var array{http: ?string, https: ?string} */ private $safeProxy; + /** @var array{http: array{options: mixed[]|null}, https: array{options: mixed[]|null}} */ private $streams; + /** @var bool */ private $hasProxy; - private $info; - private $lastProxy; + /** @var ?string */ + private $info = null; + /** @var ?string */ + private $lastProxy = null; /** @var ?NoProxyPattern */ private $noProxyHandler = null; @@ -154,7 +161,7 @@ class ProxyManager * Sets initial data * * @param string $url Proxy url - * @param string $scheme Environment variable scheme + * @param 'http'|'https' $scheme Environment variable scheme */ private function setData($url, $scheme) { diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index ea2b1152c..e316661fd 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -20,23 +20,39 @@ use Symfony\Component\Process\Process; */ class Perforce { + /** @var string */ protected $path; + /** @var ?string */ protected $p4Depot; + /** @var string */ protected $p4Client; + /** @var ?string */ protected $p4User; + /** @var ?string */ protected $p4Password; + /** @var int */ protected $p4Port; + /** @var string */ protected $p4Stream; + /** @var string */ protected $p4ClientSpec; + /** @var ?string */ protected $p4DepotType; + /** @var ?string */ protected $p4Branch; + /** @var ProcessExecutor */ protected $process; + /** @var string */ protected $uniquePerforceClientName; + /** @var bool */ protected $windowsFlag; + /** @var string */ protected $commandResult; + /** @var IOInterface */ protected $io; + /** @var Filesystem */ protected $filesystem; public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)