Prefer @phpstan- annotations as that is what we run against

main
Jordi Boggiano 3 years ago
parent b40b93bc7d
commit 5d6f9b2528
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -46,12 +46,12 @@ class PoolBuilder
private $stabilityFlags;
/**
* @var array[]
* @psalm-var array<string, array<string, array{alias: string, alias_normalized: string}>>
* @phpstan-var array<string, array<string, array{alias: string, alias_normalized: string}>>
*/
private $rootAliases;
/**
* @var string[]
* @psalm-var array<string, string>
* @phpstan-var array<string, string>
*/
private $rootReferences;
/**
@ -64,22 +64,22 @@ class PoolBuilder
private $io;
/**
* @var array[]
* @psalm-var array<string, AliasPackage[]>
* @phpstan-var array<string, AliasPackage[]>
*/
private $aliasMap = array();
/**
* @var ConstraintInterface[]
* @psalm-var array<string, ConstraintInterface>
* @phpstan-var array<string, ConstraintInterface>
*/
private $packagesToLoad = array();
/**
* @var ConstraintInterface[]
* @psalm-var array<string, ConstraintInterface>
* @phpstan-var array<string, ConstraintInterface>
*/
private $loadedPackages = array();
/**
* @var array[]
* @psalm-var array<int, array<string, array<string, PackageInterface>>>
* @phpstan-var array<int, array<string, array<string, PackageInterface>>>
*/
private $loadedPerRepo = array();
/**
@ -88,7 +88,7 @@ class PoolBuilder
private $packages = array();
/**
* @var PackageInterface[]
* @psalm-var list<PackageInterface>
* @phpstan-var list<PackageInterface>
*/
private $unacceptableFixedOrLockedPackages = array();
private $updateAllowList = array();
@ -105,7 +105,7 @@ class PoolBuilder
private $maxExtendedReqs = array();
/**
* @var array
* @psalm-var array<string, bool>
* @phpstan-var array<string, bool>
*/
private $updateAllowWarned = array();
@ -113,13 +113,13 @@ class PoolBuilder
/**
* @param int[] $acceptableStabilities array of stability => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @phpstan-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @phpstan-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @param array[] $rootAliases
* @psalm-param array<string, array<string, array{alias: string, alias_normalized: string}>> $rootAliases
* @phpstan-param array<string, array<string, array{alias: string, alias_normalized: string}>> $rootAliases
* @param string[] $rootReferences an array of package name => source reference
* @psalm-param array<string, string> $rootReferences
* @phpstan-param array<string, string> $rootReferences
*/
public function __construct(array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, IOInterface $io, EventDispatcher $eventDispatcher = null)
{

@ -29,12 +29,12 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
{
/**
* @var bool[]
* @psalm-var array<string, bool>
* @phpstan-var array<string, bool>
*/
private $hasStashedChanges = array();
/**
* @var bool[]
* @psalm-var array<string, bool>
* @phpstan-var array<string, bool>
*/
private $hasDiscardedChanges = array();
/**
@ -43,7 +43,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
private $gitUtil;
/**
* @var array
* @psalm-var array<int, array<string, bool>>
* @phpstan-var array<int, array<string, bool>>
*/
private $cachedPackages = array();

@ -23,7 +23,7 @@ use Composer\Repository\PlatformRepository;
abstract class BasePackage implements PackageInterface
{
/**
* @psalm-var array<string, array{description: string, method: Link::TYPE_*}>
* @phpstan-var array<string, array{description: string, method: Link::TYPE_*}>
*/
public static $supportedLinkTypes = array(
'require' => array('description' => 'requires', 'method' => Link::TYPE_REQUIRE),

@ -63,7 +63,7 @@ class Link
/**
* @var string
* @psalm-var self::TYPE_* $description
* @phpstan-var self::TYPE_* $description
*/
protected $description;

@ -219,7 +219,7 @@ interface PackageInterface
* @param int $displayMode One of the DISPLAY_ constants on this interface determining display of references
* @return string version
*
* @psalm-param self::DISPLAY_SOURCE_REF_IF_DEV|self::DISPLAY_SOURCE_REF|self::DISPLAY_DIST_REF $displayMode
* @phpstan-param self::DISPLAY_SOURCE_REF_IF_DEV|self::DISPLAY_SOURCE_REF|self::DISPLAY_DIST_REF $displayMode
*/
public function getFullPrettyVersion($truncate = true, $displayMode = self::DISPLAY_SOURCE_REF_IF_DEV);
@ -282,7 +282,7 @@ interface PackageInterface
* combination with this package.
*
* @return array An array of package suggestions with descriptions
* @psalm-return array<string, string>
* @phpstan-return array<string, string>
*/
public function getSuggests();
@ -295,7 +295,7 @@ interface PackageInterface
* directories for autoloading using the type specified.
*
* @return array Mapping of autoloading rules
* @psalm-return array{psr-0?: array<string, string>, psr-4?: array<string, string>, classmap?: list<string>, files?: list<string>}
* @phpstan-return array{psr-0?: array<string, string>, psr-4?: array<string, string>, classmap?: list<string>, files?: list<string>}
*/
public function getAutoload();
@ -308,7 +308,7 @@ interface PackageInterface
* directories for autoloading using the type specified.
*
* @return array Mapping of dev autoloading rules
* @psalm-return array{psr-0?: array<string, string>, psr-4?: array<string, string>, classmap?: list<string>, files?: list<string>}
* @phpstan-return array{psr-0?: array<string, string>, psr-4?: array<string, string>, classmap?: list<string>, files?: list<string>}
*/
public function getDevAutoload();

@ -23,9 +23,9 @@ class StabilityFilter
* Checks if any of the provided package names in the given stability match the configured acceptable stability and flags
*
* @param int[] $acceptableStabilities array of stability => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @phpstan-param array<string, BasePackage::STABILITY_*> $acceptableStabilities
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @phpstan-param array<string, BasePackage::STABILITY_*> $stabilityFlags
* @param string[] $names The package name(s) to check for stability flags
* @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev'
* @return bool true if any package name is acceptable

@ -109,7 +109,7 @@ class PrePoolCreateEvent extends Event
/**
* @return array[] of package => version => [alias, alias_normalized]
* @psalm-return array<string, array<string, array{alias: string, alias_normalized: string}>>
* @phpstan-return array<string, array<string, array{alias: string, alias_normalized: string}>>
*/
public function getRootAliases()
{

@ -87,7 +87,7 @@ interface RepositoryInterface extends \Countable
* @param string $type The type of package to search for. Defaults to all types of packages
*
* @return array[] an array of array('name' => '...', 'description' => '...')
* @psalm-return list<array{name: string, description: string}>
* @phpstan-return list<array{name: string, description: string}>
*/
public function search($query, $mode = 0, $type = null);
@ -99,7 +99,7 @@ interface RepositoryInterface extends \Countable
* @param string $packageName package name which must be provided
*
* @return array[] an array with the provider name as key and value of array('name' => '...', 'description' => '...', 'type' => '...')
* @psalm-return array<string, array{name: string, description: string, type: string}>
* @phpstan-return array<string, array{name: string, description: string, type: string}>
*/
public function getProviders($packageName);

@ -41,13 +41,13 @@ class RepositorySet
/**
* @var array[]
* @psalm-var array<string, array<string, array{alias: string, alias_normalized: string}>>
* @phpstan-var array<string, array<string, array{alias: string, alias_normalized: string}>>
*/
private $rootAliases;
/**
* @var string[]
* @psalm-var array<string, string>
* @phpstan-var array<string, string>
*/
private $rootReferences;
@ -56,13 +56,13 @@ class RepositorySet
/**
* @var int[] array of stability => BasePackage::STABILITY_* value
* @psalm-var array<string, int>
* @phpstan-var array<string, int>
*/
private $acceptableStabilities;
/**
* @var int[] array of package name => BasePackage::STABILITY_* value
* @psalm-var array<string, int>
* @phpstan-var array<string, int>
*/
private $stabilityFlags;
@ -80,11 +80,11 @@ class RepositorySet
*
* @param string $minimumStability
* @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value
* @psalm-param array<string, int> $stabilityFlags
* @phpstan-param array<string, int> $stabilityFlags
* @param array[] $rootAliases
* @psalm-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
* @param string[] $rootReferences an array of package name => source reference
* @psalm-param array<string, string> $rootReferences
* @phpstan-param array<string, string> $rootReferences
*/
public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $rootAliases = array(), array $rootReferences = array(), array $rootRequires = array())
{

@ -38,7 +38,7 @@ class ProcessExecutor
protected $io;
/**
* @psalm-var array<int, array<string, mixed>>
* @phpstan-var array<int, array<string, mixed>>
*/
private $jobs = array();
private $runningJobs = 0;

@ -30,7 +30,7 @@ final class StreamContextFactory
* Creates a context supporting HTTP proxies
*
* @param string $url URL the context is to be used for
* @psalm-param array{http?: array{follow_location?: int, max_redirects?: int, header?: string|array<string, string|int>}} $defaultOptions
* @phpstan-param array{http?: array{follow_location?: int, max_redirects?: int, header?: string|array<string, string|int>}} $defaultOptions
* @param array $defaultOptions Options to merge with the default
* @param array $defaultParams Parameters to specify on the context
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled
@ -59,7 +59,7 @@ final class StreamContextFactory
* @param string $url
* @param array $options
* @param bool $forCurl When true, will not add proxy values as these are handled separately
* @psalm-return array{http:{header: string[], proxy?: string, request_fulluri: bool}, ssl: array}
* @phpstan-return array{http:{header: string[], proxy?: string, request_fulluri: bool}, ssl: array}
* @return array formatted as a stream context array
*/
public static function initOptions($url, array $options, $forCurl = false)

Loading…
Cancel
Save