6
6
use InvalidArgumentException ;
7
7
use ReflectionObject ;
8
8
use RuntimeException ;
9
- use think \App ;
10
9
use think \Config ;
11
10
use think \Container ;
12
11
use think \Event ;
13
12
use think \exception \Handle ;
14
- use think \swoole \App as SwooleApp ;
15
13
use think \swoole \concerns \ModifyProperty ;
16
14
use think \swoole \contract \ResetterInterface ;
17
15
use think \swoole \coroutine \Context ;
@@ -27,14 +25,10 @@ class Sandbox
27
25
{
28
26
use ModifyProperty;
29
27
30
- /**
31
- * The app containers in different coroutine environment.
32
- *
33
- * @var SwooleApp[]
34
- */
28
+ /** @var App[] */
35
29
protected $ snapshots = [];
36
30
37
- /** @var SwooleApp */
31
+ /** @var App */
38
32
protected $ app ;
39
33
40
34
/** @var Config */
@@ -47,13 +41,13 @@ class Sandbox
47
41
protected $ resetters = [];
48
42
protected $ services = [];
49
43
50
- public function __construct (Container $ app )
44
+ public function __construct (App $ app )
51
45
{
52
46
$ this ->setBaseApp ($ app );
53
47
$ this ->initialize ();
54
48
}
55
49
56
- public function setBaseApp (Container $ app )
50
+ public function setBaseApp (App $ app )
57
51
{
58
52
$ this ->app = $ app ;
59
53
@@ -113,7 +107,7 @@ public function clear()
113
107
public function getApplication ($ init = false )
114
108
{
115
109
$ snapshot = $ this ->getSnapshot ($ init );
116
- if ($ snapshot instanceof Container ) {
110
+ if ($ snapshot instanceof App ) {
117
111
return $ snapshot ;
118
112
}
119
113
@@ -140,14 +134,14 @@ public function getSnapshot($init = false)
140
134
return $ this ->snapshots [$ this ->getSnapshotId ($ init )] ?? null ;
141
135
}
142
136
143
- public function setSnapshot (Container $ snapshot )
137
+ public function setSnapshot (App $ snapshot )
144
138
{
145
139
$ this ->snapshots [$ this ->getSnapshotId ()] = $ snapshot ;
146
140
147
141
return $ this ;
148
142
}
149
143
150
- public function setInstance (Container $ app )
144
+ public function setInstance (App $ app )
151
145
{
152
146
$ app ->instance ('app ' , $ app );
153
147
$ app ->instance (Container::class, $ app );
0 commit comments