diff vendor/symfony/serializer/Encoder/JsonDecode.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/JsonDecode.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/serializer/Encoder/JsonDecode.php	Mon Apr 23 09:46:53 2018 +0100
@@ -11,7 +11,7 @@
 
 namespace Symfony\Component\Serializer\Encoder;
 
-use Symfony\Component\Serializer\Exception\UnexpectedValueException;
+use Symfony\Component\Serializer\Exception\NotEncodableValueException;
 
 /**
  * Decodes JSON data.
@@ -20,24 +20,11 @@
  */
 class JsonDecode implements DecoderInterface
 {
-    /**
-     * Specifies if the returned result should be an associative array or a nested stdClass object hierarchy.
-     *
-     * @var bool
-     */
+    protected $serializer;
+
     private $associative;
-
-    /**
-     * Specifies the recursion depth.
-     *
-     * @var int
-     */
     private $recursionDepth;
 
-    private $lastError = JSON_ERROR_NONE;
-
-    protected $serializer;
-
     /**
      * Constructs a new JsonDecode instance.
      *
@@ -73,7 +60,7 @@
      *
      * @return mixed
      *
-     * @throws UnexpectedValueException
+     * @throws NotEncodableValueException
      *
      * @see http://php.net/json_decode json_decode
      */
@@ -87,8 +74,8 @@
 
         $decodedData = json_decode($data, $associative, $recursionDepth, $options);
 
-        if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) {
-            throw new UnexpectedValueException(json_last_error_msg());
+        if (JSON_ERROR_NONE !== json_last_error()) {
+            throw new NotEncodableValueException(json_last_error_msg());
         }
 
         return $decodedData;
@@ -105,8 +92,6 @@
     /**
      * Merges the default options of the Json Decoder with the passed context.
      *
-     * @param array $context
-     *
      * @return array
      */
     private function resolveContext(array $context)