@@ -13,9 +13,13 @@ public function testContainerResolveDependencies(): void
1313 {
1414 $ container = new Container ();
1515
16- $ container ->register ('test ' , function ( Container $ container ) { return new class {
17- public string $ name = 'success ' ;
18- }; });
16+ $ container ->register (
17+ 'test ' , function ( Container $ container ) {
18+ return new class {
19+ public string $ name = 'success ' ;
20+ };
21+ }
22+ );
1923
2024 $ service = $ container ->get ('test ' );
2125 $ this ->assertIsObject ($ service );
@@ -27,18 +31,32 @@ public function testRegisterTwoServicesWithEqualAliasesException(): void
2731 $ this ->expectException (ServiceRegistrationException::class);
2832 $ container = new Container ();
2933
30- $ container ->register ('test ' , function ( Container $ container ) { return new class {}; });
31- $ container ->register ('test ' , function ( Container $ container ) { return new class {}; });
34+ $ container ->register (
35+ 'test ' , function ( Container $ container ) {
36+ return new class {
37+ };
38+ }
39+ );
40+ $ container ->register (
41+ 'test ' , function ( Container $ container ) {
42+ return new class {
43+ };
44+ }
45+ );
3246 }
3347
3448 public function testContainerUnresolvedException (): void
3549 {
3650 $ this ->expectException (ServiceNotRegisteredException::class);
3751
3852 $ container = new Container ();
39- $ container ->register ('test ' , function ( Container $ container ) { return new class {
40- public string $ name = 'success ' ;
41- }; });
53+ $ container ->register (
54+ 'test ' , function ( Container $ container ) {
55+ return new class {
56+ public string $ name = 'success ' ;
57+ };
58+ }
59+ );
4260
4361 $ container ->get ('test2 ' );
4462 }
0 commit comments