Skip to content

Commit 2a46264

Browse files
wouterjnicolas-grekas
authored andcommitted
Add void return types
1 parent 6b46eae commit 2a46264

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

ClassExistsMock.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class ClassExistsMock
2424
* Configures the classes to be checked upon existence.
2525
*
2626
* @param array $classes Mocked class names as keys (case-sensitive, without leading root namespace slash) and booleans as values
27+
*
28+
* @return void
2729
*/
2830
public static function withMockedClasses(array $classes)
2931
{
@@ -34,6 +36,8 @@ public static function withMockedClasses(array $classes)
3436
* Configures the enums to be checked upon existence.
3537
*
3638
* @param array $enums Mocked enums names as keys (case-sensitive, without leading root namespace slash) and booleans as values
39+
*
40+
* @return void
3741
*/
3842
public static function withMockedEnums(array $enums)
3943
{
@@ -81,6 +85,9 @@ public static function enum_exists($name, $autoload = true)
8185
return isset(self::$enums[$name]) ? (bool) self::$enums[$name] : \enum_exists($name, $autoload);
8286
}
8387

88+
/**
89+
* @return void
90+
*/
8491
public static function register($class)
8592
{
8693
$self = static::class;

ClockMock.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static function sleep($s)
5959
return 0;
6060
}
6161

62+
/**
63+
* @return void
64+
*/
6265
public static function usleep($us)
6366
{
6467
if (null === self::$now) {
@@ -121,6 +124,9 @@ public static function hrtime($asNumber = false)
121124
return [(int) self::$now, (int) $ns];
122125
}
123126

127+
/**
128+
* @return void
129+
*/
124130
public static function register($class)
125131
{
126132
$self = static::class;

DnsMock.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class DnsMock
3636
* Configures the mock values for DNS queries.
3737
*
3838
* @param array $hosts Mocked hosts as keys, arrays of DNS records as returned by dns_get_record() as values
39+
*
40+
* @return void
3941
*/
4042
public static function withMockedHosts(array $hosts)
4143
{
@@ -167,6 +169,9 @@ public static function dns_get_record($hostname, $type = \DNS_ANY, &$authns = nu
167169
return $records;
168170
}
169171

172+
/**
173+
* @return void
174+
*/
170175
public static function register($class)
171176
{
172177
$self = static::class;

Legacy/ExpectDeprecationTraitBeforeV8_4.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ trait ExpectDeprecationTraitBeforeV8_4
1818
{
1919
/**
2020
* @param string $message
21-
*
22-
* @return void
2321
*/
24-
protected function expectDeprecation($message)
22+
protected function expectDeprecation($message): void
2523
{
2624
// Expected deprecations set by isolated tests need to be written to a file
2725
// so that the test running process can take account of them.

Legacy/SymfonyTestsListenerTrait.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ public function __destruct()
107107
}
108108
}
109109

110-
public function globalListenerDisabled()
110+
public function globalListenerDisabled(): void
111111
{
112112
self::$globallyEnabled = false;
113113
$this->state = -1;
114114
}
115115

116-
public function startTestSuite($suite)
116+
public function startTestSuite($suite): void
117117
{
118118
$suiteName = $suite->getName();
119119

@@ -188,14 +188,14 @@ public function startTestSuite($suite)
188188
}
189189
}
190190

191-
public function addSkippedTest($test, \Exception $e, $time)
191+
public function addSkippedTest($test, \Exception $e, $time): void
192192
{
193193
if (0 < $this->state) {
194194
$this->isSkipped[\get_class($test)][$test->getName()] = 1;
195195
}
196196
}
197197

198-
public function startTest($test)
198+
public function startTest($test): void
199199
{
200200
if (-2 < $this->state && $test instanceof TestCase) {
201201
// This event is triggered before the test is re-run in isolation
@@ -242,7 +242,7 @@ public function startTest($test)
242242
}
243243
}
244244

245-
public function endTest($test, $time)
245+
public function endTest($test, $time): void
246246
{
247247
if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
248248
putenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE');
@@ -338,15 +338,10 @@ public static function handleError($type, $msg, $file, $line, $context = [])
338338
}
339339
self::$gatheredDeprecations[] = $msg;
340340

341-
return null;
341+
return true;
342342
}
343343

344-
/**
345-
* @param TestCase $test
346-
*
347-
* @return bool
348-
*/
349-
private function willBeIsolated($test)
344+
private function willBeIsolated(TestCase $test): bool
350345
{
351346
if ($test->isInIsolation()) {
352347
return false;
@@ -355,6 +350,6 @@ private function willBeIsolated($test)
355350
$r = new \ReflectionProperty($test, 'runTestInSeparateProcess');
356351
$r->setAccessible(true);
357352

358-
return $r->getValue($test);
353+
return $r->getValue($test) ?? false;
359354
}
360355
}

0 commit comments

Comments
 (0)