Skip to content

Commit b568e16

Browse files
committed
bug symfony#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 | symfony#24634 (comment) <!-- #-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 ------- a44f8a5 [FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed
2 parents 8555c0b + a44f8a5 commit b568e16

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
use Symfony\Component\Validator\ObjectInitializerInterface;
5757
use Symfony\Component\WebLink\HttpHeaderSerializer;
5858
use Symfony\Component\Workflow;
59+
use Symfony\Component\Yaml\Yaml;
5960

6061
/**
6162
* FrameworkExtension.
@@ -1172,6 +1173,10 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
11721173
$container->removeDefinition('serializer.normalizer.object');
11731174
}
11741175

1176+
if (!class_exists(Yaml::class)) {
1177+
$container->removeDefinition('serializer.encoder.yaml');
1178+
}
1179+
11751180
$serializerLoaders = array();
11761181
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
11771182
if (!$this->annotationsConfigEnabled) {

0 commit comments

Comments
 (0)