Skip to content

Change "equals()" method to accept anything as a parameter #87

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 1 commit into from
Apr 23, 2019

Conversation

jacek-foremski
Copy link

Makes "equals()" method accept anything as a parameter. It will return false if an argument is an object of different class or not an object.

One of the two PRs needed to fix #86

@mnapoli
Copy link
Member

mnapoli commented Apr 23, 2019

Perfect thanks!

@mnapoli mnapoli merged commit e1cc10a into myclabs:master Apr 23, 2019
@jacek-foremski jacek-foremski deleted the equals_accepts_anything branch April 23, 2019 11:02
*/
final public function equals(Enum $enum = null)
final public function equals($variable = null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the = null default kept? $enum->equals() seems like a pretty strange call to make.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a BC break.

@willemstuursma
Copy link
Contributor

This was actually a BC break. Any classes extending Enum and overriding equals() need to be updated now, as the typehint needs to be removed.

@jacek-foremski
Copy link
Author

@willemstuursma equals() method is final, so I'm not sure how it can be overriden.

@willemstuursma
Copy link
Contributor

Thanks, I had a second look. Turned out we have an interface that partially implements the methods in Enum. The problem was there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility with php-ds/ext-ds
4 participants