Skip to content
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

Wrong typehint on EnumTrait::fromNative() #15

Open
joshua-bn opened this issue Feb 16, 2021 · 1 comment
Open

Wrong typehint on EnumTrait::fromNative() #15

joshua-bn opened this issue Feb 16, 2021 · 1 comment

Comments

@joshua-bn
Copy link

https://github.com/funeralzone/valueobjects/blob/master/src/Enums/EnumTrait.php#L53 should be string

Why not put the typehint on the signature?

@chrisharrison
Copy link
Contributor

You're absolutely right that the docblock is incorrect. If you create a PR, someone will accept it (I can't, because I've left the company that maintains this).

It can't be a typehint on the signature though, because that would break the interface defined here:
https://github.com/funeralzone/valueobjects/blob/master/src/ValueObject.php

The idea is that all value objects have the fromNative and toNative methods. If we type hinted in the signature to a string it would break other value objects whose fromNative is not a string.

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

2 participants