This commit is contained in:
2021-04-25 11:22:23 +08:00
parent 5e2c46a3aa
commit 77a6445eea
13 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -154,7 +154,7 @@ class Annotation extends Component
*/
public function injectProperty(object $class)
{
$this->_loader->injectProperty(get_class($class), $class);
$this->_loader->injectProperty($class::class, $class);
}
+1 -1
View File
@@ -405,7 +405,7 @@ class Loader extends BaseObject
$value->execute([$annotations['handler']]);
}
$_className = get_class($annotations['handler']);
$_className = $annotations['handler']::class;
foreach ($annotations['methods'] as $name => $attribute) {
foreach ($attribute as $value) {
if ($value instanceof Relation) {
+1 -1
View File
@@ -42,7 +42,7 @@ use Snowflake\Snowflake;
*/
public function execute(array $handler): mixed
{
$class = ['class' => get_class($handler[0])];
$class = ['class' => $handler[0]::class];
if (!empty($this->args)) {
$class = array_merge($class, $this->args);
}
+1 -1
View File
@@ -39,7 +39,7 @@ use Snowflake\Snowflake;
/** @var HttpFilter $filter */
$filter = Snowflake::app()->get('filter');
$filter->register(get_class($class), $method, $this->rules);
$filter->register($class::class, $method, $this->rules);
return $handler;
}
+1 -1
View File
@@ -113,7 +113,7 @@ class OnTask extends Callback
if (is_object($params)) {
$params = get_object_vars($params);
}
$finish['class'] = get_class($serialize);
$finish['class'] = $serialize::class;
$finish['params'] = $params;
$finish['status'] = 'success';
$finish['info'] = $serialize->onHandler();
+1 -1
View File
@@ -111,7 +111,7 @@ class Node extends HttpService
if (!($controller instanceof Controller)) {
return $this;
}
$this->annotationInject(get_class($controller), $action);
$this->annotationInject($controller::class, $action);
}
if (!empty($this->handler)) {
$this->callback = Reduce::reduce($this->createDispatch(), $this->annotation());
+2 -2
View File
@@ -36,7 +36,7 @@ class Producer extends Component
*/
public function addProducer(string $name, array $handler, array $node)
{
$this->classAlias[get_class($handler[0])] = $name;
$this->classAlias[$handler[0]::class] = $name;
$this->consumers[$name] = $handler[0];
@@ -50,7 +50,7 @@ class Producer extends Component
*/
public function addConsumer(string $cmd, array $handler)
{
$class = get_class($handler[0]);
$class = $handler[0]::class;
if (!isset($this->classAlias[$class])) {
return;
+2 -2
View File
@@ -81,7 +81,7 @@ class BaseObject implements Configure
$this->{$method}($value);
} else {
$this->error('set ' . $name . ' not exists ' . get_called_class());
throw new Exception('The set name ' . $name . ' not find in class ' . get_class($this));
throw new Exception('The set name ' . $name . ' not find in class ' . static::class);
}
}
@@ -97,7 +97,7 @@ class BaseObject implements Configure
if (method_exists($this, $method)) {
return $this->$method();
} else {
throw new Exception('The get name ' . $name . ' not find in class ' . get_class($this));
throw new Exception('The get name ' . $name . ' not find in class ' . static::class);
}
}
+2 -2
View File
@@ -30,7 +30,7 @@ class Aop extends Component
public function aop_add(array $handler, string $aspect)
{
[$class, $method] = $handler;
$alias = get_class($class) . '::' . $method;
$alias = $class::class . '::' . $method;
if (!isset($this->_aop[$alias])) {
$this->_aop[$alias] = [];
}
@@ -54,7 +54,7 @@ class Aop extends Component
if ($handler instanceof \Closure) {
return call_user_func($handler, ...$params);
}
$aopName = get_class($handler[0]) . '::' . $handler[1];
$aopName = $handler[0]::class . '::' . $handler[1];
if (!isset($this->_aop[$aopName])) {
return $this->notFound($handler, $params);
}
+1 -1
View File
@@ -279,7 +279,7 @@ class Container extends BaseObject
if (is_array($class) && isset($class['class'])) {
$class = $class['class'];
} else if (is_object($class)) {
$class = get_class($class);
$class = $class::class;
}
unset(
$this->_reflection[$class], $this->_singletons[$class],
+1 -1
View File
@@ -140,7 +140,7 @@ class Service extends Component
public function remove($id): bool
{
$component = $this->_components[$id];
$className = get_class($component);
$className = $component::class;
unset($component, $this->_components[$id]);
unset($this->_definition[$id]);
+1 -1
View File
@@ -45,7 +45,7 @@ class LoggerAspect implements IAspect
private function print_runtime($startTime)
{
$className = get_class($this->handler[0]);
$className = $this->handler[0]::class;
$methodName = $this->handler[1];
$runTime = round(microtime(true) - $startTime, 6);
+1 -1
View File
@@ -827,7 +827,7 @@ if (!function_exists('jTraceEx')) {
if (!$seen) $seen = array();
$trace = $e->getTrace();
$prev = $e->getPrevious();
$result[] = sprintf('%s%s: %s', $starter, get_class($e), $e->getMessage());
$result[] = sprintf('%s%s: %s', $starter, $e::class, $e->getMessage());
$file = $e->getFile();
$line = $e->getLine();
while (true) {