mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
Add return types to all code which is not being extended by open source packages
This commit is contained in:
parent
137ebddc25
commit
eda9014bef
121 changed files with 606 additions and 603 deletions
|
@ -127,7 +127,7 @@ class RepositorySet
|
|||
* @return ConstraintInterface[] an array of package name => constraint from the root package, platform requirements excluded
|
||||
* @phpstan-return array<string, ConstraintInterface>
|
||||
*/
|
||||
public function getRootRequires()
|
||||
public function getRootRequires(): array
|
||||
{
|
||||
return $this->rootRequires;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class RepositorySet
|
|||
* @param int $flags any of the ALLOW_* constants from this class to tweak what is returned
|
||||
* @return BasePackage[]
|
||||
*/
|
||||
public function findPackages($name, ConstraintInterface $constraint = null, $flags = 0)
|
||||
public function findPackages($name, ConstraintInterface $constraint = null, $flags = 0): array
|
||||
{
|
||||
$ignoreStability = ($flags & self::ALLOW_UNACCEPTABLE_STABILITIES) !== 0;
|
||||
$loadFromAllRepos = ($flags & self::ALLOW_SHADOWED_REPOSITORIES) !== 0;
|
||||
|
@ -216,7 +216,7 @@ class RepositorySet
|
|||
* @return array[] an array with the provider name as key and value of array('name' => '...', 'description' => '...', 'type' => '...')
|
||||
* @phpstan-return array<string, array{name: string, description: string, type: string}>
|
||||
*/
|
||||
public function getProviders($packageName)
|
||||
public function getProviders($packageName): array
|
||||
{
|
||||
$providers = array();
|
||||
foreach ($this->repositories as $repository) {
|
||||
|
@ -235,7 +235,7 @@ class RepositorySet
|
|||
* @param string $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev'
|
||||
* @return bool
|
||||
*/
|
||||
public function isPackageAcceptable($names, $stability)
|
||||
public function isPackageAcceptable($names, $stability): bool
|
||||
{
|
||||
return StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $names, $stability);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ class RepositorySet
|
|||
*
|
||||
* @return Pool
|
||||
*/
|
||||
public function createPool(Request $request, IOInterface $io, EventDispatcher $eventDispatcher = null, PoolOptimizer $poolOptimizer = null)
|
||||
public function createPool(Request $request, IOInterface $io, EventDispatcher $eventDispatcher = null, PoolOptimizer $poolOptimizer = null): Pool
|
||||
{
|
||||
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer);
|
||||
|
||||
|
@ -265,7 +265,7 @@ class RepositorySet
|
|||
*
|
||||
* @return Pool
|
||||
*/
|
||||
public function createPoolWithAllPackages()
|
||||
public function createPoolWithAllPackages(): Pool
|
||||
{
|
||||
foreach ($this->repositories as $repo) {
|
||||
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
|
||||
|
@ -304,7 +304,7 @@ class RepositorySet
|
|||
*
|
||||
* @return Pool
|
||||
*/
|
||||
public function createPoolForPackage($packageName, LockArrayRepository $lockedRepo = null)
|
||||
public function createPoolForPackage($packageName, LockArrayRepository $lockedRepo = null): Pool
|
||||
{
|
||||
// TODO unify this with above in some simpler version without "request"?
|
||||
return $this->createPoolForPackages(array($packageName), $lockedRepo);
|
||||
|
@ -315,7 +315,7 @@ class RepositorySet
|
|||
*
|
||||
* @return Pool
|
||||
*/
|
||||
public function createPoolForPackages($packageNames, LockArrayRepository $lockedRepo = null)
|
||||
public function createPoolForPackages($packageNames, LockArrayRepository $lockedRepo = null): Pool
|
||||
{
|
||||
$request = new Request($lockedRepo);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue