bug #25179 [FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed (ogizanagi)
This PR was merged into the 3.3 branch.
Discussion
----------
[FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed
| Q | A
| ------------- | ---
| Branch? | 3.3 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/24634#discussion_r153192689 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Do we need a `"symfony/yaml": "<3.2"` conflict here (the version used in `require-dev`)? Otherwise I'll re-introduce the `!defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')` check instead.
Commits
-------
a44f8a5b1a
[FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed
This commit is contained in:
commit
b568e16d8f
@ -56,6 +56,7 @@ use Symfony\Component\Validator\ConstraintValidatorInterface;
|
|||||||
use Symfony\Component\Validator\ObjectInitializerInterface;
|
use Symfony\Component\Validator\ObjectInitializerInterface;
|
||||||
use Symfony\Component\WebLink\HttpHeaderSerializer;
|
use Symfony\Component\WebLink\HttpHeaderSerializer;
|
||||||
use Symfony\Component\Workflow;
|
use Symfony\Component\Workflow;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FrameworkExtension.
|
* FrameworkExtension.
|
||||||
@ -1172,6 +1173,10 @@ class FrameworkExtension extends Extension
|
|||||||
$container->removeDefinition('serializer.normalizer.object');
|
$container->removeDefinition('serializer.normalizer.object');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!class_exists(Yaml::class)) {
|
||||||
|
$container->removeDefinition('serializer.encoder.yaml');
|
||||||
|
}
|
||||||
|
|
||||||
$serializerLoaders = array();
|
$serializerLoaders = array();
|
||||||
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
|
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
|
||||||
if (!$this->annotationsConfigEnabled) {
|
if (!$this->annotationsConfigEnabled) {
|
||||||
|
Reference in New Issue
Block a user