Introduce ClassNotFoundException for container

This commit is contained in:
Tim 2023-08-08 16:56:55 +02:00
parent a854480ff1
commit 7c13318b9a
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace Ardent\Undercurrent\Container;
use Exception;
class ClassNotFoundException extends Exception
{
public function __construct(string $className)
{
parent::__construct(sprintf(
'Class %s not found in container',
$className
));
}
}

View File

@ -43,7 +43,7 @@ class GenericContainer implements ContainerInterface
$className = $this->aliases[$className];
}
if (!isset($this->definitions[$className])) {
throw new Exception("Class $className not found in container");
throw new ClassNotFoundException($className);
}
$definition = $this->definitions[$className]['definition'];