This commit is contained in:
2021-10-28 17:11:20 +08:00
parent b68fc5de60
commit 9269a1a23e
4 changed files with 5 additions and 11 deletions
+1 -4
View File
@@ -255,13 +255,10 @@ class Container extends BaseObject implements ContainerInterface
return $this->_reflection[$class];
}
$reflect = new ReflectionClass($class);
if ($reflect->isAbstract() || $reflect->isTrait()) {
if ($reflect->isAbstract() || $reflect->isTrait() || $reflect->isInterface()) {
return $this->_reflection[$class] = $reflect;
}
$construct = NoteManager::resolveTarget($reflect);
if ($reflect->isInterface()) {
return $this->_reflection[$class] = $reflect;
}
if (!empty($construct) && $construct->getNumberOfParameters() > 0) {
$this->_constructs[$class] = $construct;
}
+2 -5
View File
@@ -25,12 +25,7 @@ class GiiJsonRpc extends GiiBase
namespace Rpc;
use Annotation\Mapping;
use Annotation\Target;
use Rpc\Producers\\' . ucfirst($name) . 'RpcService;
#[Target]
#[Mapping(' . ucfirst($name) . 'RpcService::class)]
interface ' . ucfirst($name) . 'RpcInterface
{
@@ -58,12 +53,14 @@ namespace Rpc\Producers;
use Annotation\Target;
use Annotation\Mapping;
use Rpc\\' . ucfirst($name) . 'RpcInterface;
use Exception;
use Kiri\Rpc\JsonRpcConsumers;
#[Target]
#[Mapping(' . ucfirst($name) . 'RpcInterface::class)]
class ' . ucfirst($name) . 'RpcService extends JsonRpcConsumers implements ' . ucfirst($name) . 'RpcInterface
{
+1 -1
View File
@@ -152,7 +152,7 @@ class Loader extends BaseObject
private function getReflect(DirectoryIterator $path, string $namespace): ?ReflectionClass
{
$class = $this->explodeFileName($path, $namespace);
if (!class_exists($class) && !interface_exists($class)) {
if (!class_exists($class)) {
return null;
}
return Kiri::getDi()->getReflect($class);
+1 -1
View File
@@ -23,7 +23,7 @@ use Kiri\Kiri;
*/
public function execute(mixed $class, mixed $method = ''): mixed
{
Kiri::getDi()->mapping($class, $this->class);
Kiri::getDi()->mapping($this->class, $class);
return parent::execute($class, $method);
}