Merge pull request #1024 from nextcloud/feat/psalm

Add static analysis
This commit is contained in:
Carl Schwan 2022-04-26 10:27:03 +02:00 committed by GitHub
commit 45934f51b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 2934 additions and 617 deletions

26
.github/workflows/static-analysis.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Static analysis
on: [pull_request]
jobs:
static-psalm-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: [ 'dev-master' ]
name: Nextcloud ${{ matrix.ocp-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v1
coverage: none
- name: Install dependencies
run: composer i
- name: Install dependencies
run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }}
- name: Run coding standards check
run: composer run psalm

2
.gitignore vendored
View File

@ -5,4 +5,4 @@
build/
.settings/
vendor/
.php_cs.cache
.php-cs-fixer.cache

View File

@ -25,10 +25,16 @@
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "psalm --threads=1 --update-baseline",
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache",
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l"
},
"require-dev": {
"nextcloud/coding-standard": "^0.5.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.22",
"christophwurst/nextcloud": "dev-master",
"nextcloud/coding-standard": "^1.0"
}
}

1082
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -453,9 +453,8 @@ class FileSharingBroadcaster implements IBroadcaster {
$senderName = $this->l10n->t('%s on %s', [$author, $instanceName]);
$message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]);
$message->setSubject($subject);
$message->setPlainBody($emailTemplate->renderText());
$message->setHtmlBody($emailTemplate->renderHtml());
$emailTemplate->setSubject($subject);
$message->useTemplate($emailTemplate);
$message->setTo([$email]);
$this->mailer->send($message);

View File

@ -109,7 +109,7 @@ class CirclesMaintenance extends Base {
$level = (int)$input->getOption('level');
if ($reset || $uninstall) {
$action = strtolower(($uninstall) ? 'uninstall' : 'reset');
$action = $uninstall ? 'uninstall' : 'reset';
$output->writeln('');
$output->writeln('');

View File

@ -204,7 +204,7 @@ class CirclesMemberships extends Base {
}
$type = Member::parseTypeString($input->getOption('type'));
$federatedUser = $this->federatedUserService->getFederatedUser($userId, (int)$type);
$federatedUser = $this->federatedUserService->getFederatedUser($userId, $type);
// if ($this->input->getOption('reset')) {
// $this->membershipsService->resetMemberships($federatedUser->getSingleId());

View File

@ -63,7 +63,7 @@ use OCP\IUserSession;
*
* @package OCA\Circles\Controller
*/
class AdminController extends OcsController {
class AdminController extends OCSController {
use TDeserialize;
use TNCLogger;
@ -156,7 +156,7 @@ class AdminController extends OcsController {
'local' => $local
]
);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -176,7 +176,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($circle));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -217,7 +217,7 @@ class AdminController extends OcsController {
'type' => $type
]
);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -254,7 +254,7 @@ class AdminController extends OcsController {
'level' => $level
]
);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -280,7 +280,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($this->circleService->getCircles($probe)));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -302,7 +302,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serialize($this->circleService->getCircle($circleId, $probe)));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -322,7 +322,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -342,7 +342,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -368,7 +368,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'memberId' => $memberId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -391,7 +391,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'memberId' => $memberId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -410,7 +410,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId)));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -432,7 +432,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -454,7 +454,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -477,7 +477,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'setting' => $setting, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -502,7 +502,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -523,7 +523,7 @@ class AdminController extends OcsController {
return new DataResponse($this->serialize($membership));
} catch (Exception $e) {
$this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'singleId' => $singleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}

View File

@ -118,7 +118,7 @@ class EventWrapperController extends Controller {
public function asyncBroadcast(string $token): DataResponse {
$wrappers = $this->remoteUpstreamService->getEventsByToken($token);
if (empty($wrappers) && $token !== 'test-dummy-token') {
return new DataResponse(null, Http::STATUS_OK);
return new DataResponse([], Http::STATUS_OK);
}
// closing socket, keep current process running.

View File

@ -62,7 +62,7 @@ use OCP\IUserSession;
*
* @package OCA\Circles\Controller
*/
class LocalController extends OcsController {
class LocalController extends OCSController {
use TDeserialize;
use TNCLogger;
@ -152,7 +152,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($circle));
} catch (Exception $e) {
$this->e($e, ['name' => $name, 'members' => $personal, 'local' => $local]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -174,7 +174,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($circle));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -194,7 +194,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($this->searchService->search($term)));
} catch (Exception $e) {
$this->e($e, ['term' => $term]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -217,7 +217,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serialize($this->circleService->getCircle($circleId, $probe)));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -252,7 +252,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'userId' => $userId, 'type' => $type]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -284,7 +284,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'members' => $members]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -306,7 +306,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -328,7 +328,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -359,7 +359,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'memberId' => $memberId, 'level' => $level]);
throw new OcsException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -386,7 +386,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'memberId' => $memberId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -410,7 +410,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($result));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'memberId' => $memberId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -438,7 +438,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($this->circleService->getCircles($probe)));
} catch (Exception $e) {
$this->e($e);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -458,7 +458,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId)));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -481,7 +481,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -504,7 +504,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -528,7 +528,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'setting' => $setting, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -551,7 +551,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serializeArray($outcome));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'value' => $value]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}
@ -573,7 +573,7 @@ class LocalController extends OcsController {
return new DataResponse($this->serialize($membership));
} catch (Exception $e) {
$this->e($e, ['circleId' => $circleId, 'singleId' => $singleId]);
throw new OCSException($e->getMessage(), $e->getCode());
throw new OCSException($e->getMessage(), (int)$e->getCode());
}
}

View File

@ -410,7 +410,7 @@ class CircleProviderRequestBuilder extends DeprecatedRequestBuilder {
->setValue('password', $qb->createNamedParameter($password))
->setValue('permissions', $qb->createNamedParameter($share->getPermissions()))
->setValue('token', $qb->createNamedParameter($share->getToken()))
->setValue('stime', $qb->createFunction('UNIX_TIMESTAMP()'));
->setValue('stime', (string)$qb->createFunction('UNIX_TIMESTAMP()'));
return $qb;
}

View File

@ -130,7 +130,7 @@ class MemberRequestBuilder extends CoreRequestBuilder {
* @param CoreQueryBuilder $qb
* @param bool $asFederatedUser
*
* @return Member|FederatedUser[]
* @return Member[]|FederatedUser[]
*/
public function getItemsFromRequest(CoreQueryBuilder $qb, bool $asFederatedUser = false): array {
$object = Member::class;

View File

@ -32,7 +32,7 @@ declare(strict_types=1);
namespace OCA\Circles\Db;
use OCA\Circles\Tools\Exceptions\RowNotFoundException;
use OC\Share20\Share;
use OCP\Share\IShare;
use OCA\Circles\Exceptions\ShareWrapperNotFoundException;
use OCA\Circles\Model\ShareWrapper;
@ -74,7 +74,7 @@ class ShareWrapperRequestBuilder extends CoreRequestBuilder {
protected function getShareSelectSql(string $alias = CoreQueryBuilder::SHARE): CoreQueryBuilder {
$qb = $this->getQueryBuilder();
$qb->generateSelect(self::TABLE_SHARE, self::$outsideTables[self::TABLE_SHARE], $alias)
->limitToShareType(Share::TYPE_CIRCLE);
->limitToShareType(IShare::TYPE_CIRCLE);
return $qb;
}
@ -88,7 +88,7 @@ class ShareWrapperRequestBuilder extends CoreRequestBuilder {
protected function getShareDeleteSql(): CoreQueryBuilder {
$qb = $this->getQueryBuilder();
$qb->delete(self::TABLE_SHARE)
->limitToShareType(Share::TYPE_CIRCLE);
->limitToShareType(IShare::TYPE_CIRCLE);
return $qb;
}

View File

@ -37,6 +37,7 @@ use OCA\Circles\Tools\IDeserializable;
use OCA\Circles\Tools\Traits\TDeserialize;
use OCA\Circles\Tools\Traits\TArrayTools;
use DateTime;
use DateTimeInterface;
use JsonSerializable;
use OC;
use OC\Files\Cache\Cache;
@ -58,555 +59,285 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J
use TArrayTools;
use TDeserialize;
private string $id = '';
private int $permissions = 0;
private string $itemType = '';
private int $itemSource = 0;
private string $itemTarget = '';
private int $fileSource = 0;
private string $fileTarget = '';
private string $token = '';
private int $status = 0;
private string $providerId = '';
private DateTimeInterface $shareTime;
private string $sharedWith = '';
private string $sharedBy = '';
private string $shareOwner = '';
private int $shareType = 0;
private ?Circle $circle = null;
private int $childId = 0;
private string $childFileTarget = '';
private int $childPermissions = 0;
private ?FileCacheWrapper $fileCache = null;
private ?Member $initiator = null;
private ?Member $owner = null;
private ?ShareToken $shareToken = null;
/** @var string */
private $id = '';
public function __construct() {
$this->shareTime = new DateTime();
}
/** @var int */
private $permissions = 0;
/** @var string */
private $itemType = '';
/** @var int */
private $itemSource = 0;
/** @var string */
private $itemTarget = '';
/** @var int */
private $fileSource = 0;
/** @var string */
private $fileTarget = '';
/** @var string */
private $token = '';
/** @var int */
private $status = 0;
/** @var string */
private $providerId = '';
/** @var DateTime */
private $shareTime = '';
/** @var string */
private $sharedWith = '';
/** @var string */
private $sharedBy = '';
/** @var string */
private $shareOwner = '';
/** @var int */
private $shareType = 0;
/** @var Circle */
private $circle;
/** @var int */
private $childId = 0;
/** @var string */
private $childFileTarget = '';
/** @var int */
private $childPermissions = 0;
/** @var FileCacheWrapper */
private $fileCache;
/** @var Member */
private $initiator;
/** @var Member */
private $owner;
/** @var ShareToken */
private $shareToken;
/**
* @param string $id
*
* @return ShareWrapper
*/
public function setId(string $id): self {
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getId(): string {
return $this->id;
}
/**
* @param int $permissions
*
* @return ShareWrapper
*/
public function setPermissions(int $permissions): self {
$this->permissions = $permissions;
return $this;
}
/**
* @return int
*/
public function getPermissions(): int {
return $this->permissions;
}
/**
* @param string $itemType
*
* @return ShareWrapper
*/
public function setItemType(string $itemType): self {
$this->itemType = $itemType;
return $this;
}
/**
* @return string
*/
public function getItemType(): string {
return $this->itemType;
}
/**
* @param int $itemSource
*
* @return ShareWrapper
*/
public function setItemSource(int $itemSource): self {
$this->itemSource = $itemSource;
return $this;
}
/**
* @return int
*/
public function getItemSource(): int {
return $this->itemSource;
}
/**
* @param string $itemTarget
*
* @return ShareWrapper
*/
public function setItemTarget(string $itemTarget): self {
$this->itemTarget = $itemTarget;
return $this;
}
/**
* @return string
*/
public function getItemTarget(): string {
return $this->itemTarget;
}
/**
* @param int $fileSource
*
* @return ShareWrapper
*/
public function setFileSource(int $fileSource): self {
$this->fileSource = $fileSource;
return $this;
}
/**
* @return int
*/
public function getFileSource(): int {
return $this->fileSource;
}
/**
* @param string $fileTarget
*
* @return ShareWrapper
*/
public function setFileTarget(string $fileTarget): self {
$this->fileTarget = $fileTarget;
return $this;
}
/**
* @return string
*/
public function getFileTarget(): string {
return $this->fileTarget;
}
/**
* @param string $token
*
* @return ShareWrapper
*/
public function setToken(string $token): self {
$this->token = $token;
return $this;
}
/**
* @return string
*/
public function getToken(): string {
return $this->token;
}
/**
* @param int $status
*
* @return ShareWrapper
*/
public function setStatus(int $status): self {
$this->status = $status;
return $this;
}
/**
* @return int
*/
public function getStatus(): int {
return $this->status;
}
/**
* @param string $providerId
*
* @return $this
*/
public function setProviderId(string $providerId): self {
$this->providerId = $providerId;
return $this;
}
/**
* @return string
*/
public function getProviderId(): string {
return $this->providerId;
}
/**
* @param DateTime $shareTime
*
* @return ShareWrapper
*/
public function setShareTime(DateTime $shareTime): self {
public function setShareTime(DateTimeInterface $shareTime): self {
$this->shareTime = $shareTime;
return $this;
}
/**
* @return DateTime
*/
public function getShareTime(): DateTime {
public function getShareTime(): DateTimeInterface {
return $this->shareTime;
}
/**
* @param string $sharedWith
*
* @return ShareWrapper
*/
public function setSharedWith(string $sharedWith): self {
$this->sharedWith = $sharedWith;
return $this;
}
/**
* @return string
*/
public function getSharedWith(): string {
return $this->sharedWith;
}
/**
* @param string $sharedBy
*
* @return ShareWrapper
*/
public function setSharedBy(string $sharedBy): self {
$this->sharedBy = $sharedBy;
return $this;
}
/**
* @return string
*/
public function getSharedBy(): string {
return $this->sharedBy;
}
/**
* @param string $shareOwner
*
* @return ShareWrapper
*/
public function setShareOwner(string $shareOwner): self {
$this->shareOwner = $shareOwner;
return $this;
}
/**
* @return string
*/
public function getShareOwner(): string {
return $this->shareOwner;
}
/**
* @param int $shareType
*
* @return ShareWrapper
*/
public function setShareType(int $shareType): self {
$this->shareType = $shareType;
return $this;
}
/**
* @return int
*/
public function getShareType(): int {
return $this->shareType;
}
/**
* @param Circle $circle
*
* @return ShareWrapper
*/
public function setCircle(Circle $circle): self {
$this->circle = $circle;
return $this;
}
/**
* @return Circle
*/
public function getCircle(): Circle {
return $this->circle;
}
/**
* @return bool
*/
public function hasCircle(): bool {
return (!is_null($this->circle));
}
/**
* @param int $childId
*
* @return ShareWrapper
*/
public function setChildId(int $childId): self {
$this->childId = $childId;
return $this;
}
/**
* @return int
*/
public function getChildId(): int {
return $this->childId;
}
/**
* @param string $childFileTarget
*
* @return ShareWrapper
*/
public function setChildFileTarget(string $childFileTarget): self {
$this->childFileTarget = $childFileTarget;
return $this;
}
/**
* @return string
*/
public function getChildFileTarget(): string {
return $this->childFileTarget;
}
/**
* @param int $childPermissions
*
* @return ShareWrapper
*/
public function setChildPermissions(int $childPermissions): self {
$this->childPermissions = $childPermissions;
return $this;
}
/**
* @return int
*/
public function getChildPermissions(): int {
return $this->childPermissions;
}
/**
* @param FileCacheWrapper $fileCache
*
* @return $this
*/
public function setFileCache(FileCacheWrapper $fileCache): self {
$this->fileCache = $fileCache;
return $this;
}
/**
* @return FileCacheWrapper
*/
public function getFileCache(): FileCacheWrapper {
return $this->fileCache;
}
/**
* @return bool
*/
public function hasFileCache(): bool {
return (!is_null($this->fileCache));
}
/**
* @param Member $initiator
*
* @return ShareWrapper
*/
public function setInitiator(Member $initiator): self {
$this->initiator = $initiator;
return $this;
}
/**
* @return Member
*/
public function getInitiator(): Member {
return $this->initiator;
}
/**
* @return bool
*/
public function hasInitiator(): bool {
return (!is_null($this->initiator));
}
/**
* @param Member $owner
*
* @return ShareWrapper
*/
public function setOwner(Member $owner): self {
$this->owner = $owner;
return $this;
}
/**
* @return Member
*/
public function getOwner(): Member {
return $this->owner;
}
/**
* @return bool
*/
public function hasOwner(): bool {
return (!is_null($this->owner));
}
/**
* @param ShareToken $shareToken
*
* @return ShareWrapper
*/
public function setShareToken(ShareToken $shareToken): self {
$this->shareToken = $shareToken;
return $this;
}
/**
* @return ShareToken
*/
public function getShareToken(): ShareToken {
return $this->shareToken;
}
/**
* @return bool
*/
public function hasShareToken(): bool {
return !is_null($this->shareToken);
}
/**
* @param IRootFolder $rootFolder
* @param IUserManager $userManager
* @param IURLGenerator $urlGenerator
* @param bool $nullOnMissingFileCache
*
* @return IShare
* @throws IllegalIDChangeException
*/
public function getShare(
@ -656,12 +387,7 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J
return $share;
}
/**
* @param IShare $share
* @param IURLGenerator $urlGenerator
*/
private function setShareDisplay(IShare $share, IURLGenerator $urlGenerator) {
private function setShareDisplay(IShare $share, IURLGenerator $urlGenerator): void {
if (!$this->hasCircle()) {
return;
}
@ -711,8 +437,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J
/**
* @param array $data
*
* @return IDeserializable
* @throws InvalidItemException
*/
public function import(array $data): IDeserializable {
@ -776,13 +500,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J
return $this;
}
/**
* @param array $data
* @param string $prefix
*
* @return IQueryRow
*/
public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
$shareTime = new DateTime();
$shareTime->setTimestamp($this->getInt($prefix . 'stime', $data));
@ -818,10 +535,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J
return $this;
}
/**
* @return string[]
*/
public function jsonSerialize(): array {
$arr = [
'id' => $this->getId(),

View File

@ -43,7 +43,7 @@ class SimpleDataStore implements JsonSerializable {
use TArrayTools;
/** @var array|JsonSerializable */
/** @var array */
private $data;
@ -60,11 +60,7 @@ class SimpleDataStore implements JsonSerializable {
$this->data = $data;
}
/**
* @param array $default
*/
public function default(array $default = []) {
public function default(array $default = []): void {
$this->data = array_merge($default, $this->data);
}
@ -474,7 +470,10 @@ class SimpleDataStore implements JsonSerializable {
* @return $this
*/
public function obj(JsonSerializable $obj): self {
$this->data = $obj;
$data = $obj->jsonSerialize();
if (is_array($data)) {
$this->data = $data;
}
return $this;
}

39
psalm.xml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
>
<stubs>
<file name="tests/stub.phpstub" preloadClasses="true"/>
</stubs>
<projectFiles>
<directory name="lib" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<extraFiles>
<directory name="vendor" />
<ignoreFiles>
<directory name="vendor/phpunit/php-code-coverage" />
</ignoreFiles>
</extraFiles>
<issueHandlers>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="OC" />
</errorLevel>
</UndefinedClass>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
</psalm>

916
tests/psalm-baseline.xml Normal file
View File

@ -0,0 +1,916 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="lib/Activity/Provider.php">
<ParamNameMismatch occurrences="1">
<code>$lang</code>
</ParamNameMismatch>
</file>
<file src="lib/Activity/ProviderParser.php">
<InvalidNullableReturnType occurrences="1">
<code>array&lt;string,string|integer&gt;</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
<UndefinedMethod occurrences="1">
<code>Circles::generateAbsoluteLink($circle-&gt;getUniqueId())</code>
</UndefinedMethod>
</file>
<file src="lib/Circles/FileSharingBroadcaster.php">
<InvalidScalarArgument occurrences="2">
<code>$share-&gt;getId()</code>
<code>$share-&gt;getId()</code>
</InvalidScalarArgument>
<TypeDoesNotContainType occurrences="2">
<code>!$sendPasswordByMail</code>
<code>$sendPasswordByMail</code>
</TypeDoesNotContainType>
<UndefinedClass occurrences="3">
<code>Notifications</code>
<code>Share</code>
<code>Share</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="2">
<code>$this-&gt;federationNotifications</code>
<code>Notifications</code>
</UndefinedDocblockClass>
<UndefinedFunction occurrences="1">
<code>setSubject($subject)</code>
</UndefinedFunction>
<UndefinedInterfaceMethod occurrences="4">
<code>getLazyRootFolder</code>
<code>setHtmlBody</code>
<code>setPlainBody</code>
<code>setSubject</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/CirclesManager.php">
<InvalidNullableReturnType occurrences="1">
<code>IFederatedUser</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="1">
<code>$this-&gt;federatedUserService-&gt;getCurrentUser()</code>
</NullableReturnStatement>
</file>
<file src="lib/Collaboration/v2/CollaboratorSearchPlugin.php">
<UndefinedClass occurrences="1">
<code>Share</code>
</UndefinedClass>
</file>
<file src="lib/Command/CirclesCheck.php">
<UndefinedClass occurrences="1">
<code>AppConfig</code>
</UndefinedClass>
</file>
<file src="lib/Command/CirclesRemote.php">
<UndefinedMethod occurrences="1">
<code>setType</code>
</UndefinedMethod>
</file>
<file src="lib/Command/CirclesReport.php">
<UndefinedClass occurrences="1">
<code>IInteractiveShellClient</code>
</UndefinedClass>
</file>
<file src="lib/Command/CirclesTest.php">
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
<RedundantCondition occurrences="2">
<code>$compareToInitiator !== null</code>
<code>$compareToOwner !== null</code>
</RedundantCondition>
<TypeDoesNotContainNull occurrences="1">
<code>$owner === null</code>
</TypeDoesNotContainNull>
</file>
<file src="lib/Command/FixUniqueId.php">
<UndefinedClass occurrences="1">
<code>Share</code>
</UndefinedClass>
</file>
<file src="lib/Command/MembersAdd.php">
<UndefinedMethod occurrences="1">
<code>retrieveJson</code>
</UndefinedMethod>
</file>
<file src="lib/Command/MembersList.php">
<UndefinedInterfaceMethod occurrences="7">
<code>getInstance</code>
<code>getInstance</code>
<code>getInvitedBy</code>
<code>getOwner</code>
<code>getSingleId</code>
<code>getStatus</code>
<code>hasInvitedBy</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Command/SyncContact.php">
<InvalidReturnType occurrences="1">
<code>int|void|null</code>
</InvalidReturnType>
<UndefinedClass occurrences="1">
<code>CardDavBackend</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="3">
<code>$this-&gt;cardDavBackend</code>
<code>$this-&gt;cardDavBackend</code>
<code>CardDavBackend</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Controller/RemoteController.php">
<InvalidScalarArgument occurrences="1">
<code>($e-&gt;getCode() &gt; 0) ? $e-&gt;getCode() : $httpErrorCode</code>
</InvalidScalarArgument>
</file>
<file src="lib/Db/CoreRequestBuilder.php">
<UndefinedClass occurrences="1">
<code>Connection</code>
</UndefinedClass>
<UndefinedMethod occurrences="2">
<code>dropTable</code>
<code>hasTable</code>
</UndefinedMethod>
</file>
<file src="lib/Db/DeprecatedCirclesRequest.php">
<InvalidArgument occurrences="1">
<code>$circle-&gt;getType()</code>
</InvalidArgument>
<InvalidScalarArgument occurrences="5">
<code>$circle-&gt;getUniqueId(true)</code>
<code>$circleUniqueId</code>
<code>$circleUniqueId</code>
<code>(string)$uniqueId</code>
<code>-1</code>
</InvalidScalarArgument>
</file>
<file src="lib/Db/DeprecatedCirclesRequestBuilder.php">
<InvalidNullableReturnType occurrences="3">
<code>ICompositeExpression</code>
<code>string</code>
<code>string</code>
</InvalidNullableReturnType>
<InvalidReturnStatement occurrences="1"/>
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<NullableReturnStatement occurrences="4">
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
</NullableReturnStatement>
</file>
<file src="lib/Db/DeprecatedMembersRequest.php">
<UndefinedClass occurrences="1">
<code>UniqueConstraintViolationException</code>
</UndefinedClass>
</file>
<file src="lib/Db/FederatedLinksRequest.php">
<InvalidNullableReturnType occurrences="1">
<code>FederatedLink</code>
</InvalidNullableReturnType>
<InvalidScalarArgument occurrences="4">
<code>$linkUniqueId</code>
<code>$linkUniqueId</code>
<code>$status</code>
<code>(string)$uniqueId</code>
</InvalidScalarArgument>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
<TypeDoesNotContainNull occurrences="1">
<code>$link === null</code>
</TypeDoesNotContainNull>
</file>
<file src="lib/Db/FileSharesRequest.php">
<InvalidScalarArgument occurrences="2">
<code>self::SHARE_TYPE</code>
<code>self::SHARE_TYPE</code>
</InvalidScalarArgument>
</file>
<file src="lib/Db/MemberRequest.php">
<InvalidReturnStatement occurrences="5">
<code>$this-&gt;getItemsFromRequest($qb)</code>
<code>$this-&gt;getItemsFromRequest($qb)</code>
<code>$this-&gt;getItemsFromRequest($qb)</code>
<code>$this-&gt;getItemsFromRequest($qb)</code>
<code>$this-&gt;getItemsFromRequest($qb, true)</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="5">
<code>FederatedUser[]</code>
<code>Member[]</code>
<code>Member[]</code>
<code>Member[]</code>
<code>Member[]</code>
</InvalidReturnType>
</file>
<file src="lib/Db/ShareWrapperRequest.php">
<InvalidScalarArgument occurrences="1">
<code>$id</code>
</InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$getData</code>
</RedundantCondition>
</file>
<file src="lib/Db/TokensRequest.php">
<InvalidScalarArgument occurrences="2">
<code>$shareId</code>
<code>$shareId</code>
</InvalidScalarArgument>
<UndefinedClass occurrences="1">
<code>UniqueConstraintViolationException</code>
</UndefinedClass>
</file>
<file src="lib/FederatedItems/SharedItemsSync.php">
<UndefinedClass occurrences="1">
<code>CircleEventService</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="2">
<code>$this-&gt;circleEventService</code>
<code>CircleEventService</code>
</UndefinedDocblockClass>
</file>
<file src="lib/GlobalScale/CircleCreate.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/CircleDestroy.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/CircleStatus.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/CircleUpdate.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/FileShare.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
<TypeDoesNotContainType occurrences="2">
<code>!$sendPasswordByMail</code>
<code>$sendPasswordByMail</code>
</TypeDoesNotContainType>
<UndefinedClass occurrences="1">
<code>Share</code>
</UndefinedClass>
<UndefinedInterfaceMethod occurrences="3">
<code>setHtmlBody</code>
<code>setPlainBody</code>
<code>setSubject</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/GlobalScale/FileUnshare.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/GSMount/Mount.php">
<UndefinedClass occurrences="1">
<code>MoveableMount</code>
</UndefinedClass>
</file>
<file src="lib/GlobalScale/GSMount/MountProvider.php">
<MissingDependency occurrences="2">
<code>Mount</code>
<code>Mount</code>
</MissingDependency>
<TooManyArguments occurrences="1">
<code>getCertificateManager</code>
</TooManyArguments>
<UndefinedMethod occurrences="1">
<code>isLocalNonSSL</code>
</UndefinedMethod>
</file>
<file src="lib/GlobalScale/GlobalSync.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/MemberAdd.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
<UndefinedInterfaceMethod occurrences="3">
<code>setHtmlBody</code>
<code>setPlainBody</code>
<code>setSubject</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/GlobalScale/MemberJoin.php">
<InvalidScalarArgument occurrences="1">
<code>$circle-&gt;getType()</code>
</InvalidScalarArgument>
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/MemberLeave.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/MemberRemove.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/MemberUpdate.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/Test.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/GlobalScale/UserDeleted.php">
<ParamNameMismatch occurrences="1">
<code>$mustBeChecked</code>
</ParamNameMismatch>
</file>
<file src="lib/Handlers/WebfingerHandler.php">
<InvalidPropertyAssignmentValue occurrences="1">
<code>$urlGenerator</code>
</InvalidPropertyAssignmentValue>
<InvalidScalarArgument occurrences="1">
<code>$info</code>
</InvalidScalarArgument>
<ParamNameMismatch occurrences="1">
<code>$response</code>
</ParamNameMismatch>
<UndefinedDocblockClass occurrences="1">
<code>URLGenerator</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Migration/ImportOwncloudCustomGroups.php">
<MissingDependency occurrences="2">
<code>Share</code>
<code>Share</code>
</MissingDependency>
<UndefinedConstant occurrences="1">
<code>Share::SHARE_TYPE_CIRCLE</code>
</UndefinedConstant>
</file>
<file src="lib/Migration/Version0022Date20220526111723.php">
<UndefinedClass occurrences="1">
<code>Connection</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="2">
<code>$this-&gt;connection</code>
<code>Connection</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Migration/Version0022Date20220526113601.php">
<UndefinedClass occurrences="1">
<code>Types</code>
</UndefinedClass>
</file>
<file src="lib/Model/BaseCircle.php">
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;type</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="1">
<code>$this-&gt;getUniqueId()</code>
</InvalidScalarArgument>
<RedundantCast occurrences="1">
<code>(array)self::CIRCLES_SETTINGS_DEFAULT</code>
</RedundantCast>
</file>
<file src="lib/Model/BaseMember.php">
<InvalidNullableReturnType occurrences="1">
<code>DeprecatedMember</code>
</InvalidNullableReturnType>
<InvalidScalarArgument occurrences="1">
<code>$member-&gt;getType()</code>
</InvalidScalarArgument>
<NullableReturnStatement occurrences="1">
<code>self::fromArray(json_decode($json, true))</code>
</NullableReturnStatement>
</file>
<file src="lib/Model/Circle.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>self</code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/Model/DavCard.php">
<InvalidScalarArgument occurrences="1">
<code>$this-&gt;get('addressBookId', $data)</code>
</InvalidScalarArgument>
</file>
<file src="lib/Model/Federated/RemoteInstance.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>NCSignatory</code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/Model/FederatedLink.php">
<InvalidPropertyAssignmentValue occurrences="1">
<code>$circleUniqueId</code>
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;circleUniqueId</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="1">
<code>$this-&gt;circleUniqueId</code>
</InvalidScalarArgument>
</file>
<file src="lib/Model/FederatedUser.php">
<InvalidReturnStatement occurrences="1">
<code>$arr</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string[]</code>
</InvalidReturnType>
<LessSpecificImplementedReturnType occurrences="1">
<code>self</code>
</LessSpecificImplementedReturnType>
<MismatchingDocblockParamType occurrences="1">
<code>Circle|null</code>
</MismatchingDocblockParamType>
</file>
<file src="lib/Model/FileCacheWrapper.php">
<InvalidReturnStatement occurrences="1"/>
<InvalidReturnType occurrences="1">
<code>string[]</code>
</InvalidReturnType>
</file>
<file src="lib/Model/ManagedModel.php">
<UndefinedMethod occurrences="6">
<code>setBasedOn</code>
<code>setDisplayName</code>
<code>setInstance</code>
<code>setSingleId</code>
<code>setUserId</code>
<code>setUserType</code>
</UndefinedMethod>
</file>
<file src="lib/Model/Member.php">
<InvalidClass occurrences="1">
<code>$inheritedBy</code>
</InvalidClass>
<InvalidReturnStatement occurrences="1">
<code>$arr</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string[]</code>
</InvalidReturnType>
<LessSpecificImplementedReturnType occurrences="1">
<code>self</code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/Model/Probes/BasicProbe.php">
<InvalidReturnType occurrences="1">
<code>$this</code>
</InvalidReturnType>
</file>
<file src="lib/Model/ShareWrapper.php">
<InvalidNullableReturnType occurrences="5">
<code>Circle</code>
<code>FileCacheWrapper</code>
<code>Member</code>
<code>Member</code>
<code>ShareToken</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="5">
<code>$this-&gt;circle</code>
<code>$this-&gt;fileCache</code>
<code>$this-&gt;initiator</code>
<code>$this-&gt;owner</code>
<code>$this-&gt;shareToken</code>
</NullableReturnStatement>
<UndefinedClass occurrences="1">
<code>Share</code>
</UndefinedClass>
</file>
<file src="lib/Model/SharesToken.php">
<InvalidScalarArgument occurrences="1">
<code>$this-&gt;get('share_id', $data, '')</code>
</InvalidScalarArgument>
</file>
<file src="lib/Model/SharingFrame.php">
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
<NullableReturnStatement occurrences="2">
<code>null</code>
<code>null</code>
</NullableReturnStatement>
</file>
<file src="lib/MountManager/CircleMount.php">
<UndefinedClass occurrences="1">
<code>MoveableMount</code>
</UndefinedClass>
</file>
<file src="lib/MountManager/CircleMountProvider.php">
<MissingDependency occurrences="1">
<code>CircleMount</code>
</MissingDependency>
<UndefinedClass occurrences="1">
<code>ExternalStorage</code>
</UndefinedClass>
</file>
<file src="lib/Search/Contacts.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
<InvalidReturnStatement occurrences="1">
<code>$result</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>search</code>
</InvalidReturnType>
<MethodSignatureMismatch occurrences="1">
<code>Contacts</code>
</MethodSignatureMismatch>
<ParamNameMismatch occurrences="1">
<code>$search</code>
</ParamNameMismatch>
</file>
<file src="lib/Search/FederatedUsers.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>array</code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/Search/GlobalScaleUsers.php">
<InvalidReturnStatement occurrences="1">
<code>$result</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>array</code>
</InvalidReturnType>
<ParamNameMismatch occurrences="1">
<code>$search</code>
</ParamNameMismatch>
</file>
<file src="lib/Search/LocalGroups.php">
<InvalidReturnStatement occurrences="1">
<code>$result</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>search</code>
</InvalidReturnType>
<MethodSignatureMismatch occurrences="1">
<code>LocalGroups</code>
</MethodSignatureMismatch>
<ParamNameMismatch occurrences="1">
<code>$search</code>
</ParamNameMismatch>
</file>
<file src="lib/Search/LocalUsers.php">
<InvalidReturnStatement occurrences="1">
<code>$result</code>
</InvalidReturnStatement>
<MethodSignatureMismatch occurrences="1">
<code>LocalUsers</code>
</MethodSignatureMismatch>
<ParamNameMismatch occurrences="1">
<code>$search</code>
</ParamNameMismatch>
</file>
<file src="lib/Service/CircleService.php">
<MismatchingDocblockParamType occurrences="1">
<code>CircleProbe|null</code>
</MismatchingDocblockParamType>
</file>
<file src="lib/Service/CirclesService.php">
<InvalidScalarArgument occurrences="1">
<code>$type</code>
</InvalidScalarArgument>
<MismatchingDocblockParamType occurrences="1">
<code>DeprecatedCircle</code>
</MismatchingDocblockParamType>
<MismatchingDocblockReturnType occurrences="1">
<code>null|DeprecatedMember</code>
</MismatchingDocblockReturnType>
<TypeDoesNotContainType occurrences="2">
<code>$type === ''</code>
<code>$type === ''</code>
</TypeDoesNotContainType>
<UndefinedClass occurrences="3">
<code>DeprecatedCircle</code>
<code>Member</code>
<code>Member</code>
</UndefinedClass>
<UndefinedMethod occurrences="1">
<code>isFederatedCirclesAllowed</code>
</UndefinedMethod>
</file>
<file src="lib/Service/ConfigService.php">
<UndefinedPropertyFetch occurrences="1">
<code>OC::$WEBROOT</code>
</UndefinedPropertyFetch>
</file>
<file src="lib/Service/ContactService.php">
<TypeDoesNotContainNull occurrences="1">
<code>is_null($contactId)</code>
</TypeDoesNotContainNull>
<UndefinedClass occurrences="1">
<code>ContactsManager</code>
</UndefinedClass>
</file>
<file src="lib/Service/DavService.php">
<InvalidReturnStatement occurrences="1">
<code>$existing</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>DeprecatedCircle[]</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="3">
<code>$bookId</code>
<code>$bookId</code>
<code>$bookId</code>
</InvalidScalarArgument>
<UndefinedClass occurrences="1">
<code>CardDavBackend</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="6">
<code>$this-&gt;cardDavBackend</code>
<code>$this-&gt;cardDavBackend</code>
<code>$this-&gt;cardDavBackend</code>
<code>$this-&gt;cardDavBackend</code>
<code>$this-&gt;cardDavBackend</code>
<code>CardDavBackend</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Service/EventsService.php">
<InvalidArgument occurrences="2">
<code>$context</code>
<code>new GenericEvent(null, $arguments)</code>
</InvalidArgument>
</file>
<file src="lib/Service/FederatedShareService.php">
<InvalidMethodCall occurrences="1">
<code>gObj</code>
</InvalidMethodCall>
</file>
<file src="lib/Service/FederatedUserService.php">
<InvalidReturnType occurrences="1">
<code>FederatedUser</code>
</InvalidReturnType>
</file>
<file src="lib/Service/GSDownstreamService.php">
<UndefinedMethod occurrences="7">
<code>asyncBroadcast</code>
<code>checkEvent</code>
<code>checkEvent</code>
<code>checkEvent</code>
<code>getGlobalScaleEvent</code>
<code>getGlobalScaleEvent</code>
<code>getGlobalScaleEvent</code>
</UndefinedMethod>
</file>
<file src="lib/Service/GSUpstreamService.php">
<InvalidArgument occurrences="1">
<code>$wrapper</code>
</InvalidArgument>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;eventWrapperRequest-&gt;getByToken($token)</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>GSWrapper[]</code>
</InvalidReturnType>
<TooManyArguments occurrences="1">
<code>configureRequest</code>
</TooManyArguments>
<UndefinedMethod occurrences="6">
<code>asyncBroadcast</code>
<code>getGlobalScaleEvent</code>
<code>getGlobalScaleEvent</code>
<code>getInstances</code>
<code>getInstances</code>
<code>getKey</code>
</UndefinedMethod>
</file>
<file src="lib/Service/GlobalScaleService.php">
<UndefinedClass occurrences="1">
<code>Signer</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="1">
<code>Signer</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Service/MembersService.php">
<InvalidReturnStatement occurrences="1">
<code>$members</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>DeprecatedMember[]</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="1">
<code>$circle-&gt;getType()</code>
</InvalidScalarArgument>
<RedundantCast occurrences="1">
<code>(int)$level</code>
</RedundantCast>
<UndefinedMethod occurrences="1">
<code>isInvitationSkipped</code>
</UndefinedMethod>
</file>
<file src="lib/Service/MembershipService.php">
<ConflictingReferenceConstraint occurrences="1">
<code>if (!in_array($member-&gt;getCircleId(), $knownIds)) {</code>
</ConflictingReferenceConstraint>
</file>
<file src="lib/Service/MigrationService.php">
<UndefinedClass occurrences="1">
<code>ContactsManager</code>
</UndefinedClass>
</file>
<file src="lib/Service/MiscService.php">
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<TypeDoesNotContainType occurrences="1">
<code>is_array($contact)</code>
</TypeDoesNotContainType>
<UndefinedDocblockClass occurrences="2">
<code>$cManager</code>
<code>$cManager</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Service/RemoteStreamService.php">
<RedundantCondition occurrences="1">
<code>is_null($object)</code>
</RedundantCondition>
<TypeDoesNotContainNull occurrences="1">
<code>$signed === null</code>
</TypeDoesNotContainNull>
</file>
<file src="lib/Service/SendMailService.php">
<UndefinedInterfaceMethod occurrences="3">
<code>setHtmlBody</code>
<code>setPlainBody</code>
<code>setSubject</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Service/SyncService.php">
<InvalidClass occurrences="2">
<code>federatedEventService</code>
<code>federatedEventService</code>
</InvalidClass>
</file>
<file src="lib/Service/TimezoneService.php">
<UndefinedClass occurrences="1">
<code>TimeFactory</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="2">
<code>$this-&gt;timeFactory</code>
<code>TimeFactory</code>
</UndefinedDocblockClass>
</file>
<file src="lib/ShareByCircleProvider.php">
<ImplementedParamTypeMismatch occurrences="1">
<code>$shareId</code>
</ImplementedParamTypeMismatch>
<InvalidNullableReturnType occurrences="5">
<code>IShare</code>
<code>IShare</code>
<code>IShare</code>
<code>IShare</code>
<code>IShare</code>
</InvalidNullableReturnType>
<InvalidReturnType occurrences="1">
<code>iterable</code>
</InvalidReturnType>
<LessSpecificImplementedReturnType occurrences="1">
<code>array</code>
</LessSpecificImplementedReturnType>
<NullableReturnStatement occurrences="5">
<code>$wrappedShare-&gt;getShare($this-&gt;rootFolder, $this-&gt;userManager, $this-&gt;urlGenerator)</code>
<code>$wrappedShare-&gt;getShare($this-&gt;rootFolder, $this-&gt;userManager, $this-&gt;urlGenerator)</code>
<code>$wrappedShare-&gt;getShare($this-&gt;rootFolder, $this-&gt;userManager, $this-&gt;urlGenerator)</code>
<code>$wrappedShare-&gt;getShare($this-&gt;rootFolder, $this-&gt;userManager, $this-&gt;urlGenerator)</code>
<code>$wrappedShare-&gt;getShare($this-&gt;rootFolder, $this-&gt;userManager, $this-&gt;urlGenerator)</code>
</NullableReturnStatement>
<ParamNameMismatch occurrences="1">
<code>$shareId</code>
</ParamNameMismatch>
<RedundantCondition occurrences="1">
<code>!is_null($node)</code>
</RedundantCondition>
<TypeDoesNotContainNull occurrences="1">
<code>0</code>
</TypeDoesNotContainNull>
</file>
<file src="lib/ShareByCircleProviderDeprecated.php">
<ImplementedReturnTypeMismatch occurrences="4">
<code>IShare[]|null</code>
<code>Share</code>
<code>Share[]</code>
<code>Share[]</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="4">
<code>$shares</code>
<code>$this-&gt;createShareChild($userId, $share)</code>
<code>$this-&gt;createShareObject($data)</code>
<code>$this-&gt;getShareById($share-&gt;getId())</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="3">
<code>IShare</code>
<code>Share</code>
<code>Share[]</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="6">
<code>$id</code>
<code>$share-&gt;getId()</code>
<code>$share-&gt;getId()</code>
<code>$share-&gt;getId()</code>
<code>$share-&gt;getId()</code>
<code>$share-&gt;getSharedWith()</code>
</InvalidScalarArgument>
<MissingDependency occurrences="2">
<code>\OCP\Share</code>
<code>\OCP\Share</code>
</MissingDependency>
<ParamNameMismatch occurrences="4">
<code>$reShares</code>
<code>$shareId</code>
<code>$userId</code>
<code>$userId</code>
</ParamNameMismatch>
<RedundantCast occurrences="1">
<code>(int)$id</code>
</RedundantCast>
<RedundantCondition occurrences="1"/>
<TypeDoesNotContainNull occurrences="1">
<code>$arr === null</code>
</TypeDoesNotContainNull>
<UndefinedClass occurrences="2">
<code>InvalidShare</code>
<code>Share</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="3">
<code>Share</code>
<code>Share[]</code>
<code>Share[]</code>
</UndefinedDocblockClass>
<UndefinedMethod occurrences="1"/>
</file>
<file src="lib/Tools/ActivityPub/NCSignature.php">
<RedundantCondition occurrences="1">
<code>$varr[0] !== null</code>
</RedundantCondition>
</file>
<file src="lib/Tools/Model/NCRequestResult.php">
<UndefinedClass occurrences="3">
<code>BadResponseException</code>
<code>BadResponseException</code>
<code>BadResponseException|null</code>
</UndefinedClass>
<UndefinedDocblockClass occurrences="2">
<code>BadResponseException</code>
<code>private $exception = null;</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Tools/Model/SimpleDataStore.php">
<InvalidReturnStatement occurrences="1">
<code>$item</code>
</InvalidReturnStatement>
</file>
<file src="lib/Tools/Traits/TArrayTools.php">
<TooManyArguments occurrences="1">
<code>getArray</code>
</TooManyArguments>
</file>
<file src="lib/Tools/Traits/TNCLogger.php">
<RedundantPropertyInitializationCheck occurrences="1">
<code>isset($this-&gt;logger)</code>
</RedundantPropertyInitializationCheck>
<UndefinedClass occurrences="1">
<code>HintException</code>
</UndefinedClass>
</file>
<file src="lib/Tools/Traits/TNCRequest.php">
<InvalidArgument occurrences="1">
<code>$e</code>
</InvalidArgument>
<UndefinedClass occurrences="1">
<code>ClientException</code>
</UndefinedClass>
</file>
<file src="lib/Tools/Traits/TNCSignatory.php">
<UndefinedMethod occurrences="1">
<code>getOpenSSLAlgo</code>
</UndefinedMethod>
</file>
<file src="lib/Tools/Traits/TStringTools.php">
<InvalidArrayOffset occurrences="1">
<code>$s[$e]</code>
</InvalidArrayOffset>
</file>
</files>

1023
tests/stub.phpstub Normal file

File diff suppressed because it is too large Load Diff