From e06125e58da8ad495ffa61840bc6cc57defcc96f Mon Sep 17 00:00:00 2001 From: Andrii Vasyliev Date: Fri, 26 Jul 2019 11:01:35 +0200 Subject: [PATCH] Fixed getting alternatives --- src/Plugin.php | 4 +++- src/exceptions/BadConfigurationException.php | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/exceptions/BadConfigurationException.php diff --git a/src/Plugin.php b/src/Plugin.php index 099cf50..9c8ef47 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -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'); } } diff --git a/src/exceptions/BadConfigurationException.php b/src/exceptions/BadConfigurationException.php new file mode 100644 index 0000000..680acf0 --- /dev/null +++ b/src/exceptions/BadConfigurationException.php @@ -0,0 +1,20 @@ + + */ +class BadConfigurationException extends Exception +{ +}