Add some docblocks
parent
1dd2bc6f02
commit
97fe881af4
|
@ -139,6 +139,9 @@ class AutoloadGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
|
public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
|
||||||
{
|
{
|
||||||
if ($this->classMapAuthoritative) {
|
if ($this->classMapAuthoritative) {
|
||||||
|
@ -406,7 +409,11 @@ EOF;
|
||||||
return count($classMap);
|
return count($classMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
|
/**
|
||||||
|
* @param ?array<int, string> $excluded
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
private function addClassMapCode(Filesystem $filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
|
||||||
{
|
{
|
||||||
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
|
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
|
||||||
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
|
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
|
||||||
|
@ -421,7 +428,8 @@ EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ?array $excluded
|
* @param ?array<int, string> $excluded
|
||||||
|
* @return array<class-string, string>
|
||||||
*/
|
*/
|
||||||
private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
|
private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
|
||||||
{
|
{
|
||||||
|
@ -450,6 +458,7 @@ EOF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RootPackageInterface $rootPackage
|
* @param RootPackageInterface $rootPackage
|
||||||
|
* @return array<int, array{0: PackageInterface, 1: string}>
|
||||||
*/
|
*/
|
||||||
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
|
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
|
||||||
{
|
{
|
||||||
|
@ -472,8 +481,6 @@ EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PackageInterface $package
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException Throws an exception, if the package has illegal settings.
|
* @throws \InvalidArgumentException Throws an exception, if the package has illegal settings.
|
||||||
*/
|
*/
|
||||||
protected function validatePackage(PackageInterface $package)
|
protected function validatePackage(PackageInterface $package)
|
||||||
|
@ -500,6 +507,8 @@ EOF;
|
||||||
* @param RootPackageInterface $rootPackage root package instance
|
* @param RootPackageInterface $rootPackage root package instance
|
||||||
* @param bool|string[] $filteredDevPackages If an array, the list of packages that must be removed. If bool, whether to filter out require-dev packages
|
* @param bool|string[] $filteredDevPackages If an array, the list of packages that must be removed. If bool, whether to filter out require-dev packages
|
||||||
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, array{0: PackageInterface, 1: string}> $packageMap
|
||||||
*/
|
*/
|
||||||
public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
|
public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
|
||||||
{
|
{
|
||||||
|
@ -574,6 +583,15 @@ EOF;
|
||||||
return $loader;
|
return $loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $basePath
|
||||||
|
* @param string $vendorPath
|
||||||
|
* @param string $vendorPathCode
|
||||||
|
* @param string $appBaseDirCode
|
||||||
|
* @return ?string
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, array{0: PackageInterface, 1: string}> $packageMap
|
||||||
|
*/
|
||||||
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
||||||
{
|
{
|
||||||
$includePaths = array();
|
$includePaths = array();
|
||||||
|
@ -592,7 +610,7 @@ EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$includePaths) {
|
if (!$includePaths) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$includePathsCode = '';
|
$includePathsCode = '';
|
||||||
|
@ -614,6 +632,14 @@ $includePathsCode);
|
||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $files
|
||||||
|
* @param string $basePath
|
||||||
|
* @param string $vendorPath
|
||||||
|
* @param string $vendorPathCode
|
||||||
|
* @param string $appBaseDirCode
|
||||||
|
* @return ?string
|
||||||
|
*/
|
||||||
protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
|
||||||
{
|
{
|
||||||
$filesCode = '';
|
$filesCode = '';
|
||||||
|
@ -623,7 +649,7 @@ EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$filesCode) {
|
if (!$filesCode) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
|
@ -640,6 +666,12 @@ $filesCode);
|
||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $basePath
|
||||||
|
* @param string $vendorPath
|
||||||
|
* @param string $path
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
|
protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
|
||||||
{
|
{
|
||||||
if (!$filesystem->isAbsolutePath($path)) {
|
if (!$filesystem->isAbsolutePath($path)) {
|
||||||
|
@ -670,6 +702,13 @@ EOF;
|
||||||
return $baseDir . var_export($path, true);
|
return $baseDir . var_export($path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $checkPlatform
|
||||||
|
* @param string[] $devPackageNames
|
||||||
|
* @return ?string
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, array{0: PackageInterface, 1: string}> $packageMap
|
||||||
|
*/
|
||||||
protected function getPlatformCheck(array $packageMap, array $ignorePlatformReqs, $checkPlatform, array $devPackageNames)
|
protected function getPlatformCheck(array $packageMap, array $ignorePlatformReqs, $checkPlatform, array $devPackageNames)
|
||||||
{
|
{
|
||||||
$lowestPhpVersion = Bound::zero();
|
$lowestPhpVersion = Bound::zero();
|
||||||
|
@ -822,6 +861,11 @@ if (\$issues) {
|
||||||
PLATFORM_CHECK;
|
PLATFORM_CHECK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $vendorPathToTargetDirCode
|
||||||
|
* @param string $suffix
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
|
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
|
||||||
{
|
{
|
||||||
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
||||||
|
@ -843,6 +887,9 @@ return ComposerAutoloaderInit$suffix::getLoader();
|
||||||
AUTOLOAD;
|
AUTOLOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion, $checkPlatform)
|
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion, $checkPlatform)
|
||||||
{
|
{
|
||||||
$file = <<<HEADER
|
$file = <<<HEADER
|
||||||
|
@ -1018,6 +1065,9 @@ FOOTER;
|
||||||
FOOTER;
|
FOOTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
|
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
|
||||||
{
|
{
|
||||||
$staticPhpVersion = 50600;
|
$staticPhpVersion = 50600;
|
||||||
|
@ -1113,6 +1163,9 @@ $initializer
|
||||||
INITIALIZER;
|
INITIALIZER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, string>|array<string, array<string>>|array<string, string>
|
||||||
|
*/
|
||||||
protected function parseAutoloadsType(array $packageMap, $type, RootPackageInterface $rootPackage)
|
protected function parseAutoloadsType(array $packageMap, $type, RootPackageInterface $rootPackage)
|
||||||
{
|
{
|
||||||
$autoloads = array();
|
$autoloads = array();
|
||||||
|
@ -1195,6 +1248,10 @@ INITIALIZER;
|
||||||
return $autoloads;
|
return $autoloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $path
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getFileIdentifier(PackageInterface $package, $path)
|
protected function getFileIdentifier(PackageInterface $package, $path)
|
||||||
{
|
{
|
||||||
return md5($package->getName() . ':' . $path);
|
return md5($package->getName() . ':' . $path);
|
||||||
|
@ -1205,7 +1262,9 @@ INITIALIZER;
|
||||||
*
|
*
|
||||||
* @param array $packageMap
|
* @param array $packageMap
|
||||||
* @param RootPackageInterface $rootPackage
|
* @param RootPackageInterface $rootPackage
|
||||||
* @return array
|
* @return array<int, array{0: PackageInterface, 1: string}>
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, array{0: PackageInterface, 1: string}> $packageMap
|
||||||
*/
|
*/
|
||||||
protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
|
protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
|
||||||
{
|
{
|
||||||
|
@ -1259,7 +1318,9 @@ INITIALIZER;
|
||||||
* Packages of equal weight retain the original order
|
* Packages of equal weight retain the original order
|
||||||
*
|
*
|
||||||
* @param array $packageMap
|
* @param array $packageMap
|
||||||
* @return array
|
* @return array<int, array{0: PackageInterface, 1: string}>
|
||||||
|
*
|
||||||
|
* @phpstan-param array<int, array{0: PackageInterface, 1: string}> $packageMap
|
||||||
*/
|
*/
|
||||||
protected function sortPackageMap(array $packageMap)
|
protected function sortPackageMap(array $packageMap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,13 @@ use Symfony\Component\Process\Process;
|
||||||
*/
|
*/
|
||||||
class AllFunctionalTest extends TestCase
|
class AllFunctionalTest extends TestCase
|
||||||
{
|
{
|
||||||
|
/** @var string|false */
|
||||||
protected $oldcwd;
|
protected $oldcwd;
|
||||||
protected $oldenv;
|
/** @var ?string */
|
||||||
protected $oldenvCache;
|
|
||||||
protected $testDir;
|
protected $testDir;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
private static $pharPath;
|
private static $pharPath;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
|
@ -36,7 +39,9 @@ class AllFunctionalTest extends TestCase
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
|
if ($this->oldcwd) {
|
||||||
chdir($this->oldcwd);
|
chdir($this->oldcwd);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->testDir) {
|
if ($this->testDir) {
|
||||||
$fs = new Filesystem;
|
$fs = new Filesystem;
|
||||||
|
@ -182,6 +187,9 @@ class AllFunctionalTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, array<string>>
|
||||||
|
*/
|
||||||
public function getTestFiles()
|
public function getTestFiles()
|
||||||
{
|
{
|
||||||
$tests = array();
|
$tests = array();
|
||||||
|
@ -192,6 +200,10 @@ class AllFunctionalTest extends TestCase
|
||||||
return $tests;
|
return $tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $file
|
||||||
|
* @return array<string, int|string>
|
||||||
|
*/
|
||||||
private function parseTestFile($file)
|
private function parseTestFile($file)
|
||||||
{
|
{
|
||||||
$tokens = preg_split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE);
|
$tokens = preg_split('#(?:^|\n*)--([A-Z-]+)--\n#', file_get_contents($file), -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
@ -250,6 +262,10 @@ class AllFunctionalTest extends TestCase
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $output
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function cleanOutput($output)
|
private function cleanOutput($output)
|
||||||
{
|
{
|
||||||
$processed = '';
|
$processed = '';
|
||||||
|
|
|
@ -14,8 +14,14 @@ namespace Composer\Test\Plugin\Mock;
|
||||||
|
|
||||||
class Capability implements \Composer\Plugin\Capability\Capability
|
class Capability implements \Composer\Plugin\Capability\Capability
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
public $args;
|
public $args;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed[] $args
|
||||||
|
*/
|
||||||
public function __construct(array $args)
|
public function __construct(array $args)
|
||||||
{
|
{
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
|
|
Loading…
Reference in New Issue