@@ -794,20 +794,26 @@ protected function {$methodName}($lazyInitialization)
794
794
EOF ;
795
795
}
796
796
797
- $ this -> serviceCalls = [];
798
- $ this -> inlinedDefinitions = $ this -> getDefinitionsFromArguments ([ $ definition ], null , $ this ->serviceCalls ) ;
797
+ if ( $ definition -> hasErrors () && $ e = $ definition -> getErrors ()) {
798
+ $ this ->addThrow = true ;
799
799
800
- if ($ definition ->isDeprecated ()) {
801
- $ code .= sprintf (" @trigger_error(%s, E_USER_DEPRECATED); \n\n" , $ this ->export ($ definition ->getDeprecationMessage ($ id )));
802
- }
800
+ $ code .= sprintf (" \$this->throw(%s); \n" , $ this ->export (reset ($ e )));
801
+ } else {
802
+ $ this ->serviceCalls = [];
803
+ $ this ->inlinedDefinitions = $ this ->getDefinitionsFromArguments ([$ definition ], null , $ this ->serviceCalls );
803
804
804
- if ($ this ->getProxyDumper ()->isProxyCandidate ($ definition )) {
805
- $ factoryCode = $ asFile ? ($ definition ->isShared () ? "\$this->load('%s.php', false) " : '$this->factories[%2$s](false) ' ) : '$this->%s(false) ' ;
806
- $ code .= $ this ->getProxyDumper ()->getProxyFactoryCode ($ definition , $ id , sprintf ($ factoryCode , $ methodName , $ this ->doExport ($ id )));
807
- }
805
+ if ($ definition ->isDeprecated ()) {
806
+ $ code .= sprintf (" @trigger_error(%s, E_USER_DEPRECATED); \n\n" , $ this ->export ($ definition ->getDeprecationMessage ($ id )));
807
+ }
808
808
809
- $ code .= $ this ->addServiceInclude ($ id , $ definition );
810
- $ code .= $ this ->addInlineService ($ id , $ definition );
809
+ if ($ this ->getProxyDumper ()->isProxyCandidate ($ definition )) {
810
+ $ factoryCode = $ asFile ? ($ definition ->isShared () ? "\$this->load('%s.php', false) " : '$this->factories[%2$s](false) ' ) : '$this->%s(false) ' ;
811
+ $ code .= $ this ->getProxyDumper ()->getProxyFactoryCode ($ definition , $ id , sprintf ($ factoryCode , $ methodName , $ this ->doExport ($ id )));
812
+ }
813
+
814
+ $ code .= $ this ->addServiceInclude ($ id , $ definition );
815
+ $ code .= $ this ->addInlineService ($ id , $ definition );
816
+ }
811
817
812
818
if ($ asFile ) {
813
819
$ code = implode ("\n" , array_map (function ($ line ) { return $ line ? substr ($ line , 8 ) : $ line ; }, explode ("\n" , $ code )));
0 commit comments