summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/Database.php4
-rw-r--r--lib/private/User/User.php3
-rw-r--r--lib/public/IUser.php3
-rw-r--r--lib/public/User/Backend/ISetDisplayNameBackend.php3
4 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 0b38f04bfe3..f106c2e8b6d 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -212,11 +212,13 @@ class Database extends ABackend implements
* @param string $displayName The new display name
* @return bool
*
+ * @throws \InvalidArgumentException
+ *
* Change the display name of a user
*/
public function setDisplayName(string $uid, string $displayName): bool {
if (mb_strlen($displayName) > 64) {
- return false;
+ throw new \InvalidArgumentException('Invalid displayname');
}
$this->fixDI();
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index 7f7d6273e30..c24a5fe1c6b 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -154,6 +154,9 @@ class User implements IUser {
*
* @param string $displayName
* @return bool
+ *
+ * @since 25.0.0 Throw InvalidArgumentException
+ * @throws \InvalidArgumentException
*/
public function setDisplayName($displayName) {
$displayName = trim($displayName);
diff --git a/lib/public/IUser.php b/lib/public/IUser.php
index daf993df6cd..bb7bdf3304a 100644
--- a/lib/public/IUser.php
+++ b/lib/public/IUser.php
@@ -58,6 +58,9 @@ interface IUser {
* @param string $displayName
* @return bool
* @since 8.0.0
+ *
+ * @since 25.0.0 Throw InvalidArgumentException
+ * @throws \InvalidArgumentException
*/
public function setDisplayName($displayName);
diff --git a/lib/public/User/Backend/ISetDisplayNameBackend.php b/lib/public/User/Backend/ISetDisplayNameBackend.php
index 922d356bfd7..db62223ad52 100644
--- a/lib/public/User/Backend/ISetDisplayNameBackend.php
+++ b/lib/public/User/Backend/ISetDisplayNameBackend.php
@@ -36,6 +36,9 @@ interface ISetDisplayNameBackend {
* @param string $uid The username
* @param string $displayName The new display name
* @return bool
+ *
+ * @since 25.0.0 Throw InvalidArgumentException
+ * @throws \InvalidArgumentException
*/
public function setDisplayName(string $uid, string $displayName): bool;
}