diff vendor/symfony/var-dumper/Cloner/AbstractCloner.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children c2387f117808
line wrap: on
line diff
--- a/vendor/symfony/var-dumper/Cloner/AbstractCloner.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/vendor/symfony/var-dumper/Cloner/AbstractCloner.php	Fri Feb 23 15:52:07 2018 +0000
@@ -109,6 +109,11 @@
         'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'),
         'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'),
 
+        'DateTimeInterface' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'),
+        'DateInterval' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'),
+        'DateTimeZone' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'),
+        'DatePeriod' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'),
+
         ':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'),
         ':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
         ':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
@@ -127,6 +132,7 @@
 
     protected $maxItems = 2500;
     protected $maxString = -1;
+    protected $minDepth = 1;
     protected $useExt;
 
     private $casters = array();
@@ -166,7 +172,7 @@
     }
 
     /**
-     * Sets the maximum number of items to clone past the first level in nested structures.
+     * Sets the maximum number of items to clone past the minimum depth in nested structures.
      *
      * @param int $maxItems
      */
@@ -186,6 +192,17 @@
     }
 
     /**
+     * Sets the minimum tree depth where we are guaranteed to clone all the items.  After this
+     * depth is reached, only setMaxItems items will be cloned.
+     *
+     * @param int $minDepth
+     */
+    public function setMinDepth($minDepth)
+    {
+        $this->minDepth = (int) $minDepth;
+    }
+
+    /**
      * Clones a PHP variable.
      *
      * @param mixed $var    Any PHP variable
@@ -195,7 +212,7 @@
      */
     public function cloneVar($var, $filter = 0)
     {
-        $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) {
+        $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) {
             if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
                 // Cloner never dies
                 throw new \ErrorException($msg, 0, $type, $file, $line);