File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,19 @@ public static function create(array|string $settings): ContainerInterface
32
32
$ autoWiresDefinitions = File::require ($ autoWiresPath , 'Auto wires file does not exist ' );
33
33
34
34
// 2. Crete container
35
+ $ isAutoWiringEnabled = $ settingsArray ['di ' ]['auto_wires ' ]['enabled ' ];
35
36
$ containerBuilder = ContainerBuilder::create ()
36
37
->addSettingsArray ($ settingsArray )
37
38
->addRootPath ($ settingsArray ['rootPath ' ])
38
39
->addRootNamespace ($ settingsArray ['rootNamespace ' ])
39
- ->useAutoWiring ($ settingsArray [ ' di ' ][ ' auto_wires ' ][ ' enabled ' ] )
40
+ ->useAutoWiring ($ isAutoWiringEnabled )
40
41
->useAttributes ($ settingsArray ['di ' ]['attributes ' ]['enabled ' ])
41
42
;
42
43
44
+ if ($ isAutoWiringEnabled ) {
45
+ $ containerBuilder ->addDefinitions ($ autoWiresDefinitions );
46
+ }
47
+
43
48
// 3. Cache
44
49
if (Environment::from ($ settingsArray ['environment ' ]) === Environment::PRODUCTION ) {
45
50
$ containerCachePath = $ settingsArray ['di ' ]['cache ' ]['container ' ]['path ' ];
@@ -48,7 +53,7 @@ public static function create(array|string $settings): ContainerInterface
48
53
$ containerBuilder
49
54
->enableCompilation ($ containerCachePath )
50
55
->addResolverCachePathFile ($ resolverCachePathFile )
51
- -> addDefinitions ( $ autoWiresDefinitions ) ;
56
+ ;
52
57
}
53
58
54
59
// 4. Add definitions
You can’t perform that action at this time.
0 commit comments