Skip to content

Commit fe70b5f

Browse files
committed
修正app对象
1 parent 589c562 commit fe70b5f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/InteractsWithInject.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Trait InteractsWithInject
1212
* @package think\annotation\traits
13-
* @property App $app
13+
* @property App $app
1414
* @property Reader $reader
1515
*/
1616
trait InteractsWithInject
@@ -29,7 +29,7 @@ protected function getDocReader()
2929
protected function autoInject()
3030
{
3131
if ($this->app->config->get('annotation.inject.enable', true)) {
32-
$this->app->resolving(function ($object) {
32+
$this->app->resolving(function ($object, $app) {
3333

3434
if ($this->isInjectClass(get_class($object))) {
3535

@@ -42,12 +42,12 @@ protected function autoInject()
4242
$annotation = $this->reader->getPropertyAnnotation($refProperty, Inject::class);
4343
if ($annotation) {
4444
if ($annotation->value) {
45-
$value = $this->app->make($annotation->value);
45+
$value = $app->make($annotation->value);
4646
} else {
4747
//获取@var类名
4848
$propertyClass = $reader->getPropertyClass($refProperty);
4949
if ($propertyClass) {
50-
$value = $this->app->make($propertyClass);
50+
$value = $app->make($propertyClass);
5151
}
5252
}
5353

@@ -62,7 +62,7 @@ protected function autoInject()
6262
}
6363

6464
if ($refObject->hasMethod('__injected')) {
65-
$this->app->invokeMethod([$object, '__injected']);
65+
$app->invokeMethod([$object, '__injected']);
6666
}
6767
}
6868
});

0 commit comments

Comments
 (0)