File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/Symfony/Component/DependencyInjection Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function process(ContainerBuilder $container)
48
48
foreach ($ resolvingBag ->getEnvPlaceholders () + $ resolvingBag ->getUnusedEnvPlaceholders () as $ env => $ placeholders ) {
49
49
$ values = array ();
50
50
if (false === $ i = strpos ($ env , ': ' )) {
51
- $ default = $ defaultBag ->has ("env( $ env) " ) ? $ defaultBag ->get ("env( $ env) " ) : null ;
51
+ $ default = $ defaultBag ->has ("env( $ env) " ) ? $ defaultBag ->get ("env( $ env) " ) : self :: $ typeFixtures [ ' string ' ] ;
52
52
$ defaultType = null !== $ default ? self ::getType ($ default ) : 'string ' ;
53
53
$ values [$ defaultType ] = $ default ;
54
54
} else {
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public function testDefaultEnvWithoutPrefixIsValidatedInConfig()
48
48
$ container ->registerExtension ($ ext = new EnvExtension ());
49
49
$ container ->prependExtensionConfig ('env_extension ' , $ expected = array (
50
50
'float_node ' => '%env(FLOATISH)% ' ,
51
+ 'string_node ' => '%env(UNDEFINED)% ' ,
51
52
));
52
53
53
54
$ this ->doProcess ($ container );
@@ -311,6 +312,14 @@ public function getConfigTreeBuilder()
311
312
->arrayNode ('simple_array_node ' )->end ()
312
313
->enumNode ('enum_node ' )->values (array ('a ' , 'b ' ))->end ()
313
314
->variableNode ('variable_node ' )->end ()
315
+ ->scalarNode ('string_node ' )
316
+ ->validate ()
317
+ ->ifTrue (function ($ value ) {
318
+ return !\is_string ($ value );
319
+ })
320
+ ->thenInvalid ('%s is not a string ' )
321
+ ->end ()
322
+ ->end ()
314
323
->end ();
315
324
316
325
return $ treeBuilder ;
You can’t perform that action at this time.
0 commit comments