Skip to content

Commit e3e3ce4

Browse files
committed
Add test with strict_types
1 parent 7936f76 commit e3e3ce4

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

test/Exercise/UniteTheTypesTest.php

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

118118
$this->assertVerifyWasSuccessful();
119119
}
120+
121+
public function testSuccessfulSolutionWithStrictTypes(): void
122+
{
123+
$this->runExercise('correct-union-type-strict-types.php');
124+
125+
$this->assertVerifyWasSuccessful();
126+
}
120127
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
function adder(string|float|int ...$numbers) {
6+
return array_sum($numbers);
7+
}
8+
9+
$nums = $argv;
10+
array_shift($nums);
11+
12+
echo adder(...$nums) . "\n";

0 commit comments

Comments
 (0)