You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #40903 [Config] Builder: Remove typehints and allow for EnvConfigurator (Nyholm)
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Config] Builder: Remove typehints and allow for EnvConfigurator
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes -- maybe
| New feature? | no -- maybe =)
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
When [writing documentation](symfony/symfony-docs#15269 (comment)) we found that we don't really support environment variables in the leaves. Ie, we expect a boolean but you provide `"%env(ENABLE_FOO)%"`
This PR will also introduce `ParamConfigurator` to allow parameters to be passed as config.
The changes to the generated code:
```diff
/**
+ * `@param` bool|ParamConfigurator $value
* `@default` false
* `@return` $this
*/
- public function enabled(bool $value): self
+ public function enabled($value): self
{
$this->enabled = $value;
return $this;
}
```
Commits
-------
59b79d3 [Config] Builder: Remove typehints and allow for EnvConfigurator
@@ -134,20 +136,22 @@ public function NAME(array $value = []): CLASS
134
136
if (null === $this->PROPERTY) {
135
137
$this->PROPERTY = new CLASS($value);
136
138
} elseif ([] !== $value) {
137
-
throw new \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
139
+
throw new InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
@@ -227,31 +233,33 @@ public function NAME(string $VAR, array $VALUE = []): CLASS
227
233
return $this->PROPERTY[$VAR];
228
234
}
229
235
230
-
throw new \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
236
+
throw new InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
@@ -387,9 +401,10 @@ private function buildConstructor(ClassBuilder $class): void
387
401
388
402
$body .= '
389
403
if ($value !== []) {
390
-
throw new \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException(sprintf(\'The following keys are not supported by "%s": \', __CLASS__) . implode(\', \', array_keys($value)));
404
+
throw new InvalidConfigurationException(sprintf(\'The following keys are not supported by "%s": \', __CLASS__) . implode(\', \', array_keys($value)));
0 commit comments