Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(psalm): psalm fix #1652

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Controller/PreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ public function index(
}


protected function getFileIdForAlbums($fileId, $albums) {
/**
* @param (\OCA\Photos\Album\AlbumInfo|mixed)[] $albums
*
* @psalm-param array<\OCA\Photos\Album\AlbumInfo|mixed> $albums
artonge marked this conversation as resolved.
Show resolved Hide resolved
*/
protected function getFileIdForAlbums(int $fileId, array $albums) {
foreach ($albums as $album) {
$albumFile = $this->albumMapper->getForAlbumIdAndFileId($album->getId(), $fileId);
$nodes = $this->rootFolder
Expand Down
3 changes: 1 addition & 2 deletions lib/Sabre/Album/AlbumRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ protected function getPhotosLocationInfo() {
*
* @param string $name
* @param null|resource|string $data
* @return void
*/
public function createFile($name, $data = null) {
public function createFile($name, $data = null): string {
try {
[$photosLocation, $userFolder] = $this->getPhotosLocationInfo();

Expand Down
4 changes: 3 additions & 1 deletion lib/Sabre/PhotosHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public function getChild($name) {
}

/**
* @return (AlbumsHome)[]
* @return (AlbumsHome|PlacesHome|SharedAlbumsHome)[]
*
* @psalm-return array{0: AlbumsHome, 1: SharedAlbumsHome, 2: PlacesHome}
artonge marked this conversation as resolved.
Show resolved Hide resolved
*/
public function getChildren(): array {
return [
Expand Down
6 changes: 4 additions & 2 deletions lib/Sabre/Place/PlaceRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
use Sabre\DAV\ICollection;

class PlaceRoot implements ICollection {
/** @var PlaceFile[]|null */
/** @var PlacePhoto[]|null */
protected ?array $children = null;

public function __construct(
Expand Down Expand Up @@ -83,7 +83,9 @@ public function createDirectory($name) {
}

/**
* @return PlacePhoto[]
* @return (PlacePhoto)[]
*
* @psalm-return array<PlacePhoto>
*/
public function getChildren(): array {
if ($this->children === null) {
Expand Down
4 changes: 1 addition & 3 deletions lib/Sabre/PublicRootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ public function getChildForPrincipal(array $principalInfo): PublicAlbumRoot {
* @param string $token
*
* @throws NotFound
*
* @return DAV\INode
*/
public function getChild($token) {
public function getChild($token): PublicAlbumRoot {
$this->throttler->sleepDelayOrThrowOnMax($this->request->getRemoteAddress(), self::BRUTEFORCE_ACTION);

if (is_null($token)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ReverseGeoCoderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private function loadCities1000(): array {
return $cities;
}

public function buildKDTree($force = false): void {
public function buildKDTree(bool $force = false): void {
if ($this->geoNameFolder->fileExists('cities1000.bin') && !$force) {
return;
}
Expand Down