Browse Source

bug #3262 ToolInfo - support installation by branch as well (keradus)

This PR was merged into the 2.2 branch.

Discussion
----------

ToolInfo - support installation by branch as well

when installed as branch, eg `dev-master`, then there is no `dist` key in array, resulting in app crash

Commits
-------

154c457f ToolInfo - support installation by branch as well
Dariusz Ruminski 7 years ago
parent
commit
da9b04bbeb
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/ToolInfo.php

+ 7 - 1
src/ToolInfo.php

@@ -62,7 +62,13 @@ final class ToolInfo implements ToolInfoInterface
     {
         $package = $this->getComposerInstallationDetails();
 
-        return $package['version'].'#'.$package['dist']['reference'];
+        $versionSuffix = '';
+
+        if (isset($package['dist'])) {
+            $versionSuffix = '#'.$package['dist']['reference'];
+        }
+
+        return $package['version'].$versionSuffix;
     }
 
     public function getVersion()