This commit is contained in:
2020-09-01 00:39:24 +08:00
parent e979332f01
commit ae753bc267
2 changed files with 6 additions and 7 deletions
+3 -3
View File
@@ -149,9 +149,9 @@ class Node extends Application
}
/** @var Annotation $annotation */
$annotation = Snowflake::createObject(Annotation::class);
if (!empty($methods)) {
$this->_interceptors = $annotation->instance($reflect, $action);
$annotation = Snowflake::get()->annotation->http;
if (!empty($methods = $annotation->getAnnotation(Annotation::class))) {
$this->_interceptors = $annotation->instance($reflect, $action, $methods);
}
return [$reflect->newInstance(), $action];
} catch (Exception $exception) {
+3 -4
View File
@@ -50,14 +50,13 @@ abstract class BaseAnnotation extends Component
/**
* @param ReflectionClass $reflect
* @param string $method
* @param array $rules
* @param array $annotations
* @return array
* @throws ReflectionException
* @throws Exception
*/
public function instance($reflect, $method = '', $rules = [])
public function instance($reflect, $method = '', $annotations = [])
{
$annotations = $this->getPrivates($reflect);
$classMethods = $reflect->getMethods(ReflectionMethod::IS_PUBLIC);
if (!$reflect->isInstantiable()) {
throw new Exception('Class ' . $reflect->getName() . ' cannot be instantiated.');