1
0
Fork 0

Ensure stability-flags, platform and platform-dev keys are objects in composer.lock

pull/12114/head
Jordi Boggiano 2024-09-18 15:45:26 +02:00
parent c8838f198e
commit ad6198ad2a
No known key found for this signature in database
2 changed files with 8 additions and 6 deletions

4
composer.lock generated
View File

@ -2381,13 +2381,13 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.2.5 || ^8.0" "php": "^7.2.5 || ^8.0"
}, },
"platform-dev": [], "platform-dev": {},
"platform-overrides": { "platform-overrides": {
"php": "7.2.5" "php": "7.2.5"
}, },

View File

@ -368,20 +368,22 @@ class Locker
'packages-dev' => null, 'packages-dev' => null,
'aliases' => $aliases, 'aliases' => $aliases,
'minimum-stability' => $minimumStability, 'minimum-stability' => $minimumStability,
'stability-flags' => $stabilityFlags, 'stability-flags' => \count($stabilityFlags) > 0 ? $stabilityFlags : new \stdClass,
'prefer-stable' => $preferStable, 'prefer-stable' => $preferStable,
'prefer-lowest' => $preferLowest, 'prefer-lowest' => $preferLowest,
]; ];
ksort($lock['stability-flags']); if (is_array($lock['stability-flags'])) {
ksort($lock['stability-flags']);
}
$lock['packages'] = $this->lockPackages($packages); $lock['packages'] = $this->lockPackages($packages);
if (null !== $devPackages) { if (null !== $devPackages) {
$lock['packages-dev'] = $this->lockPackages($devPackages); $lock['packages-dev'] = $this->lockPackages($devPackages);
} }
$lock['platform'] = $platformReqs; $lock['platform'] = \count($platformReqs) > 0 ? $platformReqs : new \stdClass;
$lock['platform-dev'] = $platformDevReqs; $lock['platform-dev'] = \count($platformDevReqs) > 0 ? $platformDevReqs : new \stdClass;
if (\count($platformOverrides) > 0) { if (\count($platformOverrides) > 0) {
$lock['platform-overrides'] = $platformOverrides; $lock['platform-overrides'] = $platformOverrides;
} }