Skip to content

Commit 22e8d51

Browse files
committed
Implement Stringable interface on Enum
1 parent 2eb0a50 commit 22e8d51

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Diff for: composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
"MabeEnumTest\\": "tests/MabeEnumTest/",
3737
"MabeEnumStaticAnalysis\\": "tests/MabeEnumStaticAnalysis/",
3838
"MabeEnumBench\\": "bench/"
39-
}
39+
},
40+
"classmap": [
41+
"stubs/Stringable.php"
42+
]
4043
},
4144
"extra": {
4245
"branch-alias": {

Diff for: src/Enum.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @psalm-immutable
1919
*/
20-
abstract class Enum
20+
abstract class Enum implements \Stringable
2121
{
2222
/**
2323
* The selected enumerator value

Diff for: stubs/Stringable.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
if (\PHP_VERSION_ID < 80000) {
4+
interface Stringable
5+
{
6+
/**
7+
* @return string
8+
*/
9+
public function __toString();
10+
}
11+
}

0 commit comments

Comments
 (0)