File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use Codefy \Framework \Application ;
8
8
use Codefy \Framework \Bootstrap \RegisterProviders ;
9
+ use Qubus \Exception \Data \TypeException ;
9
10
10
11
final class ApplicationBuilder
11
12
{
@@ -38,11 +39,16 @@ public function withKernels(): self
38
39
*
39
40
* @param array $providers
40
41
* @return $this
42
+ * @throws TypeException
41
43
*/
42
44
public function withProviders (array $ providers = []): self
43
45
{
44
46
RegisterProviders::merge ($ providers );
45
47
48
+ foreach ($ providers as $ provider ) {
49
+ $ this ->app ->registerServiceProvider ($ provider );
50
+ }
51
+
46
52
return $ this ;
47
53
}
48
54
@@ -59,11 +65,9 @@ public function withSingletons(array $singletons = []): self
59
65
return $ this ;
60
66
}
61
67
62
- $ this ->registered (function ($ app ) use ($ singletons ) {
63
- foreach ($ singletons as $ key => $ callable ) {
64
- $ app ->singleton ($ key , $ callable );
65
- }
66
- });
68
+ foreach ($ singletons as $ key => $ callable ) {
69
+ $ this ->app ->singleton ($ key , $ callable );
70
+ };
67
71
68
72
return $ this ;
69
73
}
You can’t perform that action at this time.
0 commit comments