diff --git a/PHPCI/Plugin/Util/Factory.php b/PHPCI/Plugin/Util/Factory.php index 4e6065e6..09cd44cf 100644 --- a/PHPCI/Plugin/Util/Factory.php +++ b/PHPCI/Plugin/Util/Factory.php @@ -75,7 +75,7 @@ class Factory { * @throws \InvalidArgumentException * @internal param mixed $resource */ - public function registerResource(callable $loader, + public function registerResource($loader, $name = null, $type = null ) @@ -86,6 +86,12 @@ class Factory { ); } + if (!($loader instanceof \Closure)) { + throw new \InvalidArgumentException( + '$loader is expected to be a function' + ); + } + $resourceID = $this->getInternalID($type, $name); $this->container[$resourceID] = $loader;