-
Notifications
You must be signed in to change notification settings - Fork 101
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
Replace get/setSex with get/setGender #95
Conversation
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.
src/Common/Entity/User.php
Outdated
*/ | ||
protected $sex; | ||
protected $gender = GENDER_UNKNOWN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be self::GENDER_UNKNOWN
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got me there! Sure!
src/Common/Entity/User.php
Outdated
if ($sex !== self::SEX_MALE && $sex !== self::SEX_FEMALE) { | ||
throw new \InvalidArgumentException('Argument $sex is not valid'); | ||
$genders = [ | ||
GENDER_OTHER, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All constants should have static::
prefix.
src/Common/Entity/User.php
Outdated
GENDER_MALE, | ||
GENDER_FEMALE, | ||
]; | ||
if (! $gender in_array($genders)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't valid code :)
As they are already used removing them is a BC break that we do not want!
This removes the calls to get/setSex with the appropriate get/setGender calls. Tests are now again passing
The removed docBlock contains redundant information and was therefore removed
The removal of the protected proprety As the method now does no longer return And the removal of the See result of
|
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 returnunknown
instead of NULL.