diff vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents 5311817fb629
children 12f9dff5fda9
line wrap: on
line diff
--- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php	Thu Feb 28 11:14:44 2019 +0000
+++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php	Thu Feb 28 13:11:55 2019 +0000
@@ -18,8 +18,8 @@
 use Symfony\Component\VarDumper\Cloner\Data;
 use Symfony\Component\VarDumper\Cloner\VarCloner;
 use Symfony\Component\VarDumper\Dumper\CliDumper;
+use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
 use Symfony\Component\VarDumper\Dumper\HtmlDumper;
-use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
 use Twig\Template;
 
 /**
@@ -49,12 +49,12 @@
         $this->dumperIsInjected = null !== $dumper;
 
         // All clones share these properties by reference:
-        $this->rootRefs = array(
+        $this->rootRefs = [
             &$this->data,
             &$this->dataCount,
             &$this->isCollected,
             &$this->clonesCount,
-        );
+        ];
     }
 
     public function __clone()
@@ -103,9 +103,9 @@
 
                             if ($src) {
                                 $src = explode("\n", $src);
-                                $fileExcerpt = array();
+                                $fileExcerpt = [];
 
-                                for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) {
+                                for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) {
                                     $fileExcerpt[] = '<li'.($i === $line ? ' class="selected"' : '').'><code>'.$this->htmlEncode($src[$i - 1]).'</code></li>';
                                 }
 
@@ -153,7 +153,7 @@
         ) {
             if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) {
                 $this->dumper = new HtmlDumper('php://output', $this->charset);
-                $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+                $this->dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
             } else {
                 $this->dumper = new CliDumper('php://output', $this->charset);
             }
@@ -169,13 +169,16 @@
         if ($this->stopwatch) {
             $this->stopwatch->reset();
         }
-        $this->data = array();
+        $this->data = [];
         $this->dataCount = 0;
         $this->isCollected = true;
         $this->clonesCount = 0;
         $this->clonesIndex = 0;
     }
 
+    /**
+     * @internal
+     */
     public function serialize()
     {
         if ($this->clonesCount !== $this->clonesIndex) {
@@ -185,7 +188,7 @@
         $this->data[] = $this->fileLinkFormat;
         $this->data[] = $this->charset;
         $ser = serialize($this->data);
-        $this->data = array();
+        $this->data = [];
         $this->dataCount = 0;
         $this->isCollected = true;
         if (!$this->dumperIsInjected) {
@@ -195,12 +198,15 @@
         return $ser;
     }
 
+    /**
+     * @internal
+     */
     public function unserialize($data)
     {
-        parent::unserialize($data);
+        $this->data = unserialize($data);
         $charset = array_pop($this->data);
         $fileLinkFormat = array_pop($this->data);
-        $this->dataCount = count($this->data);
+        $this->dataCount = \count($this->data);
         self::__construct($this->stopwatch, $fileLinkFormat, $charset);
     }
 
@@ -215,11 +221,11 @@
 
         if ('html' === $format) {
             $dumper = new HtmlDumper($data, $this->charset);
-            $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+            $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
         } else {
             throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
         }
-        $dumps = array();
+        $dumps = [];
 
         foreach ($this->data as $dump) {
             $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
@@ -244,15 +250,15 @@
             $this->isCollected = true;
 
             $h = headers_list();
-            $i = count($h);
+            $i = \count($h);
             array_unshift($h, 'Content-Type: '.ini_get('default_mimetype'));
             while (0 !== stripos($h[$i], 'Content-Type:')) {
                 --$i;
             }
 
-            if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
+            if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html')) {
                 $this->dumper = new HtmlDumper('php://output', $this->charset);
-                $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+                $this->dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
             } else {
                 $this->dumper = new CliDumper('php://output', $this->charset);
             }
@@ -262,7 +268,7 @@
                 $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
             }
 
-            $this->data = array();
+            $this->data = [];
             $this->dataCount = 0;
         }
     }
@@ -276,7 +282,7 @@
                         $s = $this->style('meta', '%s');
                         $f = strip_tags($this->style('', $file));
                         $name = strip_tags($this->style('', $name));
-                        if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
+                        if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
                             $name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
                         } else {
                             $name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);