diff vendor/symfony/serializer/Encoder/YamlEncoder.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/serializer/Encoder/YamlEncoder.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/serializer/Encoder/YamlEncoder.php	Mon Apr 23 09:46:53 2018 +0100
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Serializer\Encoder;
 
+use Symfony\Component\Serializer\Exception\RuntimeException;
 use Symfony\Component\Yaml\Dumper;
 use Symfony\Component\Yaml\Parser;
 
@@ -29,6 +30,10 @@
 
     public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array())
     {
+        if (!class_exists(Dumper::class)) {
+            throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.');
+        }
+
         $this->dumper = $dumper ?: new Dumper();
         $this->parser = $parser ?: new Parser();
         $this->defaultContext = array_merge($this->defaultContext, $defaultContext);