Skip to content

Commit

Permalink
Update LockerUtil.php
Browse files Browse the repository at this point in the history
Use `version_compare` instead of string comparison
  • Loading branch information
SamMousa authored Jun 15, 2021
1 parent 7b8f611 commit 5d183dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Util/LockerUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function getLocker(IOInterface $io, RepositoryManager $rm, Install
{
$lockFile = str_replace('.json', '.lock', $composerFile);
// @codeCoverageIgnoreStart
return \defined('Composer\Composer::RUNTIME_API_VERSION') && in_array(Composer::RUNTIME_API_VERSION, ['2.0.0', '2.1.0'])
return \defined('Composer\Composer::RUNTIME_API_VERSION') && version_compare(Composer::RUNTIME_API_VERSION, '2.0.0', '>=')
? new Locker($io, new JsonFile($lockFile, null, $io), $im, file_get_contents($composerFile))
: new Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
}
Expand Down

0 comments on commit 5d183dd

Please sign in to comment.