Skip to content

Commit 42a7c86

Browse files
committed
[VarDumper] Backport type fixes
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent 2aed8e1 commit 42a7c86

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

Cloner/AbstractCloner.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,16 @@ abstract class AbstractCloner implements ClonerInterface
194194
protected $maxString = -1;
195195
protected $minDepth = 1;
196196

197+
/**
198+
* @var array<string, list<callable>>
199+
*/
197200
private $casters = [];
201+
202+
/**
203+
* @var callable|null
204+
*/
198205
private $prevErrorHandler;
206+
199207
private $classInfo = [];
200208
private $filter = 0;
201209

Command/Descriptor/CliDescriptor.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\VarDumper\Command\Descriptor;
1313

14-
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1514
use Symfony\Component\Console\Input\ArrayInput;
1615
use Symfony\Component\Console\Output\OutputInterface;
1716
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -29,12 +28,10 @@ class CliDescriptor implements DumpDescriptorInterface
2928
{
3029
private $dumper;
3130
private $lastIdentifier;
32-
private $supportsHref;
3331

3432
public function __construct(CliDumper $dumper)
3533
{
3634
$this->dumper = $dumper;
37-
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
3835
}
3936

4037
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
6663
if (isset($context['source'])) {
6764
$source = $context['source'];
6865
$sourceInfo = sprintf('%s on line %d', $source['name'], $source['line']);
69-
$fileLink = $source['file_link'] ?? null;
70-
if ($this->supportsHref && $fileLink) {
66+
if ($fileLink = $source['file_link'] ?? null) {
7167
$sourceInfo = sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
7268
}
7369
$rows[] = ['source', $sourceInfo];
@@ -77,11 +73,6 @@ public function describe(OutputInterface $output, Data $data, array $context, in
7773

7874
$io->table([], $rows);
7975

80-
if (!$this->supportsHref && isset($fileLink)) {
81-
$io->writeln(['<info>Open source in your IDE/browser:</info>', $fileLink]);
82-
$io->newLine();
83-
}
84-
8576
$this->dumper->dump($data);
8677
$io->newLine();
8778
}

Server/Connection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class Connection
2323
{
2424
private $host;
2525
private $contextProviders;
26+
27+
/**
28+
* @var resource|null
29+
*/
2630
private $socket;
2731

2832
/**

Server/DumpServer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
class DumpServer
2626
{
2727
private $host;
28-
private $socket;
2928
private $logger;
3029

30+
/**
31+
* @var resource|null
32+
*/
33+
private $socket;
34+
3135
public function __construct(string $host, LoggerInterface $logger = null)
3236
{
3337
if (!str_contains($host, '://')) {

VarDumper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
class VarDumper
3434
{
35+
/**
36+
* @var callable|null
37+
*/
3538
private static $handler;
3639

3740
public static function dump($var)
@@ -43,6 +46,9 @@ public static function dump($var)
4346
return (self::$handler)($var);
4447
}
4548

49+
/**
50+
* @return callable|null
51+
*/
4652
public static function setHandler(callable $callable = null)
4753
{
4854
$prevHandler = self::$handler;

0 commit comments

Comments
 (0)