Skip to content

Commit

Permalink
Merge pull request #160 from jdecool/stringable-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli authored Aug 4, 2022
2 parents a416192 + eb64102 commit a867478
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"classmap": [
"stubs/Stringable.php"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @psalm-immutable
* @psalm-consistent-constructor
*/
abstract class Enum implements \JsonSerializable
abstract class Enum implements \JsonSerializable, \Stringable
{
/**
* Enum value
Expand Down
11 changes: 11 additions & 0 deletions stubs/Stringable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

if (\PHP_VERSION_ID < 80000 && !interface_exists('Stringable')) {
interface Stringable
{
/**
* @return string
*/
public function __toString();
}
}

0 comments on commit a867478

Please sign in to comment.