diff --git a/src/TestCase.php b/src/TestCase.php index 87ab351..eb98135 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -17,6 +17,7 @@ use Horde_Support_Backtrace; use ReflectionClass; +use ReflectionNamedType; /** * Basic Horde test case helper. @@ -127,7 +128,10 @@ public function getMockDependencies(string $class, array $overrides = []) } else { if (is_null($type)) { throw new Exception("dependency $name has no type defined and is not in overrides array"); + } elseif (!($type instanceof ReflectionNamedType)) { + throw new Exception("dependency $name is a union or intersection type"); } + // TODO: How would we handle a union or intersection dependency? $typeName = $type->getName(); switch ($typeName) { case 'int':