1
0
Fork 0

Fixed lock file being used when lock:false is in config, refs #10715 (#10726)

pull/10725/head
Jordi Boggiano 2022-04-13 14:52:13 +02:00 committed by GitHub
parent 9bfd059420
commit bb0edce095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 111 deletions

View File

@ -396,7 +396,7 @@ in the Composer home, cache, and data directories.
## lock
Defaults to `true`. If set to `false`, Composer will not create a `composer.lock`
file.
file and will ignore it if one is present.
## platform-check

View File

@ -127,7 +127,7 @@ parameters:
-
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
count: 3
count: 2
path: ../src/Composer/Autoload/AutoloadGenerator.php
-
@ -605,11 +605,6 @@ parameters:
count: 2
path: ../src/Composer/Command/ConfigCommand.php
-
message: "#^Parameter \\#1 \\$path of function dirname expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Command/ConfigCommand.php
-
message: "#^Parameter \\#1 \\$path of function realpath expects string, string\\|false given\\.$#"
count: 1
@ -1070,11 +1065,6 @@ parameters:
count: 1
path: ../src/Composer/Command/InitCommand.php
-
message: "#^Only booleans are allowed in a negated boolean, true\\|null given\\.$#"
count: 1
path: ../src/Composer/Command/InitCommand.php
-
message: "#^Only booleans are allowed in a ternary operator condition, Composer\\\\Composer\\|null given\\.$#"
count: 1
@ -1662,7 +1652,7 @@ parameters:
-
message: "#^Only booleans are allowed in &&, string\\|null given on the left side\\.$#"
count: 2
count: 1
path: ../src/Composer/Command/SelfUpdateCommand.php
-
@ -2440,11 +2430,6 @@ parameters:
count: 1
path: ../src/Composer/Compiler.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Compiler.php
-
message: "#^Parameter \\#1 \\$source of method Composer\\\\Compiler\\:\\:stripWhitespace\\(\\) expects string, string\\|false given\\.$#"
count: 1
@ -2452,11 +2437,6 @@ parameters:
-
message: "#^Parameter \\#1 \\$str of function strtr expects string, string\\|false given\\.$#"
count: 2
path: ../src/Composer/Compiler.php
-
message: "#^Parameter \\#1 \\$str of function substr_replace expects array\\|string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Compiler.php
@ -3505,16 +3485,6 @@ parameters:
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
-
message: "#^Call to function in_array\\(\\) with arguments 20, non\\-empty\\-array\\<int, 10\\|20\\> and true will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
-
message: "#^Only booleans are allowed in an if condition, array\\<string, string\\|null\\>\\|null given\\.$#"
count: 1
@ -3870,21 +3840,26 @@ parameters:
count: 3
path: ../src/Composer/Factory.php
-
message: "#^Offset 'line' does not exist on array\\{text\\?\\: string, token\\?\\: string, line\\?\\: int, loc\\?\\: array\\{first_line\\: int, first_column\\: int, last_line\\: int, last_column\\: int\\}, expected\\?\\: array\\<string\\>, key\\: string\\}\\.$#"
count: 1
path: ../src/Composer/Factory.php
-
message: "#^Only booleans are allowed in &&, Composer\\\\IO\\\\IOInterface\\|null given on the left side\\.$#"
count: 3
path: ../src/Composer/Factory.php
-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
count: 1
path: ../src/Composer/Factory.php
-
message: "#^Only booleans are allowed in a negated boolean, string\\|false given\\.$#"
count: 3
path: ../src/Composer/Factory.php
-
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
count: 1
path: ../src/Composer/Factory.php
-
message: "#^Only booleans are allowed in an if condition, Composer\\\\IO\\\\IOInterface\\|null given\\.$#"
count: 1
@ -4480,14 +4455,9 @@ parameters:
count: 1
path: ../src/Composer/Package/Archiver/ArchivableFilesFinder.php
-
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Package/Archiver/ArchivableFilesFinder.php
-
message: "#^Parameter \\#1 \\$path of method Composer\\\\Util\\\\Filesystem\\:\\:normalizePath\\(\\) expects string, string\\|false given\\.$#"
count: 2
count: 1
path: ../src/Composer/Package/Archiver/ArchivableFilesFinder.php
-
@ -5185,11 +5155,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ArtifactRepository.php
-
message: "#^Parameter \\#1 \\$filename of function sha1_file expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Repository/ArtifactRepository.php
-
message: "#^Anonymous function uses \\$this assigned to variable \\$repo\\. Use \\$this directly in the function body\\.$#"
count: 3
@ -5225,11 +5190,6 @@ parameters:
count: 2
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Method Composer\\\\Repository\\\\ComposerRepository\\:\\:getProviderNames\\(\\) should return array\\<string\\> but returns array\\<int, int\\|string\\>\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Method Composer\\\\Repository\\\\ComposerRepository\\:\\:getProviders\\(\\) should return array\\<string, array\\{name\\: string, description\\: string, type\\: string\\}\\> but returns array\\<int\\|string, array\\{name\\: mixed, description\\: mixed, type\\: mixed\\}\\>\\.$#"
count: 1
@ -5342,7 +5302,7 @@ parameters:
-
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
count: 13
count: 12
path: ../src/Composer/Repository/ComposerRepository.php
-
@ -5350,11 +5310,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$input of function array_keys expects array, array\\<string, array\\<string, string\\>\\>\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/ComposerRepository.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 3
@ -6265,11 +6220,6 @@ parameters:
count: 1
path: ../src/Composer/SelfUpdate/Keys.php
-
message: "#^Only booleans are allowed in a negated boolean, array\\<string, array\\<int, array\\<string, int\\|string\\>\\>\\> given\\.$#"
count: 1
path: ../src/Composer/SelfUpdate/Versions.php
-
message: "#^Only booleans are allowed in an if condition, string given\\.$#"
count: 1
@ -6915,11 +6865,6 @@ parameters:
count: 1
path: ../src/Composer/Util/HttpDownloader.php
-
message: "#^Binary operation \"\\.\" between non\\-empty\\-string and non\\-empty\\-array\\<array\\{versions\\: string, message\\: string\\}\\>\\|non\\-empty\\-string results in an error\\.$#"
count: 1
path: ../src/Composer/Util/HttpDownloader.php
-
message: "#^Cannot call method abortRequest\\(\\) on Composer\\\\Util\\\\Http\\\\CurlDownloader\\|null\\.$#"
count: 1
@ -7615,11 +7560,6 @@ parameters:
count: 3
path: ../tests/Composer/Test/AllFunctionalTest.php
-
message: "#^Method Composer\\\\Test\\\\AllFunctionalTest\\:\\:getTestFiles\\(\\) should return array\\<string, array\\<string\\>\\> but returns array\\<string, array\\<int, string\\|false\\>\\>\\.$#"
count: 1
path: ../tests/Composer/Test/AllFunctionalTest.php
-
message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#"
count: 1
@ -7695,31 +7635,11 @@ parameters:
count: 2
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#1 \\$expected of static method Composer\\\\Test\\\\Autoload\\\\AutoloadGeneratorTest\\:\\:assertEqualsNormalized\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#1 \\$new_include_path of function set_include_path expects string, string\\|false given\\.$#"
count: 2
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#2 \\$actual of static method Composer\\\\Test\\\\Autoload\\\\AutoloadGeneratorTest\\:\\:assertEqualsNormalized\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
count: 8
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringNotContainsString\\(\\) expects string, string\\|false given\\.$#"
count: 3
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
-
message: "#^Property Composer\\\\Test\\\\Autoload\\\\AutoloadGeneratorTest\\:\\:\\$origDir \\(string\\) does not accept string\\|false\\.$#"
count: 1
@ -7835,11 +7755,6 @@ parameters:
count: 1
path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
-
message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php
-
message: "#^Parameter \\#2 \\$fixturesDir of method Composer\\\\Test\\\\DependencyResolver\\\\PoolBuilderTest\\:\\:readTestFile\\(\\) expects string, string\\|false given\\.$#"
count: 1
@ -7875,11 +7790,6 @@ parameters:
count: 1
path: ../tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
-
message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php
-
message: "#^Parameter \\#2 \\$fixturesDir of method Composer\\\\Test\\\\DependencyResolver\\\\PoolOptimizerTest\\:\\:readTestFile\\(\\) expects string, string\\|false given\\.$#"
count: 1
@ -8208,11 +8118,6 @@ parameters:
count: 1
path: ../tests/Composer/Test/InstallerTest.php
-
message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/InstallerTest.php
-
message: "#^Parameter \\#1 \\$fp of function fseek expects resource, resource\\|false given\\.$#"
count: 1

View File

@ -442,8 +442,11 @@ class Factory
// init locker if possible
if ($fullLoad && isset($composerFile)) {
$lockFile = self::getLockFile($composerFile);
if (!$config->get('lock') && file_exists($lockFile)) {
$io->writeError('<warning>'.$lockFile.' is present but ignored as the "lock" config option is disabled.</warning>');
}
$locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $im, file_get_contents($composerFile), $process);
$locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process);
$composer->setLocker($locker);
}

View File

@ -249,4 +249,16 @@ class Platform
return self::$isVirtualBoxGuest;
}
/**
* @return 'NUL'|'/dev/null'
*/
public static function getDevNull()
{
if (self::isWindows()) {
return 'NUL';
}
return '/dev/null';
}
}