Skip to content

Commit bfeaa20

Browse files
wouterjnicolas-grekas
authored andcommitted
Add void return types
1 parent 20963cf commit bfeaa20

File tree

11 files changed

+64
-13
lines changed

11 files changed

+64
-13
lines changed

Caster/RdKafkaCaster.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
*/
3232
class RdKafkaCaster
3333
{
34+
/**
35+
* @return array
36+
*/
3437
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested)
3538
{
3639
$prefix = Caster::PREFIX_VIRTUAL;
@@ -123,6 +126,9 @@ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $i
123126
return $a;
124127
}
125128

129+
/**
130+
* @return array
131+
*/
126132
public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested)
127133
{
128134
$prefix = Caster::PREFIX_VIRTUAL;

Caster/ReflectionCaster.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function unsetClosureFileInfo(\Closure $c, array $a)
8484
return $a;
8585
}
8686

87-
public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested)
87+
public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested): array
8888
{
8989
// Cannot create ReflectionGenerator based on a terminated Generator
9090
try {
@@ -447,7 +447,7 @@ public static function getSignature(array $a)
447447
return $signature;
448448
}
449449

450-
private static function addExtra(array &$a, \Reflector $c)
450+
private static function addExtra(array &$a, \Reflector $c): void
451451
{
452452
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : [];
453453

@@ -463,7 +463,7 @@ private static function addExtra(array &$a, \Reflector $c)
463463
}
464464
}
465465

466-
private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL)
466+
private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL): void
467467
{
468468
foreach ($map as $k => $m) {
469469
if ('isDisabled' === $k) {

Caster/ResourceCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function castProcess($process, array $a, Stub $stub, bool $isNeste
4646
return proc_get_status($process);
4747
}
4848

49-
public static function castStream($stream, array $a, Stub $stub, bool $isNested)
49+
public static function castStream($stream, array $a, Stub $stub, bool $isNested): array
5050
{
5151
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
5252
if ($a['uri'] ?? false) {

Cloner/AbstractCloner.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ public function __construct(array $casters = null)
232232
* see e.g. static::$defaultCasters.
233233
*
234234
* @param callable[] $casters A map of casters
235+
*
236+
* @return void
235237
*/
236238
public function addCasters(array $casters)
237239
{
@@ -242,6 +244,8 @@ public function addCasters(array $casters)
242244

243245
/**
244246
* Sets the maximum number of items to clone past the minimum depth in nested structures.
247+
*
248+
* @return void
245249
*/
246250
public function setMaxItems(int $maxItems)
247251
{
@@ -250,6 +254,8 @@ public function setMaxItems(int $maxItems)
250254

251255
/**
252256
* Sets the maximum cloned length for strings.
257+
*
258+
* @return void
253259
*/
254260
public function setMaxString(int $maxString)
255261
{
@@ -259,6 +265,8 @@ public function setMaxString(int $maxString)
259265
/**
260266
* Sets the minimum tree depth where we are guaranteed to clone all the items. After this
261267
* depth is reached, only setMaxItems items will be cloned.
268+
*
269+
* @return void
262270
*/
263271
public function setMinDepth(int $minDepth)
264272
{

Cloner/Data.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ public function seek(string|int $key): ?static
262262

263263
/**
264264
* Dumps data with a DumperInterface dumper.
265+
*
266+
* @return void
265267
*/
266268
public function dump(DumperInterface $dumper)
267269
{
@@ -286,7 +288,7 @@ public function dump(DumperInterface $dumper)
286288
*
287289
* @param mixed $item A Stub object or the original value being dumped
288290
*/
289-
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item)
291+
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void
290292
{
291293
$cursor->refIndex = 0;
292294
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;

Command/ServerDumpCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(DumpServer $server, array $descriptors = [])
5454
parent::__construct();
5555
}
5656

57-
protected function configure()
57+
protected function configure(): void
5858
{
5959
$this
6060
->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli')

Dumper/AbstractDumper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public function dump(Data $data, $output = null): ?string
155155
*
156156
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
157157
* or -1 to signal the end-of-dump to the line dumper callable
158+
*
159+
* @return void
158160
*/
159161
protected function dumpLine(int $depth)
160162
{
@@ -164,6 +166,8 @@ protected function dumpLine(int $depth)
164166

165167
/**
166168
* Generic line dumper callback.
169+
*
170+
* @return void
167171
*/
168172
protected function echoLine(string $line, int $depth, string $indentPad)
169173
{

Dumper/CliDumper.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public function __construct($output = null, string $charset = null, int $flags =
8686

8787
/**
8888
* Enables/disables colored output.
89+
*
90+
* @return void
8991
*/
9092
public function setColors(bool $colors)
9193
{
@@ -94,6 +96,8 @@ public function setColors(bool $colors)
9496

9597
/**
9698
* Sets the maximum number of characters per line for dumped strings.
99+
*
100+
* @return void
97101
*/
98102
public function setMaxStringWidth(int $maxStringWidth)
99103
{
@@ -104,6 +108,8 @@ public function setMaxStringWidth(int $maxStringWidth)
104108
* Configures styles.
105109
*
106110
* @param array $styles A map of style names to style definitions
111+
*
112+
* @return void
107113
*/
108114
public function setStyles(array $styles)
109115
{
@@ -114,12 +120,17 @@ public function setStyles(array $styles)
114120
* Configures display options.
115121
*
116122
* @param array $displayOptions A map of display options to customize the behavior
123+
*
124+
* @return void
117125
*/
118126
public function setDisplayOptions(array $displayOptions)
119127
{
120128
$this->displayOptions = $displayOptions + $this->displayOptions;
121129
}
122130

131+
/**
132+
* @return void
133+
*/
123134
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value)
124135
{
125136
$this->dumpKey($cursor);
@@ -175,6 +186,9 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n
175186
$this->endValue($cursor);
176187
}
177188

189+
/**
190+
* @return void
191+
*/
178192
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
179193
{
180194
$this->dumpKey($cursor);
@@ -260,6 +274,9 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
260274
}
261275
}
262276

277+
/**
278+
* @return void
279+
*/
263280
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild)
264281
{
265282
$this->colors ??= $this->supportsColors();
@@ -296,6 +313,9 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo
296313
}
297314
}
298315

316+
/**
317+
* @return void
318+
*/
299319
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut)
300320
{
301321
if (empty($cursor->attr['cut_hash'])) {
@@ -311,6 +331,8 @@ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, boo
311331
*
312332
* @param bool $hasChild When the dump of the hash has child item
313333
* @param int $cut The number of items the hash has been cut by
334+
*
335+
* @return void
314336
*/
315337
protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut)
316338
{
@@ -327,6 +349,8 @@ protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut)
327349

328350
/**
329351
* Dumps a key in a hash structure.
352+
*
353+
* @return void
330354
*/
331355
protected function dumpKey(Cursor $cursor)
332356
{
@@ -530,6 +554,9 @@ protected function supportsColors(): bool
530554
return static::$defaultColors = $this->hasColorSupport($h);
531555
}
532556

557+
/**
558+
* @return void
559+
*/
533560
protected function dumpLine(int $depth, bool $endOfValue = false)
534561
{
535562
if ($this->colors) {
@@ -538,6 +565,9 @@ protected function dumpLine(int $depth, bool $endOfValue = false)
538565
parent::dumpLine($depth);
539566
}
540567

568+
/**
569+
* @return void
570+
*/
541571
protected function endValue(Cursor $cursor)
542572
{
543573
if (-1 === $cursor->hashType) {

Dumper/ContextualizedDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public function __construct(DataDumperInterface $wrappedDumper, array $contextPr
3131
$this->contextProviders = $contextProviders;
3232
}
3333

34+
/**
35+
* @return void
36+
*/
3437
public function dump(Data $data)
3538
{
3639
$context = $data->getContext();

Dumper/ServerDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public function getContextProviders(): array
4141
return $this->connection->getContextProviders();
4242
}
4343

44+
/**
45+
* @return void
46+
*/
4447
public function dump(Data $data)
4548
{
4649
if (!$this->connection->write($data) && $this->wrappedDumper) {

0 commit comments

Comments
 (0)