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
feature symfony#18626 [Yaml] Added support for parsing PHP constants (HeahDude)
This PR was merged into the 3.2-dev branch.
Discussion
----------
[Yaml] Added support for parsing PHP constants
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | TODO
Commits
-------
17ec26e [DI] added support for PHP constants in yaml configuration files
02d1dea [Yaml] added support for parsing PHP constants
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ CHANGELOG
5
5
-----
6
6
7
7
* allowed to prioritize compiler passes by introducing a third argument to `PassConfig::addPass()`, to `Compiler::addPass` and to `ContainerBuilder::addCompilerPass()`
8
+
* added support for PHP constants in YAML configuration files
thrownewParseException('Object support when parsing a YAML file has been disabled.');
581
583
}
582
584
585
+
return;
586
+
case0 === strpos($scalar, '!php/const:'):
587
+
if (self::$constantSupport) {
588
+
if (defined($const = substr($scalar, 11))) {
589
+
returnconstant($const);
590
+
}
591
+
592
+
thrownewParseException(sprintf('The constant "%s" is not defined.', $const));
593
+
}
594
+
if (self::$exceptionOnInvalidType) {
595
+
thrownewParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar));
0 commit comments