Skip to content

Commit

Permalink
Fixed getting alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Jul 26, 2019
1 parent 6a4eb47 commit e06125e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ protected function processPackage(Package $package)
$alternatives = $package->getAlternatives();
if (is_string($alternatives)) {
$this->alternatives = $this->readConfig($package, $alternatives);
} else {
} elseif (is_array($alternatives)) {
$this->alternatives = $alternatives;
} elseif (!empty($alternatives)) {
throw new BadConfigurationException('alternatives must be array or path to configuration file');
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/exceptions/BadConfigurationException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Composer plugin for config assembling
*
* @link https://github.com/hiqdev/composer-config-plugin
* @package composer-config-plugin
* @license BSD-3-Clause
* @copyright Copyright (c) 2016-2018, HiQDev (http://hiqdev.com/)
*/

namespace hiqdev\composer\config\exceptions;

/**
* Bad configuration exception.
*
* @author Andrii Vasyliev <sol@hiqdev.com>
*/
class BadConfigurationException extends Exception
{
}

0 comments on commit e06125e

Please sign in to comment.