File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212use Enqueue \Null \Symfony \NullTransportFactory ;
1313use Symfony \Component \Config \Definition \Builder \ArrayNodeDefinition ;
1414use Symfony \Component \DependencyInjection \ContainerBuilder ;
15- use Symfony \Component \HttpKernel \Kernel ;
1615use function Enqueue \dsn_to_connection_factory ;
1716
1817class DefaultTransportFactory implements TransportFactoryInterface
@@ -144,20 +143,17 @@ public function getName()
144143 */
145144 private function resolveDSN (ContainerBuilder $ container , $ dsn )
146145 {
147- // Symfony 2.x does not such env syntax
148- if (version_compare (Kernel::VERSION , '3.0 ' , '< ' )) {
149- return $ dsn ;
150- }
146+ if (method_exists ($ container , 'resolveEnvPlaceholders ' )) {
147+ $ dsn = $ container ->resolveEnvPlaceholders ($ dsn );
151148
152- $ dsn = $ container ->resolveEnvPlaceholders ($ dsn );
149+ $ matches = [];
150+ if (preg_match ('/%env\((.*?)\)/ ' , $ dsn , $ matches )) {
151+ if (false === $ realDsn = getenv ($ matches [1 ])) {
152+ throw new \LogicException (sprintf ('The env "%s" var is not defined ' , $ matches [1 ]));
153+ }
153154
154- $ matches = [];
155- if (preg_match ('/%env\((.*?)\)/ ' , $ dsn , $ matches )) {
156- if (false === $ realDsn = getenv ($ matches [1 ])) {
157- throw new \LogicException (sprintf ('The env "%s" var is not defined ' , $ matches [1 ]));
155+ return $ realDsn ;
158156 }
159-
160- return $ realDsn ;
161157 }
162158
163159 return $ dsn ;
You can’t perform that action at this time.
0 commit comments