Skip to content

Commit 606c348

Browse files
committed
Float return type test
1 parent e4c8ba3 commit 606c348

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/Exercise/UniteTheTypesTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,11 @@ public function testSuccessfulSolutionWithDifferentOrderUnion(): void
110110

111111
$this->assertVerifyWasSuccessful();
112112
}
113+
114+
public function testSuccessfulSolutionWithFloatReturnType(): void
115+
{
116+
$this->runExercise('correct-union-type-float-return.php');
117+
118+
$this->assertVerifyWasSuccessful();
119+
}
113120
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
function adder(string|float|int ...$numbers): float {
4+
return array_sum($numbers);
5+
}
6+
7+
$nums = $argv;
8+
array_shift($nums);
9+
10+
echo adder(...$nums) . "\n";

0 commit comments

Comments
 (0)