Skip to content

Commit

Permalink
Fix for Composer installation (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored Sep 25, 2022
1 parent e5ef4d8 commit 8a516af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ function get_box_version(): string
// Indeed, this class is registered to the autoloader by Composer itself which
// results an incorrect classmap entry in the scoped code.
// This strategy avoids having to exclude completely the file from the scoping.
require_once __DIR__.'/../vendor/composer/InstalledVersions.php';
foreach ([__DIR__.'/../vendor/composer/InstalledVersions.php', __DIR__.'/../../../composer/InstalledVersions.php'] as $file) {
if (file_exists($file)) {
require_once $file;
break;
}
}

$prettyVersion = InstalledVersions::getPrettyVersion('humbug/box');
$commitHash = InstalledVersions::getReference('humbug/box');
Expand Down

0 comments on commit 8a516af

Please sign in to comment.