Skip to content

Commit

Permalink
Bump vimeo/psalm from 4.2.1 to 4.3.0
Browse files Browse the repository at this point in the history
Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 4.2.1 to 4.3.0.
- [Release notes](https://github.com/vimeo/psalm/releases)
- [Commits](vimeo/psalm@4.2.1...4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
  • Loading branch information
dependabot-preview[bot] authored and MorrisJobke committed Jan 11, 2021
1 parent 5ed673e commit ad3de0f
Show file tree
Hide file tree
Showing 21 changed files with 130 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -207,7 +211,6 @@ public function schedule(Message $iTipMessage) {


$meetingUrl = $vevent->URL;
$meetingLocation = $vevent->LOCATION;

$defaultVal = '--';

Expand Down
22 changes: 16 additions & 6 deletions apps/dav/lib/Connector/Sabre/SharesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
*/
private $userFolder;

/** @var IShare[] */
/** @var IShare[][] */
private $cachedShares = [];

private $cachedFolders = [];
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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 {
Expand All @@ -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 [];
Expand Down Expand Up @@ -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();
Expand All @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion apps/encryption/lib/Crypto/EncryptAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/lib/Controller/HelpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
7 changes: 3 additions & 4 deletions apps/settings/lib/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);

Expand All @@ -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);
}
Expand Down
8 changes: 6 additions & 2 deletions apps/settings/lib/Mailer/NewUserMailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions apps/user_ldap/lib/User/OfflineUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/weather_status/lib/Service/WeatherStatusService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit ad3de0f

Please sign in to comment.