@@ -187,6 +187,7 @@ public function dump(array $options = array())
187187<?php
188188
189189use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
190+ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
190191
191192// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
192193
@@ -320,7 +321,7 @@ private function addServiceLocalTempVariables(string $cId, Definition $definitio
320321 $ name = $ this ->getNextVariableName ();
321322 $ this ->referenceVariables [$ id ] = new Variable ($ name );
322323
323- $ reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE == = $ behavior [$ id ] ? new Reference ($ id , $ behavior [$ id ]) : null ;
324+ $ reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE > = $ behavior [$ id ] ? new Reference ($ id , $ behavior [$ id ]) : null ;
324325 $ code .= sprintf (" \$%s = %s; \n" , $ name , $ this ->getServiceCall ($ id , $ reference ));
325326 }
326327
@@ -552,7 +553,7 @@ private function isTrivialInstance(Definition $definition): bool
552553 if ($ definition ->isSynthetic () || $ definition ->getFile () || $ definition ->getMethodCalls () || $ definition ->getProperties () || $ definition ->getConfigurator ()) {
553554 return false ;
554555 }
555- if ($ definition ->isDeprecated () || $ definition ->isLazy () || $ definition ->getFactory () || 3 < count ($ definition ->getArguments ())) {
556+ if ($ definition ->isDeprecated () || $ definition ->isLazy () || $ definition ->getFactory () || 3 < count ($ definition ->getArguments ()) || $ definition -> getErrors () ) {
556557 return false ;
557558 }
558559
@@ -738,6 +739,12 @@ protected function {$methodName}($lazyInitialization)
738739EOF ;
739740 }
740741
742+ if ($ e = $ definition ->getErrors ()) {
743+ $ e = sprintf ("throw new RuntimeException(%s); \n" , $ this ->export (reset ($ e )));
744+
745+ return $ asFile ? substr ($ code , 8 ).$ e : $ code .' ' .$ e ." } \n" ;
746+ }
747+
741748 $ inlinedDefinitions = $ this ->getDefinitionsFromArguments (array ($ definition ));
742749 $ constructorDefinitions = $ this ->getDefinitionsFromArguments (array ($ definition ->getArguments (), $ definition ->getFactory ()));
743750 $ otherDefinitions = new \SplObjectStorage ();
@@ -1470,7 +1477,7 @@ private function dumpValue($value, bool $interpolate = true): string
14701477
14711478 $ returnedType = '' ;
14721479 if ($ value instanceof TypedReference) {
1473- $ returnedType = sprintf (': %s\%s ' , ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE == = $ value ->getInvalidBehavior () ? '' : '? ' , $ value ->getType ());
1480+ $ returnedType = sprintf (': %s\%s ' , ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE > = $ value ->getInvalidBehavior () ? '' : '? ' , $ value ->getType ());
14741481 }
14751482
14761483 $ code = sprintf ('return %s; ' , $ code );
@@ -1675,7 +1682,7 @@ private function getServiceCall(string $id, Reference $reference = null): string
16751682 if (null !== $ reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $ reference ->getInvalidBehavior ()) {
16761683 return 'null ' ;
16771684 }
1678- if (null !== $ reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $ reference ->getInvalidBehavior ()) {
1685+ if (null !== $ reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $ reference ->getInvalidBehavior ()) {
16791686 $ code = sprintf ('$this->get( \'%s \', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d) ' , $ id , ContainerInterface::NULL_ON_INVALID_REFERENCE );
16801687 } else {
16811688 $ code = sprintf ('$this->get( \'%s \') ' , $ id );
0 commit comments