改名
This commit is contained in:
@@ -57,7 +57,7 @@ class Container extends BaseObject implements ContainerInterface
|
|||||||
|
|
||||||
/** @var array|string[] */
|
/** @var array|string[] */
|
||||||
private array $_interfaces = [
|
private array $_interfaces = [
|
||||||
LoggerInterface::class => Logger::class
|
LoggerInterface::class => Logger::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -112,8 +112,12 @@ class Container extends BaseObject implements ContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function setBindings(string $interface, $object)
|
public function setBindings(string $interface, $object)
|
||||||
{
|
{
|
||||||
$this->_singletons[$interface] = $object;
|
if (is_string($object)) {
|
||||||
$this->_interfaces[$interface] = get_class($object);
|
$this->_interfaces[$interface] = $object;
|
||||||
|
} else {
|
||||||
|
$this->_interfaces[$interface] = get_class($object);
|
||||||
|
$this->_singletons[$interface] = $object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -253,7 +257,7 @@ class Container extends BaseObject implements ContainerInterface
|
|||||||
if ($reflect->isAbstract() || $reflect->isTrait() || $reflect->isInterface()) {
|
if ($reflect->isAbstract() || $reflect->isTrait() || $reflect->isInterface()) {
|
||||||
return $this->_reflection[$class] = $reflect;
|
return $this->_reflection[$class] = $reflect;
|
||||||
}
|
}
|
||||||
$construct = NoteManager::resolveTarget($reflect);
|
$construct = NoteManager::resolveTarget($reflect);
|
||||||
if (!empty($construct) && $construct->getNumberOfParameters() > 0) {
|
if (!empty($construct) && $construct->getNumberOfParameters() > 0) {
|
||||||
$this->_constructs[$class] = $construct;
|
$this->_constructs[$class] = $construct;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user