diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 33c0604ae2ff8..5c33954d4380e 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -196,6 +196,9 @@ private function getOrganizerEMailAndNameFromEvent(VEvent $vevent):?array { } $organizerEMail = substr($organizer->getValue(), 7); + if ($organizerEMail === false) { + return null; + } $name = $organizer->offsetGet('CN'); if ($name instanceof Parameter) { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index b88364aaa9d2f..090fca335c6ed 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -178,6 +178,10 @@ public function schedule(Message $iTipMessage) { // Strip off mailto: $sender = substr($iTipMessage->sender, 7); $recipient = substr($iTipMessage->recipient, 7); + if ($sender === false || $recipient === false) { + // Shouldn't happen but in theory `substr` can return `false` + return; + } $senderName = $iTipMessage->senderName ?: null; $recipientName = $iTipMessage->recipientName ?: null; @@ -207,7 +211,6 @@ public function schedule(Message $iTipMessage) { $meetingUrl = $vevent->URL; - $meetingLocation = $vevent->LOCATION; $defaultVal = '--'; diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 98458ff8bfa29..cea5f5a9ffdf3 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -69,7 +69,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { */ private $userFolder; - /** @var IShare[] */ + /** @var IShare[][] */ private $cachedShares = []; private $cachedFolders = []; @@ -112,7 +112,11 @@ public function initialize(\Sabre\DAV\Server $server) { $this->server->on('propFind', [$this, 'handleGetProperties']); } - private function getShare(\OCP\Files\Node $node): array { + /** + * @return IShare[] + */ + private function getSharesForFilesNode(\OCP\Files\Node $node): array { + /** @var IShare[] $result */ $result = []; $requestedShareTypes = [ IShare::TYPE_USER, @@ -139,6 +143,9 @@ private function getShare(\OCP\Files\Node $node): array { return $result; } + /** + * @return IShare[][] + */ private function getSharesFolder(\OCP\Files\Folder $node): array { return $this->shareManager->getSharesInFolder( $this->userId, @@ -147,7 +154,10 @@ private function getSharesFolder(\OCP\Files\Folder $node): array { ); } - private function getShares(\Sabre\DAV\INode $sabreNode): array { + /** + * @return IShare[] + */ + private function getSharesForSabreNode(\Sabre\DAV\INode $sabreNode): array { if (isset($this->cachedShares[$sabreNode->getId()])) { $shares = $this->cachedShares[$sabreNode->getId()]; } else { @@ -158,7 +168,7 @@ private function getShares(\Sabre\DAV\INode $sabreNode): array { // if we already cached the folder this file is in we know there are no shares for this file if (array_search($parentPath, $this->cachedFolders) === false) { $node = $this->userFolder->get($sabreNode->getPath()); - $shares = $this->getShare($node); + $shares = $this->getSharesForFilesNode($node); $this->cachedShares[$sabreNode->getId()] = $shares; } else { return []; @@ -200,7 +210,7 @@ public function handleGetProperties( } $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) { - $shares = $this->getShares($sabreNode); + $shares = $this->getSharesForSabreNode($sabreNode); $shareTypes = array_unique(array_map(function (IShare $share) { return $share->getShareType(); @@ -210,7 +220,7 @@ public function handleGetProperties( }); $propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) { - $shares = $this->getShares($sabreNode); + $shares = $this->getSharesForSabreNode($sabreNode); return new ShareeList($shares); }); diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index 6e45affb3fe59..e306c2a465542 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -130,6 +130,7 @@ public function httpGet(RequestInterface $request, ResponseInterface $response): $absoluteURL = $this->urlGenerator->getBaseUrl(); $parsedUrl = parse_url($absoluteURL); if (isset($parsedUrl['port'])) { + /** @psalm-suppress RedundantCast */ $serverPort = (int) $parsedUrl['port']; } else { $serverPort = 443; diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php index 3d18d8b3a530b..70df370cf1ca0 100644 --- a/apps/encryption/lib/Crypto/EncryptAll.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php @@ -414,10 +414,14 @@ protected function sendPasswordsByMail() { $progress->advance(); if (!empty($password)) { $recipient = $this->userManager->get($uid); + if ($recipient === null) { + $noMail[] = $uid; + continue; + } $recipientDisplayName = $recipient->getDisplayName(); $to = $recipient->getEMailAddress(); - if ($to === '') { + if (empty($to)) { $noMail[] = $uid; continue; } diff --git a/apps/settings/lib/Controller/HelpController.php b/apps/settings/lib/Controller/HelpController.php index 93c3bee193155..b1d9cf6b87f47 100644 --- a/apps/settings/lib/Controller/HelpController.php +++ b/apps/settings/lib/Controller/HelpController.php @@ -73,7 +73,7 @@ public function __construct( public function help(string $mode = 'user'): TemplateResponse { $this->navigationManager->setActiveEntry('help'); - if (!isset($mode) || $mode !== 'admin') { + if (empty($mode) || $mode !== 'admin') { $mode = 'user'; } diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php index 62eddcd1c0beb..2f388caf8013f 100644 --- a/apps/settings/lib/Hooks.php +++ b/apps/settings/lib/Hooks.php @@ -127,10 +127,10 @@ public function onChangePassword($uid) { $this->activityManager->publish($event); - if ($user->getEMailAddress() !== null) { + if (($email = $user->getEMailAddress()) !== null) { $template = $this->mailer->createEMailTemplate('settings.PasswordChanged', [ 'displayname' => $user->getDisplayName(), - 'emailAddress' => $user->getEMailAddress(), + 'emailAddress' => $email, 'instanceUrl' => $instanceUrl, ]); @@ -140,9 +140,8 @@ public function onChangePassword($uid) { $template->addBodyText($text . ' ' . $l->t('If you did not request this, please contact an administrator.')); $template->addFooter(); - $message = $this->mailer->createMessage(); - $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]); + $message->setTo([$email => $user->getDisplayName()]); $message->useTemplate($template); $this->mailer->send($message); } diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php index f8dfeec30ffa3..225814dad4675 100644 --- a/apps/settings/lib/Mailer/NewUserMailHelper.php +++ b/apps/settings/lib/Mailer/NewUserMailHelper.php @@ -172,9 +172,13 @@ public function generateTemplate(IUser $user, $generatePasswordResetToken = fals * @throws \Exception If mail could not be sent */ public function sendMail(IUser $user, - IEMailTemplate $emailTemplate) { + IEMailTemplate $emailTemplate): void { $message = $this->mailer->createMessage(); - $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]); + $email = $user->getEMailAddress(); + if ($email === null) { + throw new \Exception("User has no email set"); + } + $message->setTo([$email => $user->getDisplayName()]); $message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]); $message->useTemplate($emailTemplate); $this->mailer->send($message); diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 426cd05e52aa0..2d299e2d1b326 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -181,7 +181,7 @@ public function getConnection() { * array if $attr is empty, false otherwise * @throws ServerNotAvailableException */ - public function readAttribute($dn, $attr, $filter = 'objectClass=*') { + public function readAttribute(string $dn, string $attr, string $filter = 'objectClass=*') { if (!$this->checkConnection()) { \OCP\Util::writeLog('user_ldap', 'No LDAP Connector assigned, access impossible for readAttribute.', @@ -204,6 +204,10 @@ public function readAttribute($dn, $attr, $filter = 'objectClass=*') { // (cf. #12306), 500 is default for paging and should work everywhere. $maxResults = $pagingSize > 20 ? $pagingSize : 500; $attr = mb_strtolower($attr, 'UTF-8'); + if ($attr === false) { + \OCP\Util::writeLog('user_ldap', 'Attribute name could not be converted to lower case.', ILogger::DEBUG); + return false; + } // the actual read attribute later may contain parameters on a ranged // request, e.g. member;range=99-199. Depends on server reply. $attrToRead = $attr; @@ -1760,6 +1764,7 @@ public function getUUID($dn, $isUser = true, $ldapRecord = null) { $uuid = false; if ($this->detectUuidAttribute($dn, $isUser, false, $ldapRecord)) { + /** @var string $attr */ $attr = $this->connection->$uuidAttr; $uuid = isset($ldapRecord[$attr]) ? $ldapRecord[$attr] : $this->readAttribute($dn, $attr); if (!is_array($uuid) diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index e55df4e8c1cb8..309eeec52c761 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -134,7 +134,7 @@ public function getOCName() { * @return string */ public function getUID() { - if (!isset($this->uid)) { + if ($this->uid === null) { $this->fetchDetails(); } return $this->uid; @@ -145,7 +145,7 @@ public function getUID() { * @return string */ public function getDN() { - if (!isset($this->dn)) { + if ($this->dn === null) { $this->fetchDetails(); } return $this->dn; @@ -156,7 +156,7 @@ public function getDN() { * @return string */ public function getDisplayName() { - if (!isset($this->displayName)) { + if ($this->displayName === null) { $this->fetchDetails(); } return $this->displayName; @@ -167,7 +167,7 @@ public function getDisplayName() { * @return string */ public function getEmail() { - if (!isset($this->email)) { + if ($this->email === null) { $this->fetchDetails(); } return $this->email; @@ -178,7 +178,7 @@ public function getEmail() { * @return string */ public function getHomePath() { - if (!isset($this->homePath)) { + if ($this->homePath === null) { $this->fetchDetails(); } return $this->homePath; @@ -189,7 +189,7 @@ public function getHomePath() { * @return int */ public function getLastLogin() { - if (!isset($this->lastLogin)) { + if ($this->lastLogin === null) { $this->fetchDetails(); } return (int)$this->lastLogin; @@ -200,7 +200,7 @@ public function getLastLogin() { * @return int */ public function getDetectedOn() { - if (!isset($this->foundDeleted)) { + if ($this->foundDeleted === null) { $this->fetchDetails(); } return (int)$this->foundDeleted; @@ -211,7 +211,7 @@ public function getDetectedOn() { * @return bool */ public function getHasActiveShares() { - if (!isset($this->hasActiveShares)) { + if ($this->hasActiveShares === null) { $this->fetchDetails(); } return $this->hasActiveShares; diff --git a/apps/weather_status/lib/Service/WeatherStatusService.php b/apps/weather_status/lib/Service/WeatherStatusService.php index 0d7b31f90429d..490cb35b2c33d 100644 --- a/apps/weather_status/lib/Service/WeatherStatusService.php +++ b/apps/weather_status/lib/Service/WeatherStatusService.php @@ -397,7 +397,7 @@ private function forecastRequest(float $lat, float $lon, float $altitude, int $n * @return array which contains the error message or the parsed JSON result */ private function requestJSON(string $url, array $params = []): array { - if (isset($this->cache)) { + if ($this->cache !== null) { $cacheKey = $url . '|' . implode(',', $params) . '|' . implode(',', array_keys($params)); if ($this->cache->hasKey($cacheKey)) { return $this->cache->get($cacheKey); diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 780c3051ac17b..d979f9a99b947 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1,5 +1,10 @@ - + + + + string|null + + $calendarData @@ -287,15 +292,13 @@ $l10n->l('time', $dt, ['width' => 'short']) $l10n->l('weekdayName', $dt, ['width' => 'abbreviated']) - + $l10n->l('date', $dt, ['width' => 'medium']) $l10n->l('datetime', $dt, ['width' => 'medium|short']) $l10n->l('time', $dt, ['width' => 'short']) $l10n->l('weekdayName', $dt, ['width' => 'abbreviated']) - [$organizerEMail => $name] - - array|null + string string string @@ -367,10 +370,6 @@ string - - [$recipient => $recipientName] - [$sender => $senderName] - $lang->getValue() @@ -752,12 +751,9 @@ - - $shares - - - array - + + $this->cachedShares + \Sabre\Uri\split($sabreNode->getPath()) @@ -1030,9 +1026,6 @@ - - [$to => $recipientDisplayName] - setHtmlBody setPlainBody @@ -1060,8 +1053,7 @@ throw $exception; - - $encryptedFileKey + $userSession @@ -1962,16 +1954,6 @@ dispatch - - - [$user->getEMailAddress() => $user->getDisplayName()] - - - - - [$user->getEMailAddress() => $user->getDisplayName()] - - isReady @@ -2168,11 +2150,10 @@ string[] - + $e->getCode() $key $key - [$attr => $result['values']] $cookie @@ -2187,9 +2168,8 @@ !$attribute === null is_null($findings) - + !is_null($attr) && !is_array($attr) - isset($ldapRecord[$this->connection->$uuidAttr]) $uidsByDn @@ -3038,9 +3018,6 @@ $action['url-postfix'] - - strtolower - @@ -3632,9 +3609,6 @@ null null - - $data ?? $this->getData($file) - @@ -4563,9 +4537,6 @@ method_exists(self::$cache, 'deleteMulti') - - \Memcached::HAVE_IGBINARY - @@ -5398,6 +5369,15 @@ $column + + + $this->insert($entity) + $this->update($entity) + + + T + + $this->data diff --git a/composer.lock b/composer.lock index 92944f2b4d949..ea2467c4aab53 100644 --- a/composer.lock +++ b/composer.lock @@ -1359,16 +1359,16 @@ }, { "name": "symfony/console", - "version": "v5.1.8", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e" + "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", - "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", + "url": "https://api.github.com/repos/symfony/console/zipball/3e0564fb08d44a98bd5f1960204c958e57bd586b", + "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b", "shasum": "" }, "require": { @@ -1429,6 +1429,12 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "funding": [ { "url": "https://symfony.com/sponsor", @@ -1443,7 +1449,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-28T11:24:18+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2680,16 +2686,16 @@ }, { "name": "symfony/string", - "version": "v5.1.8", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea" + "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/a97573e960303db71be0dd8fda9be3bca5e0feea", - "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea", + "url": "https://api.github.com/repos/symfony/string/zipball/40e975edadd4e32cd16f3753b3bad65d9ac48242", + "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242", "shasum": "" }, "require": { @@ -2756,20 +2762,20 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-10-24T12:08:07+00:00" }, { "name": "vimeo/psalm", - "version": "4.2.1", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "ea9cb72143b77e7520c52fa37290bd8d8bc88fd9" + "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/ea9cb72143b77e7520c52fa37290bd8d8bc88fd9", - "reference": "ea9cb72143b77e7520c52fa37290bd8d8bc88fd9", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/2feba22a005a18bf31d4c7b9bdb9252c73897476", + "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476", "shasum": "" }, "require": { @@ -2857,7 +2863,11 @@ "inspection", "php" ], - "time": "2020-11-20T14:56:53+00:00" + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/4.3.1" + }, + "time": "2020-12-03T16:44:10+00:00" }, { "name": "webmozart/assert", @@ -2968,5 +2978,5 @@ "ext-xmlreader": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php index e73c3a4831cf7..d501f8d9ca13a 100644 --- a/core/Command/Config/ListConfigs.php +++ b/core/Command/Config/ListConfigs.php @@ -72,6 +72,7 @@ protected function configure() { } protected function execute(InputInterface $input, OutputInterface $output): int { + /** @var string $app */ $app = $input->getArgument('app'); $noSensitiveValues = !$input->getOption('private'); diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index 04ec33f76151d..756bc9c36a581 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -49,7 +49,7 @@ class File implements ICache { * @throws \OC\User\NoUserException */ protected function getStorage() { - if (isset($this->storage)) { + if ($this->storage !== null) { return $this->storage; } if (\OC::$server->getUserSession()->isLoggedIn()) { diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 0c9c41a3d9ba2..cf715ed174d87 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -143,7 +143,7 @@ protected function init() { 'userName' => $this->user, 'password' => $this->password, ]; - if (isset($this->authType)) { + if ($this->authType !== null) { $settings['authType'] = $this->authType; } diff --git a/lib/private/OCS/Result.php b/lib/private/OCS/Result.php index 0199783b47d2f..be2e6259309ec 100644 --- a/lib/private/OCS/Result.php +++ b/lib/private/OCS/Result.php @@ -104,10 +104,10 @@ public function getMeta() { $meta['status'] = $this->succeeded() ? 'ok' : 'failure'; $meta['statuscode'] = $this->statusCode; $meta['message'] = $this->message; - if (isset($this->items)) { + if ($this->items !== null) { $meta['totalitems'] = $this->items; } - if (isset($this->perPage)) { + if ($this->perPage !== null) { $meta['itemsperpage'] = $this->perPage; } return $meta; diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 71bc4a6c4f7d8..3c897c5ce4957 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -95,7 +95,7 @@ public function __construct(ILogger $logger) { * @return string[] */ public function getRoutingFiles() { - if (!isset($this->routingFiles)) { + if ($this->routingFiles === null) { $this->routingFiles = []; foreach (\OC_APP::getEnabledApps() as $app) { $appPath = \OC_App::getAppPath($app); diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 98cf11e3a87c3..5c81ceb7a82ae 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -187,13 +187,12 @@ public function getSupportedDatabases($allowAllDatabases = false) { foreach ($configuredDatabases as $database) { if (array_key_exists($database, $availableDatabases)) { - $working = false; $type = $availableDatabases[$database]['type']; $call = $availableDatabases[$database]['call']; if ($type === 'function') { $working = $this->is_callable($call); - } elseif ($type === 'pdo') { + } else { $working = in_array($call, $this->getAvailableDbDriversForPdo(), true); } if ($working) { diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 9a2b413896b00..4c3866d714e7c 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1266,6 +1266,7 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false return []; } + /** @var IShare[] $shares */ $shares = $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset); /* @@ -1273,6 +1274,7 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false * proper pagination. */ + /** @var IShare[] $shares2 */ $shares2 = []; while (true) { diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 24082926b0d94..016f129227f64 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -66,6 +66,7 @@ class User implements IUser { /** @var UserInterface|null */ private $backend; + /** @var EventDispatcherInterface */ private $legacyDispatcher; @@ -127,23 +128,26 @@ public function getUID() { * * @return string */ - public function getDisplayName() { - if (!isset($this->displayName)) { - $displayName = ''; - if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) { - // get display name and strip whitespace from the beginning and end of it - $backendDisplayName = $this->backend->getDisplayName($this->uid); - if (is_string($backendDisplayName)) { - $displayName = trim($backendDisplayName); - } - } + public function getDisplayName(): string { + if ($this->displayName !== null) { + return $this->displayName; + } - if (!empty($displayName)) { - $this->displayName = $displayName; - } else { - $this->displayName = $this->uid; + $displayName = ''; + if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) { + // get display name and strip whitespace from the beginning and end of it + $backendDisplayName = $this->backend->getDisplayName($this->uid); + if (is_string($backendDisplayName)) { + $displayName = trim($backendDisplayName); } } + + if (!empty($displayName)) { + $this->displayName = $displayName; + } else { + $this->displayName = $this->uid; + } + return $this->displayName; }