Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01a3925

Browse filesBrowse files
[VarDumper] add types to all arguments
1 parent d9f0467 commit 01a3925
Copy full SHA for 01a3925
Expand file treeCollapse file tree

18 files changed

+48
-68
lines changed

‎src/Symfony/Component/VarDumper/Caster/CutStub.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/CutStub.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class CutStub extends Stub
2222
{
23-
public function __construct($value)
23+
public function __construct(mixed $value)
2424
{
2525
$this->value = $value;
2626

‎src/Symfony/Component/VarDumper/Caster/DsPairStub.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/DsPairStub.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class DsPairStub extends Stub
2020
{
21-
public function __construct($key, $value)
21+
public function __construct(string|int $key, mixed $value)
2222
{
2323
$this->value = [
2424
Caster::PREFIX_VIRTUAL.'key' => $key,

‎src/Symfony/Component/VarDumper/Caster/LinkStub.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/LinkStub.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LinkStub extends ConstStub
2323
private static $vendorRoots;
2424
private static $composerRoots;
2525

26-
public function __construct($label, int $line = 0, $href = null)
26+
public function __construct($label, int $line = 0, mixed $href = null)
2727
{
2828
$this->value = $label;
2929

‎src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
class RdKafkaCaster
3333
{
34-
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, $isNested)
34+
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested)
3535
{
3636
$prefix = Caster::PREFIX_VIRTUAL;
3737

@@ -51,7 +51,7 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub,
5151
return $a;
5252
}
5353

54-
public static function castTopic(Topic $c, array $a, Stub $stub, $isNested)
54+
public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested)
5555
{
5656
$prefix = Caster::PREFIX_VIRTUAL;
5757

@@ -75,7 +75,7 @@ public static function castTopicPartition(TopicPartition $c, array $a)
7575
return $a;
7676
}
7777

78-
public static function castMessage(Message $c, array $a, Stub $stub, $isNested)
78+
public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested)
7979
{
8080
$prefix = Caster::PREFIX_VIRTUAL;
8181

@@ -86,7 +86,7 @@ public static function castMessage(Message $c, array $a, Stub $stub, $isNested)
8686
return $a;
8787
}
8888

89-
public static function castConf(Conf $c, array $a, Stub $stub, $isNested)
89+
public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested)
9090
{
9191
$prefix = Caster::PREFIX_VIRTUAL;
9292

@@ -97,7 +97,7 @@ public static function castConf(Conf $c, array $a, Stub $stub, $isNested)
9797
return $a;
9898
}
9999

100-
public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNested)
100+
public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested)
101101
{
102102
$prefix = Caster::PREFIX_VIRTUAL;
103103

@@ -108,7 +108,7 @@ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNest
108108
return $a;
109109
}
110110

111-
public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested)
111+
public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested)
112112
{
113113
$prefix = Caster::PREFIX_VIRTUAL;
114114

@@ -121,14 +121,14 @@ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested)
121121
return $a;
122122
}
123123

124-
public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, $isNested)
124+
public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested)
125125
{
126126
$a += iterator_to_array($c);
127127

128128
return $a;
129129
}
130130

131-
public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, $isNested)
131+
public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested)
132132
{
133133
$prefix = Caster::PREFIX_VIRTUAL;
134134

@@ -140,7 +140,7 @@ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub,
140140
return $a;
141141
}
142142

143-
public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, $isNested)
143+
public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested)
144144
{
145145
$prefix = Caster::PREFIX_VIRTUAL;
146146

@@ -153,7 +153,7 @@ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stu
153153
return $a;
154154
}
155155

156-
public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, $isNested)
156+
public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested)
157157
{
158158
$prefix = Caster::PREFIX_VIRTUAL;
159159

@@ -166,7 +166,7 @@ public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stu
166166
return $a;
167167
}
168168

169-
private static function extractMetadata($c)
169+
private static function extractMetadata(KafkaConsumer|\RdKafka $c)
170170
{
171171
$prefix = Caster::PREFIX_VIRTUAL;
172172

‎src/Symfony/Component/VarDumper/Caster/RedisCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/RedisCaster.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub,
102102
return $a;
103103
}
104104

105-
/**
106-
* @param \Redis|\RedisArray|\RedisCluster $redis
107-
*/
108-
private static function getRedisOptions($redis, array $options = []): EnumStub
105+
private static function getRedisOptions(\Redis|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub
109106
{
110107
$serializer = $redis->getOption(\Redis::OPT_SERIALIZER);
111108
if (\is_array($serializer)) {

‎src/Symfony/Component/VarDumper/Caster/ResourceCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/ResourceCaster.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function castStreamContext($stream, array $a, Stub $stub, bool $is
6060
return @stream_context_get_params($stream) ?: $a;
6161
}
6262

63-
public static function castGd($gd, array $a, Stub $stub, $isNested)
63+
public static function castGd($gd, array $a, Stub $stub, bool $isNested)
6464
{
6565
$a['size'] = imagesx($gd).'x'.imagesy($gd);
6666
$a['trueColor'] = imageistruecolor($gd);

‎src/Symfony/Component/VarDumper/Caster/SplCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/SplCaster.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub
3939
return self::castSplArray($c, $a, $stub, $isNested);
4040
}
4141

42-
public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
42+
public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested)
4343
{
4444
$a += [
4545
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),

‎src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,11 @@ public function setMinDepth(int $minDepth)
253253
/**
254254
* Clones a PHP variable.
255255
*
256-
* @param mixed $var Any PHP variable
257-
* @param int $filter A bit field of Caster::EXCLUDE_* constants
256+
* @param int $filter A bit field of Caster::EXCLUDE_* constants
258257
*
259258
* @return Data The cloned variable represented by a Data object
260259
*/
261-
public function cloneVar($var, int $filter = 0)
260+
public function cloneVar(mixed $var, int $filter = 0)
262261
{
263262
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
264263
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
@@ -291,11 +290,9 @@ public function cloneVar($var, int $filter = 0)
291290
/**
292291
* Effectively clones the PHP variable.
293292
*
294-
* @param mixed $var Any PHP variable
295-
*
296293
* @return array The cloned variable represented in an array
297294
*/
298-
abstract protected function doClone($var);
295+
abstract protected function doClone(mixed $var);
299296

300297
/**
301298
* Casts an object to an array representation.

‎src/Symfony/Component/VarDumper/Cloner/ClonerInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/ClonerInterface.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ interface ClonerInterface
1919
/**
2020
* Clones a PHP variable.
2121
*
22-
* @param mixed $var Any PHP variable
23-
*
2422
* @return Data The cloned variable represented by a Data object
2523
*/
26-
public function cloneVar($var);
24+
public function cloneVar(mixed $var);
2725
}

‎src/Symfony/Component/VarDumper/Cloner/Data.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/Data.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getType()
6969
*
7070
* @return string|int|float|bool|array|Data[]|null A native representation of the original value
7171
*/
72-
public function getValue($recursive = false)
72+
public function getValue(array|bool $recursive = false)
7373
{
7474
$item = $this->data[$this->position][$this->key];
7575

@@ -239,11 +239,9 @@ public function withContext(array $context)
239239
/**
240240
* Seeks to a specific key in nested data structures.
241241
*
242-
* @param string|int $key The key to seek to
243-
*
244242
* @return static|null Null if the key is not set
245243
*/
246-
public function seek($key)
244+
public function seek(string|int $key)
247245
{
248246
$item = $this->data[$this->position][$this->key];
249247

@@ -309,7 +307,7 @@ public function dump(DumperInterface $dumper)
309307
*
310308
* @param mixed $item A Stub object or the original value being dumped
311309
*/
312-
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, $item)
310+
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item)
313311
{
314312
$cursor->refIndex = 0;
315313
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
@@ -431,7 +429,7 @@ private function dumpChildren(DumperInterface $dumper, Cursor $parentCursor, arr
431429
return $hashCut;
432430
}
433431

434-
private function getStub($item)
432+
private function getStub(mixed $item)
435433
{
436434
if (!$item || !\is_array($item)) {
437435
return $item;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.