Skip to content

Implement Stringable interface on Enum #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2022
Merged

Implement Stringable interface on Enum #156

merged 3 commits into from
Apr 19, 2022

Conversation

jdecool
Copy link
Contributor

@jdecool jdecool commented Apr 18, 2022

Enum class has a __toString, so it would be great to implements the new Stringable interface.

As the interface is not available for php < 8, I've had the symfony/polyfill-php-80.

I've removed psalm totallyTyped attribute as it's now deprecated.

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2022

Codecov Report

Merging #156 (3ddddff) into master (2eb0a50) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master     #156   +/-   ##
=========================================
  Coverage     99.81%   99.81%           
  Complexity      227      227           
=========================================
  Files             4        4           
  Lines           555      555           
=========================================
  Hits            554      554           
  Misses            1        1           
Impacted Files Coverage Δ
src/Enum.php 100.00% <ø> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@marc-mabe
Copy link
Owner

@jdecool thank you for this PR and improvement. I think it's a good idea to make this interface explicit and available for all versions. Although I don't really like to add a dependency for this simple case. A stub with class map loading from composer same as https://github.com/symfony/polyfill/blob/main/src/Php80/Resources/stubs/Stringable.php should be enough.

@jdecool
Copy link
Contributor Author

jdecool commented Apr 18, 2022

👍

LGTM. I’m going to update this PR

@jdecool
Copy link
Contributor Author

jdecool commented Apr 18, 2022

@marc-mabe The PR has just been updated

@marc-mabe marc-mabe added this to the 4.7.0 milestone Apr 19, 2022
@marc-mabe marc-mabe merged commit 3da42cc into marc-mabe:master Apr 19, 2022
@marc-mabe
Copy link
Owner

I have moved the classmap setting from autoload-dev to autoload.
It's released as 4.7.0
Thanks 👍

@jdecool jdecool deleted the stringable-implementation branch April 19, 2022 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants