@@ -591,15 +591,16 @@ private function addServiceConfigurator($id, Definition $definition, $variableNa
591
591
*/
592
592
private function addService ($ id , Definition $ definition )
593
593
{
594
+ if ($ definition ->isSynthetic ()) {
595
+ return '' ;
596
+ }
594
597
$ this ->definitionVariables = new \SplObjectStorage ();
595
598
$ this ->referenceVariables = array ();
596
599
$ this ->variableCount = 0 ;
597
600
598
601
$ return = array ();
599
602
600
- if ($ definition ->isSynthetic ()) {
601
- $ return [] = '@throws RuntimeException always since this service is expected to be injected dynamically ' ;
602
- } elseif ($ class = $ definition ->getClass ()) {
603
+ if ($ class = $ definition ->getClass ()) {
603
604
$ class = $ this ->container ->resolveEnvPlaceholders ($ class );
604
605
$ return [] = sprintf ('@return %s A %s instance ' , 0 === strpos ($class , '% ' ) ? 'object ' : '\\' .ltrim ($ class , '\\' ), ltrim ($ class , '\\' ));
605
606
} elseif ($ definition ->getFactory ()) {
@@ -680,26 +681,22 @@ private function addService($id, Definition $definition)
680
681
681
682
$ code .= $ isProxyCandidate ? $ this ->getProxyDumper ()->getProxyFactoryCode ($ definition , $ id , $ methodName ) : '' ;
682
683
683
- if ($ definition ->isSynthetic ()) {
684
- $ code .= sprintf (" throw new RuntimeException('You have requested a synthetic service ( \"%s \"). The DIC does not know how to construct this service.'); \n } \n" , $ id );
685
- } else {
686
- if ($ definition ->isDeprecated ()) {
687
- $ code .= sprintf (" @trigger_error(%s, E_USER_DEPRECATED); \n\n" , $ this ->export ($ definition ->getDeprecationMessage ($ id )));
688
- }
689
-
690
- $ code .=
691
- $ this ->addServiceInclude ($ id , $ definition ).
692
- $ this ->addServiceLocalTempVariables ($ id , $ definition ).
693
- $ this ->addServiceInlinedDefinitions ($ id , $ definition ).
694
-
8000
$ this ->addServiceInstance ($ id , $ definition ).
695
- $ this ->addServiceInlinedDefinitionsSetup ($ id , $ definition ).
696
- $ this ->addServiceProperties ($ id , $ definition ).
697
- $ this ->addServiceMethodCalls ($ id , $ definition ).
698
- $ this ->addServiceConfigurator ($ id , $ definition ).
699
- $ this ->addServiceReturn ($ id , $ definition )
700
- ;
684
+ if ($ definition ->isDeprecated ()) {
685
+ $ code .= sprintf (" @trigger_error(%s, E_USER_DEPRECATED); \n\n" , $ this ->export ($ definition ->getDeprecationMessage ($ id )));
701
686
}
702
687
688
+ $ code .=
689
+ $ this ->addServiceInclude ($ id , $ definition ).
690
+ $ this ->addServiceLocalTempVariables ($ id , $ definition ).
691
+ $ this ->addServiceInlinedDefinitions ($ id , $ definition ).
692
+ $ this ->addServiceInstance ($ id , $ definition ).
693
+ $ this ->addServiceInlinedDefinitionsSetup ($ id , $ definition ).
694
+ $ this ->addServiceProperties ($ id , $ definition ).
695
+ $ this ->addServiceMethodCalls ($ id , $ definition ).
696
+ $ this ->addServiceConfigurator ($ id , $ definition ).
697
+ $ this ->addServiceReturn ($ id , $ definition )
698
+ ;
699
+
703
700
$ this ->definitionVariables = null ;
704
701
$ this ->referenceVariables = null ;
705
702
@@ -950,7 +947,8 @@ private function addNormalizedIds()
950
947
*/
951
948
private function addMethodMap ()
952
949
{
953
- if (!$ definitions = $ this ->container ->getDefinitions ()) {
950
+ $ definitions = $ this ->container ->getDefinitions ();
951
+ if (!$ definitions || !$ definitions = array_filter ($ definitions , function ($ def ) { return !$ def ->isSynthetic (); })) {
954
952
return '' ;
955
953
}
956
954
0 commit comments