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

Revert UserManagerInterface::updateUser() BC break #2962

Merged
merged 2 commits into from
Mar 31, 2020
Merged

Revert UserManagerInterface::updateUser() BC break #2962

merged 2 commits into from
Mar 31, 2020

Conversation

guilliamxavier
Copy link

Reverts #2896
Fixes #2896 (comment)

@guilliamxavier
Copy link
Author

Travis failures unrelated (see #2961)

@guilliamxavier guilliamxavier requested a review from XWB January 21, 2020 17:26
@XWB
Copy link
Member

XWB commented Jan 27, 2020

I believe the signature was incomplete, i.e. it is not compatible with https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Doctrine/UserManager.php#L95

@guilliamxavier
Copy link
Author

guilliamxavier commented Jan 27, 2020

@XWB: Thanks for responding. But it is perfectly valid to have implementations with additional parameters as long as they are optional, for example:

interface UserInterface {}
class User implements UserInterface {}

interface UserManagerInterface {
    public function updateUser(UserInterface $user);
}
class SimpleUserManager implements UserManagerInterface {
    public function updateUser(UserInterface $user) { /* ... */ }
}
class DoctrineUserManager implements UserManagerInterface {
    public function updateUser(UserInterface $user, $andFlush = true) { /* ... */ }
}
class OtherUserManager implements UserManagerInterface {
    public function updateUser(UserInterface $user, array $extra = []) { /* ... */ }
}

https://3v4l.org/OKG5d

By adding , $andFlush = true to UserManagerInterface::updateUser signature to match DoctrineUserManager implementation, you break SimpleUserManager and OtherUserManager implementations

https://3v4l.org/SA1Ld
https://3v4l.org/VriK0

@stof stof merged commit 0bdc432 into FriendsOfSymfony:2.x Mar 31, 2020
@guilliamxavier guilliamxavier deleted the patch-1 branch March 31, 2020 10:28
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

Successfully merging this pull request may close these issues.

3 participants