-
Notifications
You must be signed in to change notification settings - Fork 102
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
Rename User::getSex()/setSex() to getGender()/setGender() #94
Comments
Hey! I am agree with this ide, but 3.0 was released :( Let's create aliases and mark old names as Will be cool if anyone can help with PR Thanks |
There is another issue to consider. You force the gender(sex) to be either male or female only and For e.g. as per Meetup's API docs the gender value can be either |
I can understand the idea to have a defined interface. But I'd also promote at least to have a third option 'other'. Gender is not binary. Whether one likes it or not, if this library tries to enforce a binary solution here it will backfire. So instead of forcing male of female I'd default to A future extension could then be to set the provided additional information in a separate field so that the user can fetch the gender and either get |
The method should still be able to return |
As explained in #94 it's a good idea to use gender instead of sex. To not break BC the get/setSex are still available but are marked as deprecated. The current functionality works as before. In addition to that it is possible to set `other` as gender and the default now is to return `unknown` instead of NULL.
There are issues with setting gender/sex in specific provider classes too. For e.g. the auth/src/OAuth2/Provider/Facebook.php Line 63 in 4872935
which seems pretty wrong given what the FB's Graph API says regarding the gender field https://developers.facebook.com/docs/graph-api/reference/user.
So the the value could be either |
In that case the method would return |
Values for all other properties can be |
Yeah. Not all. There are a lot of propreties that can – according to their docblock – not be Still: A dedicated type that is not nullable for a valid reason is a much cleaner and explicit approach and interface. The returned string |
Always returning Anyway considering the various possible values returned by providers it would be best to have two methods to get the gender. One that returns the marshalled value and another that returns the raw value. |
That was the idea I proposed in #94 (comment) - be able to get the value that was set if it is |
Personally I would just return the raw values and let the users marshal / convert it to standard values depending on what's used in their apps. |
That problem is already existent with the |
In context of user's profile "gender" is the appropriate term rather than "sex". For example profile info provided by Google and Facebook also uses "gender".
So I propose that the methods, constants and property of
User
entity class should be renamed according.Ideally this should have been done before the 3.0 release but perhaps we can still do this and maintain old names as aliases to avoid backwards compatible break.
The text was updated successfully, but these errors were encountered: