Skip to content

Commit 121af47

Browse files
bug #5 Fix Versions class when composer itself is a dep (nicolas-grekas)
This PR was merged into the 1.x branch. Discussion ---------- Fix Versions class when composer itself is a dep Fixes doctrine/migrations#1112 Commits ------- a81eb3a Fix Versions class when composer itself is a dep
2 parents 2c927bb + a81eb3a commit 121af47

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ProxyManager/Version.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ private function __construct()
3737
*/
3838
public static function getVersion(): string
3939
{
40-
if (class_exists(InstalledVersions::class)) {
40+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled('friendsofphp/proxy-manager-lts')) {
4141
return InstalledVersions::getPrettyVersion('friendsofphp/proxy-manager-lts')
4242
. '@' . InstalledVersions::getReference('friendsofphp/proxy-manager-lts');
4343
}
4444

4545
if (class_exists(Versions::class)) {
46-
return Versions::getVersion('friendsofphp/proxy-manager-lts');
46+
try {
47+
return Versions::getVersion('friendsofphp/proxy-manager-lts');
48+
} catch (\OutOfBoundsException $e) {
49+
// no-op
50+
}
4751
}
4852

4953
return '1@friendsofphp/proxy-manager-lts';

0 commit comments

Comments
 (0)