Skip to content

Implement JsonSerializable interface #67

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

Closed
Daanvm opened this issue May 2, 2018 · 4 comments
Closed

Implement JsonSerializable interface #67

Daanvm opened this issue May 2, 2018 · 4 comments

Comments

@Daanvm
Copy link
Contributor

Daanvm commented May 2, 2018

Currently encoding an Enum object with json_encode() returns {}, which isn't really useful.

This has been requested before in #30 and #60, but the JsonSerializable interface only exists since PHP 5.4. This library still supports PHP 5.3.

However, now we're a few years later, PHP 5.3 is end of life for over 3 and a half years. The current build doesn't even succeed because PHP 5.3 is no longer available in Travis. I think supporting such old versions of PHP isn't a valid argument anymore.

I am more than willing to create a pull request if you would allow me to bump the PHP requirement to 5.4.

@willemstuursma
Copy link
Contributor

Note that if a new version for PHP 5.4 is created, Composer will still install older versions for PHP 5.3 users and prevent the incompatible version from being installed.

@mnapoli
Copy link
Member

mnapoli commented May 3, 2018

I agree, it is time to drop PHP 5.3. I had a look at packages that use PhpEnum (https://packagist.org/packages/myclabs/php-enum/dependents) and I couldn't see any big one compatible with PHP 5.3.

@Daanvm I'm 👍 with a PR that drops PHP 5.3 :) Then we'll be able to support serialization.

@Daanvm
Copy link
Contributor Author

Daanvm commented May 3, 2018

Great! I'll create a PR for dropping PHP 5.3 and another PR to add JSON serialization support.

@Daanvm
Copy link
Contributor Author

Daanvm commented May 3, 2018

I've created PR #68 to drop support for PHP 5.3 and another PR #69 that implements the JsonSerializable interface.

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

No branches or pull requests

3 participants