Skip to content

Commit

Permalink
fixup! Bump vimeo/psalm from 4.2.1 to 4.3.0
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Dec 28, 2020
1 parent 3c37444 commit 602232b
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel,
if ($syncToken) {
$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
if ($limit > 0) {
$query .= " LIMIT " . (int)$limit;
$query .= " LIMIT " . $limit;
}

// Fetching all changes
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
1 change: 0 additions & 1 deletion apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,6 @@ public function updateShare(
// NOT A LINK SHARE
else {
if ($permissions !== null) {
$permissions = (int) $permissions;
$share->setPermissions($permissions);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/theming/lib/IconBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ public function renderAppIcon($app, $size) {
// offset for icon positioning
$border_w = (int)($appIconFile->getImageWidth() * 0.05);
$border_h = (int)($appIconFile->getImageHeight() * 0.05);
$innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2);
$innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2);
$innerWidth = ($appIconFile->getImageWidth() - $border_w * 2);
$innerHeight = ($appIconFile->getImageHeight() - $border_h * 2);
$appIconFile->adaptiveResizeImage($innerWidth, $innerHeight);
// center icon
$offset_w = 512 / 2 - $innerWidth / 2;
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 @@ -180,7 +180,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 @@ -203,6 +203,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 @@ -1759,6 +1763,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
2 changes: 1 addition & 1 deletion lib/private/AppFramework/Routing/RouteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function processResources(array $resources, string $routeNamePrefix =
$controllerName = $this->buildControllerName($controller);
$actionName = $this->buildActionName($method);

$routeName = $routeNamePrefix . $this->appName . '.' . strtolower($resource) . '.' . strtolower($method);
$routeName = $routeNamePrefix . $this->appName . '.' . strtolower($resource) . '.' . $method;

$route = $this->router->create($routeName, $url)
->method($verb);
Expand Down
3 changes: 1 addition & 2 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1266,13 +1266,15 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false
return [];
}

/** @var IShare[] $shares */
$shares = $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset);

/*
* Work around so we don't return expired shares but still follow
* proper pagination.
*/

/** @var IShare[] $shares2 */
$shares2 = [];

while (true) {
Expand Down
2 changes: 2 additions & 0 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public function insert(Entity $entity): Entity {
* updates an existing entry if duplicate keys are detected
* by the database
*
* @param Entity $entity the entity that should be created/updated
* @psalm-param T $entity the entity that should be created/updated
* @return Entity the saved entity with the (new) id
* @psalm-return T the saved entity with the (new) id
* @throws \InvalidArgumentException if entity has no id
* @since 15.0.0
Expand Down

0 comments on commit 602232b

Please sign in to comment.