Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a867478

Browse files
authored
Merge pull request #160 from jdecool/stringable-implementation
2 parents a416192 + eb64102 commit a867478

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

‎composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"autoload": {
1515
"psr-4": {
1616
"MyCLabs\\Enum\\": "src/"
17-
}
17+
},
18+
"classmap": [
19+
"stubs/Stringable.php"
20+
]
1821
},
1922
"autoload-dev": {
2023
"psr-4": {

‎src/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @psalm-immutable
2020
* @psalm-consistent-constructor
2121
*/
22-
abstract class Enum implements \JsonSerializable
22+
abstract class Enum implements \JsonSerializable, \Stringable
2323
{
2424
/**
2525
* Enum value

‎stubs/Stringable.php

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /