Skip to content

Commit 5325753

Browse files
committed
Add tests/8.1/enum.php
1 parent 53da0b4 commit 5325753

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/8.1/enum.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
enum Size
4+
{
5+
case Small;
6+
case Medium;
7+
case Large;
8+
9+
public static function fromLength(int $cm)
10+
{
11+
return match(true) {
12+
$cm < 50 => static::Small,
13+
$cm < 100 => static::Medium,
14+
default => static::Large,
15+
};
16+
}
17+
}

0 commit comments

Comments
 (0)