From 5cbe35403ccde5cdddb90660bce63879efa3281e Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 8 Sep 2021 13:52:27 +0200 Subject: [PATCH] [VarDumper] Backport type fixes Signed-off-by: Alexander M. Turek --- .../Component/VarDumper/Cloner/AbstractCloner.php | 8 ++++++++ .../VarDumper/Command/Descriptor/CliDescriptor.php | 11 +---------- src/Symfony/Component/VarDumper/Server/Connection.php | 4 ++++ src/Symfony/Component/VarDumper/Server/DumpServer.php | 6 +++++- src/Symfony/Component/VarDumper/VarDumper.php | 6 ++++++ 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index eca674bda3b12..24c25086fe3a9 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -194,8 +194,16 @@ abstract class AbstractCloner implements ClonerInterface protected $maxString = -1; protected $minDepth = 1; + /** + * @var array> + */ private $casters = []; + + /** + * @var callable|null + */ private $prevErrorHandler; + private $classInfo = []; private $filter = 0; diff --git a/src/Symfony/Component/VarDumper/Command/Descriptor/CliDescriptor.php b/src/Symfony/Component/VarDumper/Command/Descriptor/CliDescriptor.php index 7d9ec0e7ee614..2afaa7bf399e7 100644 --- a/src/Symfony/Component/VarDumper/Command/Descriptor/CliDescriptor.php +++ b/src/Symfony/Component/VarDumper/Command/Descriptor/CliDescriptor.php @@ -11,7 +11,6 @@ namespace Symfony\Component\VarDumper\Command\Descriptor; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -29,12 +28,10 @@ class CliDescriptor implements DumpDescriptorInterface { private $dumper; private $lastIdentifier; - private $supportsHref; public function __construct(CliDumper $dumper) { $this->dumper = $dumper; - $this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref'); } public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void @@ -66,8 +63,7 @@ public function describe(OutputInterface $output, Data $data, array $context, in if (isset($context['source'])) { $source = $context['source']; $sourceInfo = sprintf('%s on line %d', $source['name'], $source['line']); - $fileLink = $source['file_link'] ?? null; - if ($this->supportsHref && $fileLink) { + if ($fileLink = $source['file_link'] ?? null) { $sourceInfo = sprintf('%s', $fileLink, $sourceInfo); } $rows[] = ['source', $sourceInfo]; @@ -77,11 +73,6 @@ public function describe(OutputInterface $output, Data $data, array $context, in $io->table([], $rows); - if (!$this->supportsHref && isset($fileLink)) { - $io->writeln(['Open source in your IDE/browser:', $fileLink]); - $io->newLine(); - } - $this->dumper->dump($data); $io->newLine(); } diff --git a/src/Symfony/Component/VarDumper/Server/Connection.php b/src/Symfony/Component/VarDumper/Server/Connection.php index 55d9214d0f5db..d0611a1f6cdb1 100644 --- a/src/Symfony/Component/VarDumper/Server/Connection.php +++ b/src/Symfony/Component/VarDumper/Server/Connection.php @@ -23,6 +23,10 @@ class Connection { private $host; private $contextProviders; + + /** + * @var resource|null + */ private $socket; /** diff --git a/src/Symfony/Component/VarDumper/Server/DumpServer.php b/src/Symfony/Component/VarDumper/Server/DumpServer.php index 7cb5bf0c48d90..f9735db785caa 100644 --- a/src/Symfony/Component/VarDumper/Server/DumpServer.php +++ b/src/Symfony/Component/VarDumper/Server/DumpServer.php @@ -25,9 +25,13 @@ class DumpServer { private $host; - private $socket; private $logger; + /** + * @var resource|null + */ + private $socket; + public function __construct(string $host, LoggerInterface $logger = null) { if (!str_contains($host, '://')) { diff --git a/src/Symfony/Component/VarDumper/VarDumper.php b/src/Symfony/Component/VarDumper/VarDumper.php index b223e065106d2..a1c63172f0efa 100644 --- a/src/Symfony/Component/VarDumper/VarDumper.php +++ b/src/Symfony/Component/VarDumper/VarDumper.php @@ -32,6 +32,9 @@ */ class VarDumper { + /** + * @var callable|null + */ private static $handler; public static function dump($var) @@ -43,6 +46,9 @@ public static function dump($var) return (self::$handler)($var); } + /** + * @return callable|null + */ public static function setHandler(callable $callable = null) { $prevHandler = self::$handler; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy