Skip to content

Commit 05b1096

Browse files
committed
Add void return type to tests that were missing return types
1 parent 5d6c31b commit 05b1096

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

tests/StopwatchTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @group time-sensitive
1010
*/
1111
class StopwatchTest extends TestCase {
12-
public function testTimerStoppedValueRetention() {
12+
public function testTimerStoppedValueRetention(): void {
1313
$stopwatch = new Stopwatch();
1414
$stopwatch->stop();
1515
$time_1 = $stopwatch->read();
@@ -20,7 +20,7 @@ public function testTimerStoppedValueRetention() {
2020
$this->assertSame($time_1, $time_2);
2121
}
2222

23-
public function testTimerContiniuous() {
23+
public function testTimerContiniuous(): void {
2424
$stopwatch = new Stopwatch();
2525
$time_1 = $stopwatch->read();
2626
$this->assertIsFloat($time_1);
@@ -30,7 +30,7 @@ public function testTimerContiniuous() {
3030
$this->assertNotSame($time_1, $time_2);
3131
}
3232

33-
public function testTimerMultipleStartCalls() {
33+
public function testTimerMultipleStartCalls(): void {
3434
$stopwatch = new Stopwatch();
3535
$stopwatch->start();
3636
$time_1 = $stopwatch->read();

tests/TimerTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@
1212
*/
1313
class TimerTest extends TestCase {
1414

15-
public function testUnsupportedKeyType(){
15+
public function testUnsupportedKeyType(): void {
1616
$this->expectException(\TypeError::class);
1717
Timer::start(new \stdClass());
1818
}
1919

20-
private function sleepHalfSec(int $count = 1) {
20+
private function sleepHalfSec(int $count = 1): void {
2121
usleep(500000 * $count);
2222
}
2323

24-
public function testStopValuesRetained() {
24+
public function testStopValuesRetained(): void {
2525
Timer::start(__FUNCTION__);
2626
Timer::stop(__FUNCTION__);
2727
$stopped_at = Timer::read(__FUNCTION__, Timer::FORMAT_PRECISE);
2828
$this->sleepHalfSec();
2929
$this->assertEquals(Timer::read(__FUNCTION__, Timer::FORMAT_PRECISE), $stopped_at);
3030
}
3131

32-
public function testUnstoppedValuesContinue() {
32+
public function testUnstoppedValuesContinue(): void {
3333
Timer::start(__FUNCTION__);
3434
$stopped_at = Timer::read(__FUNCTION__);
3535
usleep(500);
3636
$this->assertGreaterThan($stopped_at, Timer::read(__FUNCTION__, Timer::FORMAT_PRECISE));
3737
}
3838

39-
public function testIndividualTimersRunConcurrent() {
39+
public function testIndividualTimersRunConcurrent(): void {
4040
Timer::resetAll();
4141

4242
Timer::start(1);
@@ -53,7 +53,7 @@ public function testIndividualTimersRunConcurrent() {
5353
$this->assertEquals(Timer::read(1, Timer::FORMAT_PRECISE), $timer_1);
5454
}
5555

56-
public function testMultipleStartsQueued() {
56+
public function testMultipleStartsQueued(): void {
5757
$key = __FUNCTION__;
5858
Timer::start($key);
5959
$this->sleepHalfSec();
@@ -75,7 +75,7 @@ public function testMultipleStartsQueued() {
7575
$this->assertGreaterThan($timer_1 + $timer_2, $timer_3);
7676
}
7777

78-
public function testMultipleStartCallsQueued_2() {
78+
public function testMultipleStartCallsQueued_2(): void {
7979
$key = 'foo';
8080
Timer::start($key);
8181
$this->assertLessThan(500, Timer::read($key));
@@ -87,7 +87,7 @@ public function testMultipleStartCallsQueued_2() {
8787
$this->assertLessThan(2000, Timer::read($key));
8888
}
8989

90-
public function testStopAndGoTimer() {
90+
public function testStopAndGoTimer(): void {
9191
Timer::start(__FUNCTION__);
9292
usleep(1000);
9393
Timer::stop(__FUNCTION__);
@@ -100,15 +100,15 @@ public function testStopAndGoTimer() {
100100
$this->assertLessThan(0.008, $timer);
101101
}
102102

103-
public function testResetRestsTimer() {
103+
public function testResetRestsTimer(): void {
104104
Timer::resetAll();
105105
Timer::start(__FUNCTION__);
106106
Timer::reset(__FUNCTION__);
107107
$this->expectException(\LogicException::class);
108108
Timer::read(__FUNCTION__);
109109
}
110110

111-
public function testTimerFormat_Seconds() {
111+
public function testTimerFormat_Seconds(): void {
112112
Timer::start(__FUNCTION__);
113113

114114
usleep(1000);
@@ -120,35 +120,35 @@ public function testTimerFormat_Seconds() {
120120
$this->assertGreaterThanOrEqual('0.002', $read);
121121
}
122122

123-
public function testTimerFormat_Unspecified() {
123+
public function testTimerFormat_Unspecified(): void {
124124
Timer::start(__FUNCTION__);
125125
usleep(1500);
126126
$read = Timer::read(__FUNCTION__, 'unspecified');
127127

128128
$this->assertGreaterThanOrEqual(1, $read);
129129
}
130130

131-
public function testTimerFormat_Milliseconds() {
131+
public function testTimerFormat_Milliseconds(): void {
132132
Timer::start(__FUNCTION__);
133133
usleep(1500);
134134
$read = Timer::read(__FUNCTION__, Timer::FORMAT_MILLISECONDS);
135135

136136
$this->assertGreaterThanOrEqual(1, $read);
137137
}
138138

139-
public function testStopWithoutInitializing() {
139+
public function testStopWithoutInitializing(): void {
140140
Timer::resetAll();
141141
$this->expectException(\LogicException::class);
142142
Timer::stop(__FUNCTION__);
143143
}
144144

145145

146-
public function testValidSecondsCount() {
146+
public function testValidSecondsCount(): void {
147147
Timer::start(__FUNCTION__);
148148
$this->assertIsString(Timer::read(__FUNCTION__));
149149
}
150150

151-
public function testDenyAccessWithoutInitializing() {
151+
public function testDenyAccessWithoutInitializing(): void {
152152
$this->expectException(\LogicException::class);
153153
Timer::resetAll();
154154
Timer::read();

0 commit comments

Comments
 (0)