Introduce ClassNotFoundException for container
This commit is contained in:
parent
a854480ff1
commit
7c13318b9a
16
src/Container/ClassNotFoundException.php
Normal file
16
src/Container/ClassNotFoundException.php
Normal 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
|
||||
));
|
||||
}
|
||||
}
|
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user