if (!class_exists($this->className)) {
throw new SystemException("Unable to find class '".$this->className."'");
}
- if (($definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName) && !is_subclass_of($this->className, $definitionInterface)) {
- throw new ImplementationException($this->className, $definitionInterface);
+
+ $definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName;
+ if ($definitionInterface) {
+ if (!interface_exists($definitionInterface)) {
+ throw new SystemException("Unable to find interface '".$definitionInterface."'");
+ }
+
+ if (!is_subclass_of($this->className, $definitionInterface)) {
+ throw new ImplementationException($this->className, $definitionInterface);
+ }
}
if (is_subclass_of($this->className, SingletonFactory::class)) {