diff --git a/.gitattributes b/.gitattributes index bf7e4b39e..be3d699d9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,7 +19,6 @@ /.php-cs-fixer.php export-ignore /CHANGELOG.md export-ignore /CODE_OF_CONDUCT.md export-ignore -/composer.lock export-ignore /phpunit.xml.dist export-ignore /PORTING_INFO export-ignore /README.md export-ignore diff --git a/CHANGELOG.md b/CHANGELOG.md index 44f195176..dbd456f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### [2.6.5] 2023-10-06 + + * Fixed error when vendor dir contains broken symlinks (#11670) + * Fixed composer.lock missing from Composer's zip archives (#11674) + * Fixed AutoloadGenerator::dump() non-BC signature change in 2.6.4 (cb363b0e8) + ### [2.6.4] 2023-09-29 * Security: Fixed possible remote code execution vulnerability if composer.phar is publicly accessible, executable as PHP, and register_argc_argv is enabled in php.ini (GHSA-jm6m-4632-36hf / CVE-2023-43655) @@ -1783,6 +1789,7 @@ * Initial release +[2.6.5]: https://github.com/composer/composer/compare/2.6.4...2.6.5 [2.6.4]: https://github.com/composer/composer/compare/2.6.3...2.6.4 [2.6.3]: https://github.com/composer/composer/compare/2.6.2...2.6.3 [2.6.2]: https://github.com/composer/composer/compare/2.6.1...2.6.2 diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 8ba82090b..1fd22ddf5 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -173,7 +173,7 @@ class AutoloadGenerator * @throws \Seld\JsonLint\ParsingException * @throws \RuntimeException */ - public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, Locker $locker, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null) + public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null, ?Locker $locker = null) { if ($this->classMapAuthoritative) { // Force scanPsrPackages when classmap is authoritative @@ -407,7 +407,7 @@ EOF; } if (null === $suffix) { - $suffix = $locker->isLocked() ? $locker->getLockData()['content-hash'] : md5(uniqid('', true)); + $suffix = $locker !== null && $locker->isLocked() ? $locker->getLockData()['content-hash'] : md5(uniqid('', true)); } } diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index fcd10f2b2..9336ab3b2 100644 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -105,9 +105,10 @@ EOT $localRepo, $package, $installationManager, - $composer->getLocker(), 'composer', - $optimize + $optimize, + null, + $composer->getLocker() ); $numberOfClasses = count($classMap); diff --git a/src/Composer/Command/ReinstallCommand.php b/src/Composer/Command/ReinstallCommand.php index d94ffeb53..446d9eec1 100644 --- a/src/Composer/Command/ReinstallCommand.php +++ b/src/Composer/Command/ReinstallCommand.php @@ -168,9 +168,10 @@ EOT $localRepo, $package, $installationManager, - $composer->getLocker(), 'composer', - $optimize + $optimize, + null, + $composer->getLocker() ); } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 7fc4382d1..9c0054778 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -356,9 +356,10 @@ class Installer $localRepo, $this->package, $this->installationManager, - $this->locker, 'composer', - $this->optimizeAutoloader + $this->optimizeAutoloader, + null, + $this->locker ); } diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 5e90e09f3..7ddcfa69f 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -251,10 +251,13 @@ class Filesystem $directory.' exists and is not a directory.' ); } + + if (is_link($directory) && !@$this->unlinkImplementation($directory)) { + throw new \RuntimeException('Could not delete symbolic link '.$directory.': '.(error_get_last()['message'] ?? '')); + } + if (!@mkdir($directory, 0777, true)) { - throw new \RuntimeException( - $directory.' does not exist and could not be created.' - ); + throw new \RuntimeException($directory.' does not exist and could not be created: '.(error_get_last()['message'] ?? '')); } } } diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 3a9544bb5..08d51ac74 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -30,7 +30,6 @@ use Composer\Repository\InstalledRepositoryInterface; use Composer\Installer\InstallationManager; use Composer\Config; use Composer\EventDispatcher\EventDispatcher; -use Composer\Package\Locker; use Composer\Util\Platform; use PHPUnit\Framework\MockObject\MockObject; @@ -81,11 +80,6 @@ class AutoloadGeneratorTest extends TestCase */ private $io; - /** - * @var Locker - */ - private $locker; - /** * @var EventDispatcher&MockObject */ @@ -164,10 +158,6 @@ class AutoloadGeneratorTest extends TestCase ->getMock(); $this->generator = new AutoloadGenerator($this->eventDispatcher, $this->io); - - $this->locker = $this->getMockBuilder('Composer\Package\Locker') - ->disableOriginalConstructor() - ->getMock(); } protected function tearDown(): void @@ -217,7 +207,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc'); file_put_contents($this->workingDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // Assert that autoload_namespaces.php was correctly generated. $this->assertAutoloadFiles('main', $this->vendorDir.'/composer'); @@ -257,7 +247,7 @@ class AutoloadGeneratorTest extends TestCase // generate autoload files with the dev mode set to true $this->generator->setDevMode(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // check standard autoload $this->assertAutoloadFiles('main5', $this->vendorDir.'/composer'); @@ -290,7 +280,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/devfiles'); file_put_contents($this->workingDir.'/devfiles/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // check standard autoload $this->assertAutoloadFiles('main4', $this->vendorDir.'/composer'); @@ -325,7 +315,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/composersrc'); file_put_contents($this->vendorDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_2'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_2'); $this->assertAutoloadFiles('main3', $this->vendorDir.'/composer'); $this->assertAutoloadFiles('psr4_3', $this->vendorDir.'/composer', 'psr4'); $this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap'); @@ -354,7 +344,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc'); file_put_contents($this->workingDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_3'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_3'); $this->assertAutoloadFiles('main2', $this->vendorDir.'/composer'); $this->assertAutoloadFiles('psr4_2', $this->vendorDir.'/composer', 'psr4'); $this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap'); @@ -383,7 +373,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/foo.php', 'workingDir.'/bar.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'TargetDir'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'TargetDir'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -409,7 +399,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/foo.php', 'workingDir.'/bar.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesWarning'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesWarning'); self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_duplicates.php', $this->vendorDir.'/composer/autoload_files.php'); $expected = 'The following "files" autoload rules are included multiple times, this may cause issues and should be resolved:'.PHP_EOL. ' - $baseDir . \'/foo.php\''.PHP_EOL; @@ -440,7 +430,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -474,7 +464,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src'); $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors_meta', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -507,7 +497,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -535,7 +525,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src/C'); file_put_contents($this->vendorDir.'/b/b/src/C/C.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_5'); $this->assertEquals( [ @@ -574,7 +564,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -626,7 +616,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->vendorDir.'/d/d/src/D.php', 'vendorDir.'/e/e/src/E.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap'); } @@ -665,7 +655,7 @@ class AutoloadGeneratorTest extends TestCase ->method('getCanonicalPackages') ->will($this->returnValue([$vendorPackage])); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, 'Phar'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, 'Phar'); $this->assertAutoloadFiles('phar', $this->vendorDir . '/composer'); $this->assertAutoloadFiles('phar_psr4', $this->vendorDir . '/composer', 'psr4'); @@ -685,7 +675,7 @@ class AutoloadGeneratorTest extends TestCase ->method('getCanonicalPackages') ->will($this->returnValue([])); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_8'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -715,7 +705,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/psr4/match.php', 'workingDir.'/psr4/badfile.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $expectedClassmap = <<vendorDir.'/b/b/src/b.php', 'vendorDir.'/b/b/lib/c.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_6'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -803,7 +793,7 @@ EOF; file_put_contents($this->vendorDir.'/a/a/target/lib/b.php', 'vendorDir.'/b/b/src/c.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_6'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -845,7 +835,7 @@ EOF; file_put_contents($this->vendorDir.'/b/b/test.php', 'vendorDir.'/c/c/foo/test.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -892,7 +882,7 @@ EOF; $this->generator->setClassMapAuthoritative(true); $this->generator->setApcu(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( @@ -941,7 +931,7 @@ EOF; $this->generator->setClassMapAuthoritative(true); $this->generator->setApcu(true, 'custom\'Prefix'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( @@ -991,7 +981,7 @@ EOF; file_put_contents($this->vendorDir.'/c/c/foo/bar/test4.php', 'workingDir.'/root.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -1056,20 +1046,20 @@ EOF; file_put_contents($this->vendorDir.'/c/c/foo/bar/test4.php', 'workingDir.'/root.php', 'generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.php'); - $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions_with_removed_extra.php', $this->vendorDir.'/composer/autoload_files.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions_with_removed_extra.php', $this->vendorDir.'/composer/include_paths.php'); - $this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -1133,7 +1123,7 @@ EOF; file_put_contents($this->vendorDir . '/e/e/testE.php', 'workingDir . '/root2.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesAutoloadOrder'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php'); @@ -1244,7 +1234,7 @@ return array( EOF; - $this->generator->dump($this->config, $this->repository, $rootPackage, $this->im, $this->locker, 'composer', true, '_9'); + $this->generator->dump($this->config, $this->repository, $rootPackage, $this->im, 'composer', true, '_9'); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); @@ -1274,7 +1264,7 @@ EOF; $this->fs->ensureDirectoryExists($this->vendorDir.'/composer'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_10'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_10'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php'); $this->assertEquals( @@ -1303,7 +1293,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_11'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_11'); $oldIncludePath = get_include_path(); @@ -1332,7 +1322,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_12'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_12'); $oldIncludePath = get_include_path(); @@ -1361,7 +1351,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_12'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_12'); $this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php"); } @@ -1390,7 +1380,7 @@ EOF; ->will($this->returnValue([])); $this->generator->setRunScripts(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_8'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); } public function testUseGlobalIncludePath(): void @@ -1409,7 +1399,7 @@ EOF; $this->fs->ensureDirectoryExists($this->vendorDir.'/a'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'IncludePath'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php'); } @@ -1470,7 +1460,7 @@ EOF; $oldVendorDir = $this->vendorDir; $this->vendorDir = $vendorDir; - $this->generator->dump($this->config, $this->repository, $package, $im, $this->locker, 'composer', true, '_13'); + $this->generator->dump($this->config, $this->repository, $package, $im, 'composer', true, '_13'); $this->vendorDir = $oldVendorDir; $expectedNamespace = <<<'EOF' @@ -1560,7 +1550,7 @@ EOF; file_put_contents($this->workingDir.'/working-dir/classmap4/foo/classes.php', 'workingDir.'/test.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_14'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_14'); $expectedNamespace = <<<'EOF' setAutoload([ 'psr-0' => ['Foo' => './src'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $expectedNamespace = <<<'EOF' setAutoload([ 'psr-4' => ['Acme\Foo\\' => './src-psr4'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $expectedPsr4 = <<<'EOF' ['classmap'], ]); try { - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); } catch (\RuntimeException $e) { $this->assertSame('Could not scan for classes inside "'.$this->vendorDir.'/dep/a/classmap" which does not appear to be a file nor a folder', $e->getMessage()); } @@ -1676,7 +1666,7 @@ EOF; $dep->setAutoload([ 'files' => ['./test.php'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $this->assertStringContainsString("\$vendorDir . '/dep/a/test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php')); $package->setAutoload([ @@ -1710,7 +1700,7 @@ EOF; file_put_contents($this->workingDir.'/Foo/Bar.php', 'workingDir.'/class.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_15'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_15'); $expectedNamespace = <<<'EOF' generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'VendorSubstring'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'VendorSubstring'); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); } @@ -1871,7 +1861,7 @@ EOF; : 'ln -s "' . $target . '" "' . $link . '"'; exec($command); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // Assert that autoload_classmap.php was correctly generated. $this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap'); @@ -1903,7 +1893,7 @@ EOF; ->will($this->returnValue([])); $this->generator->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs)); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); if (null === $expectedFixture) { $this->assertFileDoesNotExist($this->vendorDir . '/composer/platform_check.php');