diff vendor/symfony/var-dumper/Cloner/VarCloner.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 7a779792577d
children af1871eacc83
line wrap: on
line diff
--- a/vendor/symfony/var-dumper/Cloner/VarCloner.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/var-dumper/Cloner/VarCloner.php	Thu Feb 28 13:21:36 2019 +0000
@@ -19,7 +19,7 @@
     private static $gid;
     private static $hashMask = 0;
     private static $hashOffset = 0;
-    private static $arrayCache = array();
+    private static $arrayCache = [];
 
     /**
      * {@inheritdoc}
@@ -29,19 +29,19 @@
         $len = 1;                       // Length of $queue
         $pos = 0;                       // Number of cloned items past the minimum depth
         $refsCounter = 0;               // Hard references counter
-        $queue = array(array($var));    // This breadth-first queue is the return value
-        $indexedArrays = array();       // Map of queue indexes that hold numerically indexed arrays
-        $hardRefs = array();            // Map of original zval hashes to stub objects
-        $objRefs = array();             // Map of original object handles to their stub object couterpart
-        $resRefs = array();             // Map of original resource handles to their stub object couterpart
-        $values = array();              // Map of stub objects' hashes to original values
+        $queue = [[$var]];    // This breadth-first queue is the return value
+        $indexedArrays = [];       // Map of queue indexes that hold numerically indexed arrays
+        $hardRefs = [];            // Map of original zval hashes to stub objects
+        $objRefs = [];             // Map of original object handles to their stub object counterpart
+        $resRefs = [];             // Map of original resource handles to their stub object counterpart
+        $values = [];              // Map of stub objects' hashes to original values
         $maxItems = $this->maxItems;
         $maxString = $this->maxString;
         $minDepth = $this->minDepth;
         $currentDepth = 0;              // Current tree depth
         $currentDepthFinalIndex = 0;    // Final $queue index for current tree depth
         $minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
-        $cookie = (object) array();     // Unique object used to detect hard references
+        $cookie = (object) [];     // Unique object used to detect hard references
         $a = null;                      // Array cast for nested structures
         $stub = null;                   // Stub capturing the main properties of an original item value
                                         // or null if the original value is used directly
@@ -74,7 +74,7 @@
                     if (\is_int($k)) {
                         continue;
                     }
-                    foreach (array($k => true) as $gk => $gv) {
+                    foreach ([$k => true] as $gk => $gv) {
                     }
                     if ($gk !== $k) {
                         $fromObjCast = true;
@@ -163,7 +163,7 @@
                             // Happens with copies of $GLOBALS
                             if (isset($v[$gid])) {
                                 unset($v[$gid]);
-                                $a = array();
+                                $a = [];
                                 foreach ($v as $gk => &$gv) {
                                     $a[$gk] = &$gv;
                                 }
@@ -254,12 +254,12 @@
 
                 if ($arrayStub === $stub) {
                     if ($arrayStub->cut) {
-                        $stub = array($arrayStub->cut, $arrayStub->class => $arrayStub->position);
+                        $stub = [$arrayStub->cut, $arrayStub->class => $arrayStub->position];
                         $arrayStub->cut = 0;
                     } elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) {
                         $stub = self::$arrayCache[$arrayStub->class][$arrayStub->position];
                     } else {
-                        self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = array($arrayStub->class => $arrayStub->position);
+                        self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = [$arrayStub->class => $arrayStub->position];
                     }
                 }
 
@@ -273,10 +273,10 @@
             if ($fromObjCast) {
                 $fromObjCast = false;
                 $refs = $vals;
-                $vals = array();
+                $vals = [];
                 $j = -1;
                 foreach ($queue[$i] as $k => $v) {
-                    foreach (array($k => true) as $gk => $gv) {
+                    foreach ([$k => true] as $gk => $gv) {
                     }
                     if ($gk !== $k) {
                         $vals = (object) $vals;
@@ -300,17 +300,17 @@
 
     private static function initHashMask()
     {
-        $obj = (object) array();
+        $obj = (object) [];
         self::$hashOffset = 16 - PHP_INT_SIZE;
         self::$hashMask = -1;
 
-        if (defined('HHVM_VERSION')) {
+        if (\defined('HHVM_VERSION')) {
             self::$hashOffset += 16;
         } else {
             // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
-            $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
+            $obFuncs = ['ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'];
             foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
-                if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
+                if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) {
                     $frame['line'] = 0;
                     break;
                 }