Переглянути джерело

use more precise phpstan/psam return-types (#8744)

Markus Staab 5 роки тому
батько
коміт
593d5abf27

+ 3 - 0
src/Composer/Package/Archiver/ArchiveManager.php

@@ -28,6 +28,9 @@ class ArchiveManager
     protected $downloadManager;
     protected $loop;
 
+    /**
+     * @var ArchiverInterface[]
+     */
     protected $archivers = array();
 
     /**

+ 7 - 4
src/Composer/Package/PackageInterface.php

@@ -47,7 +47,7 @@ interface PackageInterface
      *
      * @param bool $provides Whether provided names should be included
      *
-     * @return array An array of strings referring to this package
+     * @return string[] An array of strings referring to this package
      */
     public function getNames($provides = true);
 
@@ -159,7 +159,7 @@ interface PackageInterface
     /**
      * Returns the urls of the distribution archive of this version, including mirrors
      *
-     * @return array
+     * @return string[]
      */
     public function getDistUrls();
 
@@ -270,6 +270,7 @@ interface PackageInterface
      * combination with this package.
      *
      * @return array An array of package suggestions with descriptions
+     * @psalm-return array<string, string>
      */
     public function getSuggests();
 
@@ -282,6 +283,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>, file?: list<string>}
      */
     public function getAutoload();
 
@@ -294,6 +296,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>, file?: list<string>}
      */
     public function getDevAutoload();
 
@@ -301,7 +304,7 @@ interface PackageInterface
      * Returns a list of directories which should get added to PHP's
      * include path.
      *
-     * @return array
+     * @return string[]
      */
     public function getIncludePaths();
 
@@ -322,7 +325,7 @@ interface PackageInterface
     /**
      * Returns the package binaries
      *
-     * @return array
+     * @return string[]
      */
     public function getBinaries();
 

+ 4 - 0
src/Composer/Repository/RepositoryInterface.php

@@ -69,7 +69,9 @@ interface RepositoryInterface extends \Countable
      * @param ConstraintInterface[] $packageNameMap package names pointing to constraints
      * @param array $acceptableStabilities
      * @param array $stabilityFlags
+     * 
      * @return array [namesFound => string[], packages => PackageInterface[]]
+     * @psalm-return array{namesFound: string[], packages: PackageInterface[]}
      */
     public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags);
 
@@ -81,6 +83,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}>
      */
     public function search($query, $mode = 0, $type = null);
 
@@ -92,6 +95,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}>
      */
     public function getProviders($packageName);