Skip to content

Commit 3da42cc

Browse files
authored
Merge pull request #156 from jdecool/stringable-implementation
Implement Stringable interface on Enum
2 parents 2eb0a50 + 3ddddff commit 3da42cc

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"autoload": {
3030
"psr-4": {
3131
"MabeEnum\\": "src/"
32-
}
32+
},
33+
"classmap": [
34+
"stubs/Stringable.php"
35+
]
3336
},
3437
"autoload-dev": {
3538
"psr-4": {

psalm.xml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0"?>
22
<psalm
3-
totallyTyped="true"
43
errorLevel="1"
54
resolveFromConfigFile="true"
65
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

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

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)