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 66
77use Codefy \Framework \Application ;
88use Codefy \Framework \Bootstrap \RegisterProviders ;
9+ use Qubus \Exception \Data \TypeException ;
910
1011final class ApplicationBuilder
1112{
@@ -38,11 +39,16 @@ public function withKernels(): self
3839 *
3940 * @param array $providers
4041 * @return $this
42+ * @throws TypeException
4143 */
4244 public function withProviders (array $ providers = []): self
4345 {
4446 RegisterProviders::merge ($ providers );
4547
48+ foreach ($ providers as $ provider ) {
49+ $ this ->app ->registerServiceProvider ($ provider );
50+ }
51+
4652 return $ this ;
4753 }
4854
@@ -59,11 +65,9 @@ public function withSingletons(array $singletons = []): self
5965 return $ this ;
6066 }
6167
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+ };
6771
6872 return $ this ;
6973 }
You can’t perform that action at this time.
0 commit comments