Merge "Add equals() to UserIdentity"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 9 May 2018 17:28:00 +0000 (17:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 9 May 2018 17:28:00 +0000 (17:28 +0000)
includes/user/User.php
includes/user/UserIdentity.php
includes/user/UserIdentityValue.php

index 5a5139d..e235c18 100644 (file)
@@ -5663,11 +5663,12 @@ class User implements IDBAccessObject, UserIdentity {
        /**
         * Checks if two user objects point to the same user.
         *
-        * @since 1.25
-        * @param User $user
+        * @since 1.25 ; takes a UserIdentity instead of a User since 1.32
+        * @param UserIdentity $user
         * @return bool
         */
-       public function equals( User $user ) {
+       public function equals( UserIdentity $user ) {
+               // XXX it's not clear whether central ID providers are supposed to obey this
                return $this->getName() === $user->getName();
        }
 }
index d02a678..ac9bbec 100644 (file)
@@ -54,4 +54,12 @@ interface UserIdentity {
 
        // TODO: we may want to (optionally?) provide a global ID, see CentralIdLookup.
 
+       /**
+        * @since 1.32
+        *
+        * @param UserIdentity $user
+        * @return bool
+        */
+       public function equals( UserIdentity $user );
+
 }
index 120f31f..d1fd19d 100644 (file)
@@ -82,4 +82,15 @@ class UserIdentityValue implements UserIdentity {
                return $this->actor;
        }
 
+       /**
+        * @since 1.32
+        *
+        * @param UserIdentity $user
+        * @return bool
+        */
+       public function equals( UserIdentity $user ) {
+               // XXX it's not clear whether central ID providers are supposed to obey this
+               return $this->getName() === $user->getName();
+       }
+
 }