Commit 3c1361c
committed
bug symfony#20590 [DI] Allow null as default env value (sroze)
This PR was squashed before being merged into the 3.2 branch (closes symfony#20590).
Discussion
----------
[DI] Allow null as default env value
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
This PR allows the environment variable default value to be null. The way, we can allow optional environment variables, such as in this example:
```yaml
parameters:
# Default values
env(DATABASE_HOST): database
env(DATABASE_PORT): ~
env(DATABASE_NAME): symfony
env(DATABASE_USERNAME): root
env(DATABASE_PASSWORD): ~
# Database configuration
database_host: "%env(DATABASE_HOST)%"
database_port: "%env(DATABASE_PORT)%"
database_name: "%env(DATABASE_NAME)%"
database_user: "%env(DATABASE_USERNAME)%"
database_password: "%env(DATABASE_PASSWORD)%"
```
Commits
-------
519a471 [DI] Allow null as default env valueFile tree
2 files changed
+27
-5
lines changed- src/Symfony/Component/DependencyInjection
- ParameterBag
- Tests/ParameterBag
2 files changed
+27
-5
lines changedLines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
142 | 164 | | |
0 commit comments