改名
This commit is contained in:
@@ -35,7 +35,7 @@ use Kiri\Events\EventProvider;
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
$pro = di(EventProvider::class);
|
||||
$pro->on($this->name, [$class, $method]);
|
||||
$pro->on($this->name, [di($class), $method]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ use Kiri\Kiri;
|
||||
* @param $class
|
||||
* @param $method
|
||||
* @return ReflectionProperty|bool
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function getProperty($class, $method): ReflectionProperty|bool
|
||||
{
|
||||
|
||||
@@ -45,11 +45,10 @@ use Server\Events\OnWorkerExit;
|
||||
*/
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
$class = ['class' => $class::class];
|
||||
$class = ['class' => $class];
|
||||
if (!empty($this->args)) {
|
||||
$class = array_merge($class, $this->args);
|
||||
}
|
||||
|
||||
Kiri::set($this->service, $class);
|
||||
return true; // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ use Kiri\Kiri;
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
$annotation = Kiri::getAnnotation();
|
||||
$annotation->addGets($class::class, $this->name, $method);
|
||||
$annotation->addGets($class, $this->name, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ use Kiri\Kiri;
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
$annotation = Kiri::getAnnotation();
|
||||
$annotation->addRelate($class::class, $this->name, $method);
|
||||
$annotation->addRelate($class, $this->name, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ use Kiri\Kiri;
|
||||
public function execute(mixed $class, mixed $method = null): bool
|
||||
{
|
||||
$annotation = Kiri::getAnnotation();
|
||||
$annotation->addSets($class::class, $this->name, $method);
|
||||
$annotation->addSets($class, $this->name, $method);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ use Kiri\Kiri;
|
||||
{
|
||||
// TODO: Implement setHandler() method.
|
||||
$router = Kiri::app()->getRouter();
|
||||
$router->addRoute($this->uri, [$class, $method], $this->method);
|
||||
$router->addRoute($this->uri, [di($class::class), $method], $this->method);
|
||||
return $router;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ use Kiri\Kiri;
|
||||
|
||||
$path = $this->event . '::' . (is_null($this->uri) ? 'event' : $this->uri);
|
||||
|
||||
$router->addRoute($path, [$class, $method], 'sw::socket');
|
||||
$router->addRoute($path, [di($class), $method], 'sw::socket');
|
||||
|
||||
return $router;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class KafkaProvider extends BaseObject
|
||||
if (isset($this->_topics[$topic])) {
|
||||
return;
|
||||
}
|
||||
$this->_topics[$topic] = $handler::class;
|
||||
$this->_topics[$topic] = $handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,9 +71,8 @@ class OnServerWorker extends \Server\Abstracts\Server
|
||||
$fileLists = $annotation->runtime(APP_PATH . 'app');
|
||||
$di = Kiri::getDi();
|
||||
foreach ($fileLists as $class) {
|
||||
$instance = $di->get($class);
|
||||
foreach ($di->getTargetNote($class) as $value) {
|
||||
$value->execute($instance);
|
||||
$value->execute($class);
|
||||
}
|
||||
$methods = $di->getMethodAttribute($class);
|
||||
foreach ($methods as $method => $attribute) {
|
||||
@@ -81,7 +80,7 @@ class OnServerWorker extends \Server\Abstracts\Server
|
||||
continue;
|
||||
}
|
||||
foreach ($attribute as $item) {
|
||||
$item->execute($instance, $method);
|
||||
$item->execute($class, $method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ class Async extends Component
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param TaskExecute $handler
|
||||
* @param TaskExecute|string $handler
|
||||
*/
|
||||
public function addAsync(string $name, TaskExecute $handler)
|
||||
public function addAsync(string $name, TaskExecute|string $handler)
|
||||
{
|
||||
static::$_absences[$name] = $handler::class;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user