diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index 33addc7c0..a0be96f3d 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -20,6 +20,9 @@ use Composer\Util\ComposerMirror; * Core package definitions that are needed to resolve dependencies and install packages * * @author Nils Adermann + * + * @phpstan-import-type AutoloadRules from PackageInterface + * @phpstan-import-type DevAutoloadRules from PackageInterface */ class Package extends BasePackage { @@ -79,9 +82,15 @@ class Package extends BasePackage protected $devRequires = array(); /** @var array */ protected $suggests = array(); - /** @var array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} */ + /** + * @var array + * @phpstan-var AutoloadRules + */ protected $autoload = array(); - /** @var array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} */ + /** + * @var array + * @phpstan-var DevAutoloadRules + */ protected $devAutoload = array(); /** @var string[] */ protected $includePaths = array(); @@ -598,7 +607,7 @@ class Package extends BasePackage * * @return void * - * @phpstan-param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $autoload + * @phpstan-param AutoloadRules $autoload */ public function setAutoload(array $autoload) { @@ -620,7 +629,7 @@ class Package extends BasePackage * * @return void * - * @phpstan-param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $devAutoload + * @phpstan-param DevAutoloadRules $devAutoload */ public function setDevAutoload(array $devAutoload) { diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index 4dd4d52e6..a566298c8 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -18,6 +18,9 @@ use Composer\Repository\RepositoryInterface; * Defines the essential information a package has that is used during solving/installation * * @author Jordi Boggiano + * + * @phpstan-type AutoloadRules array{psr-0?: array, psr-4?: array, classmap?: list, files?: list, exclude-from-classmap?: list} + * @phpstan-type DevAutoloadRules array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} */ interface PackageInterface { @@ -303,7 +306,7 @@ interface PackageInterface * directories for autoloading using the type specified. * * @return array Mapping of autoloading rules - * @phpstan-return array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} + * @phpstan-return AutoloadRules */ public function getAutoload(); @@ -316,7 +319,7 @@ interface PackageInterface * directories for autoloading using the type specified. * * @return array Mapping of dev autoloading rules - * @phpstan-return array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} + * @phpstan-return DevAutoloadRules */ public function getDevAutoload(); diff --git a/src/Composer/Package/RootPackageInterface.php b/src/Composer/Package/RootPackageInterface.php index 1092832dc..32cc44750 100644 --- a/src/Composer/Package/RootPackageInterface.php +++ b/src/Composer/Package/RootPackageInterface.php @@ -16,6 +16,9 @@ namespace Composer\Package; * Defines additional fields that are only needed for the root package * * @author Jordi Boggiano + * + * @phpstan-import-type AutoloadRules from PackageInterface + * @phpstan-import-type DevAutoloadRules from PackageInterface */ interface RootPackageInterface extends CompletePackageInterface { @@ -122,7 +125,8 @@ interface RootPackageInterface extends CompletePackageInterface /** * Set the autoload mapping * - * @param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $autoload Mapping of autoloading rules + * @param array $autoload Mapping of autoloading rules + * @phpstan-param AutoloadRules $autoload * * @return void */ @@ -131,7 +135,8 @@ interface RootPackageInterface extends CompletePackageInterface /** * Set the dev autoload mapping * - * @param array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} $devAutoload Mapping of dev autoloading rules + * @param array $devAutoload Mapping of dev autoloading rules + * @phpstan-param DevAutoloadRules $devAutoload * * @return void */