1
0
Fork 0

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

pull/9765/head
Jordi Boggiano 2021-03-10 10:52:16 +01:00
parent b40b93bc7d
commit 5d6f9b2528
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
11 changed files with 36 additions and 36 deletions

View File

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

View File

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

View File

@ -23,7 +23,7 @@ use Composer\Repository\PlatformRepository;
abstract class BasePackage implements PackageInterface 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( public static $supportedLinkTypes = array(
'require' => array('description' => 'requires', 'method' => Link::TYPE_REQUIRE), 'require' => array('description' => 'requires', 'method' => Link::TYPE_REQUIRE),

View File

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

View File

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

View File

@ -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 * 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 * @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 * @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[] $names The package name(s) to check for stability flags
* @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev' * @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev'
* @return bool true if any package name is acceptable * @return bool true if any package name is acceptable

View File

@ -109,7 +109,7 @@ class PrePoolCreateEvent extends Event
/** /**
* @return array[] of package => version => [alias, alias_normalized] * @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() public function getRootAliases()
{ {

View File

@ -87,7 +87,7 @@ interface RepositoryInterface extends \Countable
* @param string $type The type of package to search for. Defaults to all types of packages * @param string $type The type of package to search for. Defaults to all types of packages
* *
* @return array[] an array of array('name' => '...', 'description' => '...') * @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); 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 * @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' => '...') * @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); public function getProviders($packageName);

View File

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

View File

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

View File

@ -30,7 +30,7 @@ final class StreamContextFactory
* Creates a context supporting HTTP proxies * Creates a context supporting HTTP proxies
* *
* @param string $url URL the context is to be used for * @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 $defaultOptions Options to merge with the default
* @param array $defaultParams Parameters to specify on the context * @param array $defaultParams Parameters to specify on the context
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled * @throws \RuntimeException if https proxy required and OpenSSL uninstalled
@ -59,7 +59,7 @@ final class StreamContextFactory
* @param string $url * @param string $url
* @param array $options * @param array $options
* @param bool $forCurl When true, will not add proxy values as these are handled separately * @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 * @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)