diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-08-01 09:25:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 09:25:09 +0200 |
commit | 2b895e0c60b6f283cb26b2ca0e18a05497103bc2 (patch) | |
tree | 85e00c12d8a0e507d46c11ec4cba67fc31aae67e /lib | |
parent | 456392e627de3aad19c8188974a4972cf4e274db (diff) | |
parent | 2fae696d35d221a9fb25b90b90b32c35c81fdd45 (diff) | |
download | nextcloud-server-2b895e0c60b6f283cb26b2ca0e18a05497103bc2.tar.gz nextcloud-server-2b895e0c60b6f283cb26b2ca0e18a05497103bc2.zip |
Merge pull request #5847 from nextcloud/make-phan-config-more-strict-2
Phan fixes
Diffstat (limited to 'lib')
81 files changed, 251 insertions, 176 deletions
diff --git a/lib/private/App/CodeChecker/MigrationSchemaChecker.php b/lib/private/App/CodeChecker/MigrationSchemaChecker.php index 9dee358327d..ea403ad7758 100644 --- a/lib/private/App/CodeChecker/MigrationSchemaChecker.php +++ b/lib/private/App/CodeChecker/MigrationSchemaChecker.php @@ -36,6 +36,12 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { /** @var array */ public $errors = []; + /** + * @param Node $node + * @return void + * + * @suppress PhanUndeclaredProperty + */ public function enterNode(Node $node) { /** * Check tables diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 1ec028b9728..4e998c71f32 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -179,7 +179,7 @@ class DependencyAnalyzer { }, $supportedDatabases); $currentDatabase = $this->platform->getDatabase(); if (!in_array($currentDatabase, $supportedDatabases)) { - $missing[] = (string)$this->l->t('Following databases are supported: %s', implode(', ', $supportedDatabases)); + $missing[] = (string)$this->l->t('Following databases are supported: %s', [implode(', ', $supportedDatabases)]); } return $missing; } @@ -282,7 +282,7 @@ class DependencyAnalyzer { } $currentOS = $this->platform->getOS(); if (!in_array($currentOS, $oss)) { - $missing[] = (string)$this->l->t('Following platforms are supported: %s', implode(', ', $oss)); + $missing[] = (string)$this->l->t('Following platforms are supported: %s', [implode(', ', $oss)]); } return $missing; } @@ -315,12 +315,12 @@ class DependencyAnalyzer { if (!is_null($minVersion)) { if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { - $missing[] = (string)$this->l->t('Server version %s or higher is required.', $this->toVisibleVersion($minVersion)); + $missing[] = (string)$this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); } } if (!is_null($maxVersion)) { if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { - $missing[] = (string)$this->l->t('Server version %s or lower is required.', $this->toVisibleVersion($maxVersion)); + $missing[] = (string)$this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); } } return $missing; diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index b233f3ca9b6..d0c69c3bf32 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -75,7 +75,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { * Put your class dependencies in here * @param string $appName the name of the app * @param array $urlParams - * @param ServerContainer $server + * @param ServerContainer|null $server */ public function __construct($appName, $urlParams = array(), ServerContainer $server = null){ parent::__construct(); diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 09e18f74177..956744e5d5e 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -721,7 +721,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { // strip off the script name's dir and file name // FIXME: Sabre does not really belong here - list($path, $name) = \Sabre\HTTP\URLUtil::splitPath($scriptName); + list($path, $name) = \Sabre\Uri\split($scriptName); if (!empty($path)) { if($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) { $pathInfo = substr($pathInfo, strlen($path)); diff --git a/lib/private/BackgroundJob/Job.php b/lib/private/BackgroundJob/Job.php index cb9328f01b9..bf0195b0a1f 100644 --- a/lib/private/BackgroundJob/Job.php +++ b/lib/private/BackgroundJob/Job.php @@ -45,7 +45,7 @@ abstract class Job implements IJob { /** * @param JobList $jobList - * @param ILogger $logger + * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { $jobList->setLastRun($this); diff --git a/lib/private/BackgroundJob/QueuedJob.php b/lib/private/BackgroundJob/QueuedJob.php index e5afc792331..2abfd257a4c 100644 --- a/lib/private/BackgroundJob/QueuedJob.php +++ b/lib/private/BackgroundJob/QueuedJob.php @@ -36,7 +36,7 @@ abstract class QueuedJob extends Job { * run the job, then remove it from the joblist * * @param JobList $jobList - * @param ILogger $logger + * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { $jobList->remove($this, $this->argument); diff --git a/lib/private/BackgroundJob/TimedJob.php b/lib/private/BackgroundJob/TimedJob.php index 22b48a80371..9179cf258e2 100644 --- a/lib/private/BackgroundJob/TimedJob.php +++ b/lib/private/BackgroundJob/TimedJob.php @@ -47,7 +47,7 @@ abstract class TimedJob extends Job { * run the job if * * @param JobList $jobList - * @param ILogger $logger + * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { if ((time() - $this->lastRun) > $this->interval) { diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index eac13b452ac..217789ce728 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -242,7 +242,7 @@ class QueryBuilder implements IQueryBuilder { * * @param string|integer $key The parameter position or name. * @param mixed $value The parameter value. - * @param string|null $type One of the IQueryBuilder::PARAM_* constants. + * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 5a57532f71c..b842d86f6a7 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -52,6 +52,7 @@ use OCP\Files\InvalidDirectoryException; use OCP\Files\InvalidPathException; use OCP\Files\ReservedWordException; use OCP\Files\Storage\ILockingStorage; +use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; @@ -578,13 +579,13 @@ abstract class Common implements Storage, ILockingStorage { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @param bool $preserveMtime * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); } @@ -625,12 +626,12 @@ abstract class Common implements Storage, ILockingStorage { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); } diff --git a/lib/private/Files/Storage/FailedStorage.php b/lib/private/Files/Storage/FailedStorage.php index f717c798c5a..d2aae33bb21 100644 --- a/lib/private/Files/Storage/FailedStorage.php +++ b/lib/private/Files/Storage/FailedStorage.php @@ -25,6 +25,7 @@ namespace OC\Files\Storage; use OC\Files\Cache\FailedCache; +use OCP\Files\Storage\IStorage; use \OCP\Lock\ILockingProvider; use \OCP\Files\StorageNotAvailableException; @@ -183,11 +184,11 @@ class FailedStorage extends Common { return true; } - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e); } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 70cb2e0ccc4..c19427e5f9b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -37,6 +37,7 @@ namespace OC\Files\Storage; use OC\Files\Storage\Wrapper\Jail; use OCP\Files\ForbiddenException; +use OCP\Files\Storage\IStorage; /** * for local filestore, we only have to map the paths @@ -404,12 +405,12 @@ class Local extends \OC\Files\Storage\Common { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { if ($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')) { /** * @var \OC\Files\Storage\Local $sourceStorage @@ -422,12 +423,12 @@ class Local extends \OC\Files\Storage\Common { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage->instanceOfStorage(Local::class)) { if ($sourceStorage->instanceOfStorage(Jail::class)) { /** diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 2a44a3a17d5..1fd38b5d6b7 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -22,6 +22,8 @@ */ namespace OC\Files\Storage\Wrapper; +use OCP\Files\Storage\IStorage; + /** * Availability checker for storages * @@ -432,7 +434,7 @@ class Availability extends Wrapper { } /** {@inheritdoc} */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { $this->checkAvailability(); try { return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); @@ -443,7 +445,7 @@ class Availability extends Wrapper { } /** {@inheritdoc} */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { $this->checkAvailability(); try { return parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index 389da06f7b7..240a1f3e049 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -22,6 +22,7 @@ namespace OC\Files\Storage\Wrapper; +use OCP\Files\Storage\IStorage; use OCP\ICache; use OC\Cache\CappedMemoryCache; @@ -483,12 +484,12 @@ class Encoding extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $this->findPathToUse($targetInternalPath)); } @@ -501,12 +502,12 @@ class Encoding extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { $result = $this->rename($sourceInternalPath, $this->findPathToUse($targetInternalPath)); if ($result) { diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 793849914d7..e359e86319c 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -590,13 +590,13 @@ class Encryption extends Wrapper { } /** - * @param Storage $sourceStorage + * @param Storage\IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @param bool $preserveMtime * @return bool */ - public function moveFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) { + public function moveFromStorage(Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); } @@ -624,14 +624,14 @@ class Encryption extends Wrapper { /** - * @param Storage $sourceStorage + * @param Storage\IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @param bool $preserveMtime * @param bool $isRename * @return bool */ - public function copyFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false, $isRename = false) { + public function copyFromStorage(Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false, $isRename = false) { // TODO clean this up once the underlying moveFromStorage in OC\Files\Storage\Wrapper\Common is fixed: // - call $this->storage->copyFromStorage() instead of $this->copyBetweenStorage @@ -645,12 +645,12 @@ class Encryption extends Wrapper { /** * Update the encrypted cache version in the database * - * @param Storage $sourceStorage + * @param Storage\IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @param bool $isRename */ - private function updateEncryptedVersion(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename) { + private function updateEncryptedVersion(Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename) { $isEncrypted = $this->encryptionManager->isEnabled() && $this->shouldEncrypt($targetInternalPath) ? 1 : 0; $cacheInformation = [ 'encrypted' => (bool)$isEncrypted, @@ -682,7 +682,7 @@ class Encryption extends Wrapper { /** * copy file between two storages * - * @param Storage $sourceStorage + * @param Storage\IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @param bool $preserveMtime @@ -690,7 +690,7 @@ class Encryption extends Wrapper { * @return bool * @throws \Exception */ - private function copyBetweenStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename) { + private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename) { // for versions we have nothing to do, because versions should always use the // key from the original file. Just create a 1:1 copy and done diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index 4fa2428c968..d30563341cb 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -26,6 +26,7 @@ namespace OC\Files\Storage\Wrapper; use OC\Files\Cache\Wrapper\CacheJail; use OC\Files\Cache\Wrapper\JailPropagator; +use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; /** @@ -465,12 +466,12 @@ class Jail extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); } @@ -478,12 +479,12 @@ class Jail extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); } diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 7312ed61dcc..e89a8d08de7 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -27,6 +27,7 @@ namespace OC\Files\Storage\Wrapper; use OCP\Files\Cache\ICacheEntry; +use OCP\Files\Storage\IStorage; class Quota extends Wrapper { @@ -170,12 +171,12 @@ class Quota extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { $free = $this->free_space(''); if ($free < 0 or $this->getSize($sourceInternalPath, $sourceStorage) < $free) { return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); @@ -185,12 +186,12 @@ class Quota extends Wrapper { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { $free = $this->free_space(''); if ($free < 0 or $this->getSize($sourceInternalPath, $sourceStorage) < $free) { return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index d7cd4b729db..847a714f7dd 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -28,6 +28,7 @@ namespace OC\Files\Storage\Wrapper; use OCP\Files\InvalidPathException; use OCP\Files\Storage\ILockingStorage; +use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { @@ -542,12 +543,12 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->copy($sourceInternalPath, $targetInternalPath); } @@ -556,12 +557,12 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { } /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage === $this) { return $this->rename($sourceInternalPath, $targetInternalPath); } diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 69dce215694..32ab79adab3 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -29,6 +29,7 @@ namespace OC\Group; use OCP\IGroup; +use OCP\IUser; class Group implements IGroup { /** @var null|string */ @@ -119,10 +120,10 @@ class Group implements IGroup { /** * check if a user is in the group * - * @param \OC\User\User $user + * @param IUser $user * @return bool */ - public function inGroup($user) { + public function inGroup(IUser $user) { if (isset($this->users[$user->getUID()])) { return true; } @@ -138,9 +139,9 @@ class Group implements IGroup { /** * add a user to the group * - * @param \OC\User\User $user + * @param IUser $user */ - public function addUser($user) { + public function addUser(IUser $user) { if ($this->inGroup($user)) { return; } diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 61b47fdd448..6d4f5a091c6 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -246,10 +246,10 @@ class Manager extends PublicEmitter implements IGroupManager { } /** - * @param \OC\User\User|null $user + * @param IUser|null $user * @return \OC\Group\Group[] */ - public function getUserGroups($user) { + public function getUserGroups(IUser $user= null) { if (!$user instanceof IUser) { return []; } @@ -303,10 +303,10 @@ class Manager extends PublicEmitter implements IGroupManager { /** * get a list of group ids for a user - * @param \OC\User\User $user + * @param IUser $user * @return array with group ids */ - public function getUserGroupIds($user) { + public function getUserGroupIds(IUser $user) { return array_map(function($value) { return (string) $value; }, array_keys($this->getUserGroups($user))); diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php index fd2f14f9f28..75fcd7f5e44 100644 --- a/lib/private/L10N/L10NString.php +++ b/lib/private/L10N/L10NString.php @@ -73,7 +73,7 @@ class L10NString implements \JsonSerializable { } // Replace %n first (won't interfere with vsprintf) - $text = str_replace('%n', $this->count, $text); + $text = str_replace('%n', (string)$this->count, $text); return vsprintf($text, $this->parameters); } diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php index ea911b90064..831d8a8b2a0 100644 --- a/lib/private/Lockdown/Filesystem/NullStorage.php +++ b/lib/private/Lockdown/Filesystem/NullStorage.php @@ -22,6 +22,7 @@ namespace OC\Lockdown\Filesystem; use Icewind\Streams\IteratorDirectory; use OC\Files\FileInfo; use OC\Files\Storage\Common; +use OCP\Files\Storage\IStorage; class NullStorage extends Common { public function __construct($parameters) { @@ -156,11 +157,11 @@ class NullStorage extends Common { return false; } - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); } - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); } diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 8227e69ef06..a55e6f9e5b5 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -365,7 +365,7 @@ EOF; * Adds a heading to the email * * @param string $title - * @param string $plainTitle|bool Title that is used in the plain text email + * @param string|bool $plainTitle Title that is used in the plain text email * if empty the $title is used, if false none will be used */ public function addHeading($title, $plainTitle = '') { diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php index 495b868607c..cf4abbce15e 100644 --- a/lib/private/Migration/BackgroundRepair.php +++ b/lib/private/Migration/BackgroundRepair.php @@ -53,7 +53,7 @@ class BackgroundRepair extends TimedJob { * run the job, then remove it from the job list * * @param JobList $jobList - * @param ILogger $logger + * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { // add an interval of 15 mins diff --git a/lib/private/OCS/Exception.php b/lib/private/OCS/Exception.php index 58b13f52df9..485c5c4d40f 100644 --- a/lib/private/OCS/Exception.php +++ b/lib/private/OCS/Exception.php @@ -25,7 +25,11 @@ namespace OC\OCS; class Exception extends \Exception { + /** @var Result */ + private $result; + public function __construct(Result $result) { + parent::__construct(); $this->result = $result; } diff --git a/lib/private/Search/Result/File.php b/lib/private/Search/Result/File.php index eb4750d8de3..98ebef8753a 100644 --- a/lib/private/Search/Result/File.php +++ b/lib/private/Search/Result/File.php @@ -91,7 +91,7 @@ class File extends \OCP\Search\Result { $this->path = $path; $this->size = $data->getSize(); $this->modified = $data->getMtime(); - $this->mime = $data->getMimetype(); + $this->mime_type = $data->getMimetype(); } /** diff --git a/lib/private/Security/CSRF/CsrfToken.php b/lib/private/Security/CSRF/CsrfToken.php index e9bdf5b5204..09195fcc3b7 100644 --- a/lib/private/Security/CSRF/CsrfToken.php +++ b/lib/private/Security/CSRF/CsrfToken.php @@ -62,7 +62,7 @@ class CsrfToken { * The unencrypted value of the token. Used for decrypting an already * encrypted token. * - * @return int + * @return string */ public function getDecryptedValue() { $token = explode(':', $this->value); diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php index 58c44b88ba6..ea7b045c205 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -209,7 +209,7 @@ class CertificateManager implements ICertificateManager { /** * Get the path to the certificate bundle for this user * - * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle + * @param string|null $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle * @return string */ public function getCertificateBundle($uid = '') { @@ -241,7 +241,7 @@ class CertificateManager implements ICertificateManager { } /** - * @param string $uid (optional) user to get the certificate path for, use `null` to get the system path + * @param string|null $uid (optional) user to get the certificate path for, use `null` to get the system path * @return string */ private function getPathToCertificates($uid = '') { diff --git a/lib/private/Server.php b/lib/private/Server.php index 5efbcfecf32..1f1570f3f46 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1249,7 +1249,6 @@ class Server extends ServerContainer implements IServerContainer { } /** - * @internal For internal use only * @return \OC\SystemConfig */ public function getSystemConfig() { diff --git a/lib/private/Session/CryptoWrapper.php b/lib/private/Session/CryptoWrapper.php index 67a673cb309..1cec2670650 100644 --- a/lib/private/Session/CryptoWrapper.php +++ b/lib/private/Session/CryptoWrapper.php @@ -50,14 +50,16 @@ use OCP\Security\ISecureRandom; class CryptoWrapper { const COOKIE_NAME = 'oc_sessionPassphrase'; + /** @var IConfig */ + protected $config; /** @var ISession */ protected $session; - - /** @var \OCP\Security\ICrypto */ + /** @var ICrypto */ protected $crypto; - /** @var ISecureRandom */ protected $random; + /** @var string */ + protected $passphrase; /** * @param IConfig $config diff --git a/lib/private/Settings/RemoveOrphaned.php b/lib/private/Settings/RemoveOrphaned.php index fbee95c8879..29c7cf212b5 100644 --- a/lib/private/Settings/RemoveOrphaned.php +++ b/lib/private/Settings/RemoveOrphaned.php @@ -58,7 +58,7 @@ class RemoveOrphaned extends TimedJob { * run the job, then remove it from the job list * * @param JobList $jobList - * @param ILogger $logger + * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { // add an interval of 15 mins diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 1e98ed5456d..521a8f75f8e 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -223,7 +223,7 @@ class Setup { 'error' => $this->l10n->t( 'Mac OS X is not supported and %s will not work properly on this platform. ' . 'Use it at your own risk! ', - $this->defaults->getName() + [$this->defaults->getName()] ), 'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.') ); @@ -234,7 +234,7 @@ class Setup { 'error' => $this->l10n->t( 'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' . 'This will lead to problems with files over 4 GB and is highly discouraged.', - $this->defaults->getName() + [$this->defaults->getName()] ), 'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.') ); diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 3ec1af00e3f..b63435ff838 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -274,7 +274,7 @@ class Tags implements \OCP\ITags { if($tagId === false) { $l10n = \OC::$server->getL10N('core'); throw new \Exception( - $l10n->t('Could not find category "%s"', $tag) + $l10n->t('Could not find category "%s"', [$tag]) ); } diff --git a/lib/private/legacy/db.php b/lib/private/legacy/db.php index 9e4d619d953..843970d7d53 100644 --- a/lib/private/legacy/db.php +++ b/lib/private/legacy/db.php @@ -45,9 +45,9 @@ class OC_DB { /** * Prepare a SQL query * @param string $query Query string - * @param int $limit - * @param int $offset - * @param bool $isManipulation + * @param int|null $limit + * @param int|null $offset + * @param bool|null $isManipulation * @throws \OC\DatabaseException * @return OC_DB_StatementWrapper prepared SQL query * @@ -104,7 +104,7 @@ class OC_DB { * @param mixed $stmt OC_DB_StatementWrapper, * an array with 'sql' and optionally 'limit' and 'offset' keys * .. or a simple sql query string - * @param array $parameters + * @param array|null $parameters * @return OC_DB_StatementWrapper * @throws \OC\DatabaseException */ @@ -151,7 +151,6 @@ class OC_DB { /** * saves database schema to xml file * @param string $file name of file - * @param int $mode * @return bool * * TODO: write more documentation @@ -179,6 +178,7 @@ class OC_DB { * @param string $file file to read structure from * @throws Exception * @return string|boolean + * @suppress PhanDeprecatedFunction */ public static function updateDbFromStructure($file) { $schemaManager = self::getMDB2SchemaManager(); diff --git a/lib/private/legacy/db/statementwrapper.php b/lib/private/legacy/db/statementwrapper.php index 53f7b484d04..cac4598e650 100644 --- a/lib/private/legacy/db/statementwrapper.php +++ b/lib/private/legacy/db/statementwrapper.php @@ -62,7 +62,7 @@ class OC_DB_StatementWrapper { * make execute return the result instead of a bool * * @param array $input - * @return \OC_DB_StatementWrapper|int + * @return \OC_DB_StatementWrapper|int|bool */ public function execute($input= []) { $this->lastArguments = $input; diff --git a/lib/private/legacy/eventsource.php b/lib/private/legacy/eventsource.php index 6211d851426..74beb157e18 100644 --- a/lib/private/legacy/eventsource.php +++ b/lib/private/legacy/eventsource.php @@ -97,6 +97,7 @@ class OC_EventSource implements \OCP\IEventSource { * * @throws \BadMethodCallException * if only one parameter is given, a typeless message will be send with that parameter as data + * @suppress PhanDeprecatedFunction */ public function send($type, $data = null) { if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) { diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index 6775fe99dcd..48b7d037c58 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -131,7 +131,7 @@ class OC_Helper { /** * Make a computer file size * @param string $str file size in human readable format - * @return float a file size in bytes + * @return float|bool a file size in bytes * * Makes 2kB to 2048. * @@ -395,7 +395,7 @@ class OC_Helper { * performs a search in a nested array * @param array $haystack the array to be searched * @param string $needle the search string - * @param string $index optional, only search this key name + * @param mixed $index optional, only search this key name * @return mixed the key of the matching field, otherwise false * * performs a search in a nested array diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php index 9b90daccac9..180dd7c448d 100644 --- a/lib/private/legacy/json.php +++ b/lib/private/legacy/json.php @@ -52,6 +52,7 @@ class OC_JSON{ * Check if the app is enabled, send json error msg if not * @param string $app * @deprecated Use the AppFramework instead. It will automatically check if the app is enabled. + * @suppress PhanDeprecatedFunction */ public static function checkAppEnabled($app) { if( !OC_App::isEnabled($app)) { @@ -64,6 +65,7 @@ class OC_JSON{ /** * Check if the user is logged in, send json error msg if not * @deprecated Use annotation based ACLs from the AppFramework instead + * @suppress PhanDeprecatedFunction */ public static function checkLoggedIn() { $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); @@ -79,6 +81,7 @@ class OC_JSON{ /** * Check an ajax get/post call if the request token is valid, send json error msg if not. * @deprecated Use annotation based CSRF checks from the AppFramework instead + * @suppress PhanDeprecatedFunction */ public static function callCheck() { if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { @@ -96,6 +99,7 @@ class OC_JSON{ /** * Check if the user is a admin, send json error msg if not. * @deprecated Use annotation based ACLs from the AppFramework instead + * @suppress PhanDeprecatedFunction */ public static function checkAdminUser() { if( !OC_User::isAdminUser(OC_User::getUser())) { @@ -109,6 +113,7 @@ class OC_JSON{ * Check is a given user exists - send json error msg if not * @param string $user * @deprecated Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function checkUserExists($user) { if (!OCP\User::userExists($user)) { @@ -122,6 +127,7 @@ class OC_JSON{ /** * Check if the user is a subadmin, send json error msg if not * @deprecated Use annotation based ACLs from the AppFramework instead + * @suppress PhanDeprecatedFunction */ public static function checkSubAdminUser() { $userObject = \OC::$server->getUserSession()->getUser(); @@ -140,6 +146,7 @@ class OC_JSON{ /** * Send json error msg * @deprecated Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function error($data = array()) { $data['status'] = 'error'; @@ -149,6 +156,7 @@ class OC_JSON{ /** * Send json success msg * @deprecated Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function success($data = array()) { $data['status'] = 'success'; @@ -167,6 +175,7 @@ class OC_JSON{ /** * Encode and print $data in json format * @deprecated Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function encodedPrint($data, $setContentType=true) { if($setContentType) { diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php index fa73f3d6d0d..e45fe616e49 100644 --- a/lib/private/legacy/response.php +++ b/lib/private/legacy/response.php @@ -116,11 +116,11 @@ class OC_Response { } /** - * Set response expire time - * @param string|DateTime $expires date-time when the response expires - * string for DateInterval from now - * DateTime object when to expire response - */ + * Set response expire time + * @param string|DateTime|int $expires date-time when the response expires + * string for DateInterval from now + * DateTime object when to expire response + */ static public function setExpiresHeader($expires) { if (is_string($expires) && $expires[0] == 'P') { $interval = $expires; diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index f5ee2336831..8c6185cd556 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -291,10 +291,11 @@ class OC_Template extends \OC\Template\Base { } /** - * Print a fatal error page and terminates the script - * @param string $error_msg The error message to show - * @param string $hint An optional hint message - needs to be properly escaped - */ + * Print a fatal error page and terminates the script + * @param string $error_msg The error message to show + * @param string $hint An optional hint message - needs to be properly escape + * @suppress PhanAccessMethodInternal + */ public static function printErrorPage( $error_msg, $hint = '' ) { if (\OC_App::isEnabled('theming') && !\OC_App::isAppLoaded('theming')) { \OC_App::loadApp('theming'); @@ -325,7 +326,10 @@ class OC_Template extends \OC\Template\Base { /** * print error page using Exception details - * @param Exception | Throwable $exception + * @param Exception|Throwable $exception + * @param bool $fetchPage + * @return bool|string + * @suppress PhanAccessMethodInternal */ public static function printExceptionErrorPage($exception, $fetchPage = false) { try { diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 65179a94108..bca16b48c1a 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -57,7 +57,7 @@ function emit_css_tag($href, $opts = '') { /** * Prints all tags for CSS loading - * @param hash $obj all the script information from template + * @param array $obj all the script information from template */ function emit_css_loading_tags($obj) { foreach($obj['cssfiles'] as $css) { @@ -72,7 +72,6 @@ function emit_css_loading_tags($obj) { * Prints a <script> tag with nonce and defer depending on config * @param string $src the source URL, ignored when empty * @param string $script_content the inline script content, ignored when empty - * @param bool $defer_flag deferred loading or not */ function emit_script_tag($src, $script_content='') { $defer_str=' defer'; @@ -93,7 +92,7 @@ function emit_script_tag($src, $script_content='') { /** * Print all <script> tags for loading JS - * @param hash $obj all the script information from template + * @param array $obj all the script information from template */ function emit_script_loading_tags($obj) { foreach($obj['jsfiles'] as $jsfile) { @@ -250,7 +249,7 @@ function mimetype_icon( $mimetype ) { * make preview_icon available as a simple function * Returns the path to the preview of the image. * @param string $path path of file - * @return link to the preview + * @return string link to the preview */ function preview_icon( $path ) { return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); @@ -258,6 +257,8 @@ function preview_icon( $path ) { /** * @param string $path + * @param string $token + * @return string */ function publicPreview_icon ( $path, $token ) { return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); @@ -289,8 +290,8 @@ function strip_time($timestamp){ * Formats timestamp relatively to the current time using * a human-friendly format like "x minutes ago" or "yesterday" * @param int $timestamp timestamp to format - * @param int $fromTime timestamp to compare from, defaults to current time - * @param bool $dateOnly whether to strip time information + * @param int|null $fromTime timestamp to compare from, defaults to current time + * @param bool|null $dateOnly whether to strip time information * @return string timestamp */ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index feed6f836ca..fee913f956c 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -78,6 +78,7 @@ class OC_User { * @return bool * * Set the User Authentication Module + * @suppress PhanDeprecatedFunction */ public static function useBackend($backend = 'database') { if ($backend instanceof \OCP\UserInterface) { @@ -123,6 +124,7 @@ class OC_User { /** * setup the configured backends in config.php + * @suppress PhanDeprecatedFunction */ public static function setupBackends() { OC_App::loadApps(['prelogin']); @@ -347,7 +349,7 @@ class OC_User { * get the display name of the user currently logged in. * * @param string $uid - * @return string uid or false + * @return string|bool uid or false */ public static function getDisplayName($uid = null) { if ($uid) { diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 8fc880667e4..f0fef027ec2 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -91,6 +91,7 @@ class OC_Util { * TODO make home storage aware of this and use the object storage instead of local disk access * * @param array $config containing 'class' and optional 'arguments' + * @suppress PhanDeprecatedFunction */ private static function initObjectStoreRootFS($config) { // check misconfiguration @@ -124,6 +125,7 @@ class OC_Util { * necessity of a data folder being present. * * @param array $config containing 'class' and optional 'arguments' + * @suppress PhanDeprecatedFunction */ private static function initObjectStoreMultibucketRootFS($config) { // check misconfiguration @@ -165,6 +167,8 @@ class OC_Util { * @param string $user * @return boolean * @description configure the initial filesystem based on the configuration + * @suppress PhanDeprecatedFunction + * @suppress PhanAccessMethodInternal */ public static function setupFS($user = '') { //setting up the filesystem twice can only lead to trouble @@ -202,7 +206,7 @@ class OC_Util { return $storage; }); - \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { + \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { if (!$mount->getOption('enable_sharing', true)) { return new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $storage, @@ -213,7 +217,7 @@ class OC_Util { }); // install storage availability wrapper, before most other wrappers - \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) { + \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) { if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]); } @@ -289,6 +293,7 @@ class OC_Util { * check if a password is required for each public link * * @return boolean + * @suppress PhanDeprecatedFunction */ public static function isPublicLinkPasswordRequired() { $appConfig = \OC::$server->getAppConfig(); @@ -329,6 +334,7 @@ class OC_Util { * check if share API enforces a default expire date * * @return boolean + * @suppress PhanDeprecatedFunction */ public static function isDefaultExpireDateEnforced() { $isDefaultExpireDateEnabled = \OCP\Config::getAppValue('core', 'shareapi_default_expire_date', 'no'); @@ -345,7 +351,7 @@ class OC_Util { * Get the quota of a user * * @param string $userId - * @return int Quota bytes + * @return float Quota bytes */ public static function getUserQuota($userId) { $user = \OC::$server->getUserManager()->get($userId); @@ -365,6 +371,7 @@ class OC_Util { * @param String $userId * @param \OCP\Files\Folder $userDirectory * @throws \RuntimeException + * @suppress PhanDeprecatedFunction */ public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) { @@ -431,6 +438,7 @@ class OC_Util { /** * @return void + * @suppress PhanUndeclaredMethod */ public static function tearDownFS() { \OC\Files\Filesystem::tearDown(); @@ -487,6 +495,7 @@ class OC_Util { /** * @description load the version.php into the session as cache + * @suppress PhanUndeclaredVariable */ private static function loadVersion() { if (self::$versionCache !== null) { @@ -563,8 +572,8 @@ class OC_Util { * add a translation JS file * * @param string $application application id - * @param string $languageCode language code, defaults to the current language - * @param bool $prepend prepend the Script to the beginning of the list + * @param string|null $languageCode language code, defaults to the current language + * @param bool|null $prepend prepend the Script to the beginning of the list */ public static function addTranslations($application, $languageCode = null, $prepend = false) { if (is_null($languageCode)) { @@ -1068,6 +1077,7 @@ class OC_Util { * the apps visible for the current user * * @return string URL + * @suppress PhanDeprecatedFunction */ public static function getDefaultPageUrl() { $urlGenerator = \OC::$server->getURLGenerator(); @@ -1347,6 +1357,8 @@ class OC_Util { * in case the opcode cache does not re-validate files * * @return void + * @suppress PhanDeprecatedFunction + * @suppress PhanUndeclaredConstant */ public static function clearOpcodeCache() { // APC diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php index b25ea55aee6..c983114fe75 100644 --- a/lib/public/App/ManagerEvent.php +++ b/lib/public/App/ManagerEvent.php @@ -45,7 +45,7 @@ class ManagerEvent extends Event { protected $event; /** @var string */ protected $appID; - /** @var \OCP\IGroup[] */ + /** @var \OCP\IGroup[]|null */ protected $groups; /** @@ -53,7 +53,7 @@ class ManagerEvent extends Event { * * @param string $event * @param $appID - * @param \OCP\IGroup[] $groups + * @param \OCP\IGroup[]|null $groups * @since 9.0.0 */ public function __construct($event, $appID, array $groups = null) { diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index 857cb19101a..243ab1846ba 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -88,7 +88,7 @@ abstract class ApiController extends Controller { $response = new Response(); $response->addHeader('Access-Control-Allow-Origin', $origin); $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); - $response->addHeader('Access-Control-Max-Age', $this->corsMaxAge); + $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); $response->addHeader('Access-Control-Allow-Credentials', 'false'); return $response; diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php index 313f1e490a1..e5cd832563d 100644 --- a/lib/public/AppFramework/App.php +++ b/lib/public/AppFramework/App.php @@ -95,6 +95,7 @@ class App { * @param \OCP\Route\IRouter $router * @param array $routes * @since 6.0.0 + * @suppress PhanAccessMethodInternal */ public function registerRoutes($router, $routes) { $routeConfig = new RouteConfig($this->container, $router, $routes); diff --git a/lib/public/AppFramework/Http/OCSResponse.php b/lib/public/AppFramework/Http/OCSResponse.php index cfda8ea4f75..8614e76805f 100644 --- a/lib/public/AppFramework/Http/OCSResponse.php +++ b/lib/public/AppFramework/Http/OCSResponse.php @@ -80,6 +80,7 @@ class OCSResponse extends Response { * @return string * @since 8.1.0 * @deprecated 9.2.0 To implement an OCS endpoint extend the OCSController + * @suppress PhanDeprecatedClass */ public function render() { $r = new \OC_OCS_Result($this->data, $this->statuscode, $this->message); diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 087522386be..c3b81d2baf7 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -228,7 +228,7 @@ class Response { /** * By default renders no output - * @return null + * @return string|null * @since 6.0.0 */ public function render() { diff --git a/lib/public/BackgroundJob/IJob.php b/lib/public/BackgroundJob/IJob.php index 05927989b64..0b14257075a 100644 --- a/lib/public/BackgroundJob/IJob.php +++ b/lib/public/BackgroundJob/IJob.php @@ -36,7 +36,7 @@ interface IJob { * Run the background job with the registered argument * * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job - * @param ILogger $logger + * @param ILogger|null $logger * @since 7.0.0 */ public function execute($jobList, ILogger $logger = null); diff --git a/lib/public/Comments/ICommentsManager.php b/lib/public/Comments/ICommentsManager.php index f088ad9f70d..61633af95cd 100644 --- a/lib/public/Comments/ICommentsManager.php +++ b/lib/public/Comments/ICommentsManager.php @@ -104,7 +104,7 @@ interface ICommentsManager { * @param int $limit optional, number of maximum comments to be returned. if * not specified, all comments are returned. * @param int $offset optional, starting point - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments + * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments * that may be returned * @return IComment[] * @since 9.0.0 @@ -120,7 +120,7 @@ interface ICommentsManager { /** * @param $objectType string the object type, e.g. 'files' * @param $objectId string the id of the object - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments + * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments * that may be returned * @return Int * @since 9.0.0 diff --git a/lib/public/DB.php b/lib/public/DB.php index 5018392f650..645f77076db 100644 --- a/lib/public/DB.php +++ b/lib/public/DB.php @@ -90,7 +90,7 @@ class DB { * @since 4.5.0 */ public static function insertid($table=null) { - return \OC::$server->getDatabaseConnection()->lastInsertId($table); + return (string)\OC::$server->getDatabaseConnection()->lastInsertId($table); } /** diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php index a176bb917a3..59ec4fd3ba5 100644 --- a/lib/public/DB/QueryBuilder/IQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php @@ -176,7 +176,7 @@ interface IQueryBuilder { * * @param string|integer $key The parameter position or name. * @param mixed $value The parameter value. - * @param string|null $type One of the IQueryBuilder::PARAM_* constants. + * @param string|null|int $type One of the IQueryBuilder::PARAM_* constants. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. * @since 8.2.0 diff --git a/lib/public/Diagnostics/IQueryLogger.php b/lib/public/Diagnostics/IQueryLogger.php index 32723a56cb9..4e45fa33d9d 100644 --- a/lib/public/Diagnostics/IQueryLogger.php +++ b/lib/public/Diagnostics/IQueryLogger.php @@ -39,8 +39,8 @@ interface IQueryLogger extends SQLLogger { * query is finished finalized with stopQuery() method. * * @param string $sql - * @param array $params - * @param array $types + * @param array|null $params + * @param array|null $types * @since 8.0.0 */ public function startQuery($sql, array $params = null, array $types = null); diff --git a/lib/public/Encryption/Exceptions/GenericEncryptionException.php b/lib/public/Encryption/Exceptions/GenericEncryptionException.php index ac880c43067..7515d9c368d 100644 --- a/lib/public/Encryption/Exceptions/GenericEncryptionException.php +++ b/lib/public/Encryption/Exceptions/GenericEncryptionException.php @@ -39,7 +39,7 @@ class GenericEncryptionException extends HintException { * @param string $message * @param string $hint * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 8.1.0 */ public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { diff --git a/lib/public/Files/ForbiddenException.php b/lib/public/Files/ForbiddenException.php index 5492b8538b4..7a7c011691b 100644 --- a/lib/public/Files/ForbiddenException.php +++ b/lib/public/Files/ForbiddenException.php @@ -38,7 +38,7 @@ class ForbiddenException extends \Exception { /** * @param string $message * @param bool $retry - * @param \Exception $previous previous exception for cascading + * @param \Exception|null $previous previous exception for cascading * @since 9.0.0 */ public function __construct($message, $retry, \Exception $previous = null) { diff --git a/lib/public/Files/IAppData.php b/lib/public/Files/IAppData.php index bf612996c53..fd0d0649810 100644 --- a/lib/public/Files/IAppData.php +++ b/lib/public/Files/IAppData.php @@ -29,7 +29,6 @@ use OCP\Files\SimpleFS\ISimpleRoot; * * @package OCP\Files * @since 11.0.0 - * @internal This interface is experimental and might change for NC12 */ interface IAppData extends ISimpleRoot { diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php index 660580ae464..e9182377cb5 100644 --- a/lib/public/Files/SimpleFS/ISimpleFile.php +++ b/lib/public/Files/SimpleFS/ISimpleFile.php @@ -29,7 +29,6 @@ use OCP\Files\NotPermittedException; * * @package OCP\Files\SimpleFS * @since 11.0.0 - * @internal This interface is experimental and might change for NC12 */ interface ISimpleFile { diff --git a/lib/public/Files/SimpleFS/ISimpleFolder.php b/lib/public/Files/SimpleFS/ISimpleFolder.php index 66f80816216..54fbd466e46 100644 --- a/lib/public/Files/SimpleFS/ISimpleFolder.php +++ b/lib/public/Files/SimpleFS/ISimpleFolder.php @@ -30,7 +30,6 @@ use OCP\Files\NotPermittedException; * * @package OCP\Files\SimpleFS * @since 11.0.0 - * @internal This interface is experimental and might change for NC12 */ interface ISimpleFolder { /** diff --git a/lib/public/Files/SimpleFS/ISimpleRoot.php b/lib/public/Files/SimpleFS/ISimpleRoot.php index 3bfea656965..35b97f665a7 100644 --- a/lib/public/Files/SimpleFS/ISimpleRoot.php +++ b/lib/public/Files/SimpleFS/ISimpleRoot.php @@ -30,7 +30,6 @@ use OCP\Files\NotPermittedException; * * @package OCP\Files\SimpleFS * @since 11.0.0 - * @internal This interface is experimental and might change for NC12 */ interface ISimpleRoot { /** diff --git a/lib/public/Files/Storage.php b/lib/public/Files/Storage.php index 213bbc0e549..ee89b9fd205 100644 --- a/lib/public/Files/Storage.php +++ b/lib/public/Files/Storage.php @@ -395,22 +395,22 @@ interface Storage extends IStorage { public function verifyPath($path, $fileName); /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool * @since 8.1.0 */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); /** - * @param \OCP\Files\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool * @since 8.1.0 */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); /** * @param string $path The path of the file to acquire the lock for diff --git a/lib/public/Files/Storage/IStorage.php b/lib/public/Files/Storage/IStorage.php index 27b8f1d0697..d5176aab463 100644 --- a/lib/public/Files/Storage/IStorage.php +++ b/lib/public/Files/Storage/IStorage.php @@ -383,22 +383,22 @@ interface IStorage { public function verifyPath($path, $fileName); /** - * @param \OCP\Files\Storage|\OCP\Files\Storage\IStorage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool * @since 9.0.0 */ - public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); /** - * @param \OCP\Files\Storage|\OCP\Files\Storage\IStorage $sourceStorage + * @param IStorage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool * @since 9.0.0 */ - public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); /** * Test a storage for availability diff --git a/lib/public/Files/StorageAuthException.php b/lib/public/Files/StorageAuthException.php index f73915df9d9..8a04a2c70f4 100644 --- a/lib/public/Files/StorageAuthException.php +++ b/lib/public/Files/StorageAuthException.php @@ -31,12 +31,11 @@ class StorageAuthException extends StorageNotAvailableException { * StorageAuthException constructor. * * @param string $message - * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 9.0.0 */ public function __construct($message = '', \Exception $previous = null) { $l = \OC::$server->getL10N('core'); - parent::__construct($l->t('Storage unauthorized. %s', $message), self::STATUS_UNAUTHORIZED, $previous); + parent::__construct($l->t('Storage unauthorized. %s', [$message]), self::STATUS_UNAUTHORIZED, $previous); } } diff --git a/lib/public/Files/StorageBadConfigException.php b/lib/public/Files/StorageBadConfigException.php index a3a96a80dc1..d6ee6a267e7 100644 --- a/lib/public/Files/StorageBadConfigException.php +++ b/lib/public/Files/StorageBadConfigException.php @@ -31,13 +31,12 @@ class StorageBadConfigException extends StorageNotAvailableException { * ExtStorageBadConfigException constructor. * * @param string $message - * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 9.0.0 */ public function __construct($message = '', \Exception $previous = null) { $l = \OC::$server->getL10N('core'); - parent::__construct($l->t('Storage incomplete configuration. %s', $message), self::STATUS_INCOMPLETE_CONF, $previous); + parent::__construct($l->t('Storage incomplete configuration. %s', [$message]), self::STATUS_INCOMPLETE_CONF, $previous); } } diff --git a/lib/public/Files/StorageConnectionException.php b/lib/public/Files/StorageConnectionException.php index 7a5381aef73..f12c84653b7 100644 --- a/lib/public/Files/StorageConnectionException.php +++ b/lib/public/Files/StorageConnectionException.php @@ -31,12 +31,11 @@ class StorageConnectionException extends StorageNotAvailableException { * StorageConnectionException constructor. * * @param string $message - * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 9.0.0 */ public function __construct($message = '', \Exception $previous = null) { $l = \OC::$server->getL10N('core'); - parent::__construct($l->t('Storage connection error. %s', $message), self::STATUS_NETWORK_ERROR, $previous); + parent::__construct($l->t('Storage connection error. %s', [$message]), self::STATUS_NETWORK_ERROR, $previous); } } diff --git a/lib/public/Files/StorageNotAvailableException.php b/lib/public/Files/StorageNotAvailableException.php index b6a5a70718a..b3f6e1a6b76 100644 --- a/lib/public/Files/StorageNotAvailableException.php +++ b/lib/public/Files/StorageNotAvailableException.php @@ -53,7 +53,7 @@ class StorageNotAvailableException extends HintException { * * @param string $message * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 6.0.0 */ public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) { diff --git a/lib/public/Files/StorageTimeoutException.php b/lib/public/Files/StorageTimeoutException.php index 16675710dff..b5566ada9b5 100644 --- a/lib/public/Files/StorageTimeoutException.php +++ b/lib/public/Files/StorageTimeoutException.php @@ -31,12 +31,11 @@ class StorageTimeoutException extends StorageNotAvailableException { * StorageTimeoutException constructor. * * @param string $message - * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 9.0.0 */ public function __construct($message = '', \Exception $previous = null) { $l = \OC::$server->getL10N('core'); - parent::__construct($l->t('Storage connection timeout. %s', $message), self::STATUS_TIMEOUT, $previous); + parent::__construct($l->t('Storage connection timeout. %s', [$message]), self::STATUS_TIMEOUT, $previous); } } diff --git a/lib/public/IDateTimeFormatter.php b/lib/public/IDateTimeFormatter.php index 20b01467e29..a97eca2860e 100644 --- a/lib/public/IDateTimeFormatter.php +++ b/lib/public/IDateTimeFormatter.php @@ -40,8 +40,8 @@ interface IDateTimeFormatter { * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' * short: e.g. 'M/d/yy' => '8/20/14' * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted date string * @since 8.0.0 */ @@ -58,8 +58,8 @@ interface IDateTimeFormatter { * short: e.g. 'M/d/yy' => '8/20/14' * The exact format is dependent on the language * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted relative date string * @since 8.0.0 */ @@ -70,13 +70,12 @@ interface IDateTimeFormatter { * Only works for past dates * * @param int|\DateTime $timestamp - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N|null $l The locale to use * @return string Dates returned are: * < 1 month => Today, Yesterday, n days ago * < 13 month => last month, n months ago * >= 13 month => last year, n years ago - * @param \OCP\IL10N $l The locale to use - * @return string Formatted date span * @since 8.0.0 */ public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); @@ -91,8 +90,8 @@ interface IDateTimeFormatter { * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' * short: e.g. 'h:mm a' => '11:42 AM' * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted time string * @since 8.0.0 */ @@ -102,7 +101,8 @@ interface IDateTimeFormatter { * Gives the relative past time of the timestamp * * @param int|\DateTime $timestamp - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N|null $l The locale to use * @return string Dates returned are: * < 60 sec => seconds ago * < 1 hour => n minutes ago @@ -110,8 +110,6 @@ interface IDateTimeFormatter { * < 1 month => Yesterday, n days ago * < 13 month => last month, n months ago * >= 13 month => last year, n years ago - * @param \OCP\IL10N $l The locale to use - * @return string Formatted time span * @since 8.0.0 */ public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); @@ -122,8 +120,8 @@ interface IDateTimeFormatter { * @param int|\DateTime $timestamp * @param string $formatDate See formatDate() for description * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted date and time string * @since 8.0.0 */ @@ -136,8 +134,8 @@ interface IDateTimeFormatter { * @param string $formatDate See formatDate() for description * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted relative date and time string * @since 8.0.0 */ diff --git a/lib/public/IGroup.php b/lib/public/IGroup.php index aa51e51046c..788287b4f86 100644 --- a/lib/public/IGroup.php +++ b/lib/public/IGroup.php @@ -60,7 +60,7 @@ interface IGroup { * @return bool * @since 8.0.0 */ - public function inGroup($user); + public function inGroup(IUser $user); /** * add a user to the group @@ -68,7 +68,7 @@ interface IGroup { * @param \OCP\IUser $user * @since 8.0.0 */ - public function addUser($user); + public function addUser(IUser $user); /** * remove a user from the group diff --git a/lib/public/IGroupManager.php b/lib/public/IGroupManager.php index 4d76fa76fb3..be322b64325 100644 --- a/lib/public/IGroupManager.php +++ b/lib/public/IGroupManager.php @@ -100,14 +100,14 @@ interface IGroupManager { * @return \OCP\IGroup[] * @since 8.0.0 */ - public function getUserGroups($user); + public function getUserGroups(IUser $user = null); /** * @param \OCP\IUser $user * @return array with group names * @since 8.0.0 */ - public function getUserGroupIds($user); + public function getUserGroupIds(IUser $user); /** * get a list of all display names in a group diff --git a/lib/public/ILogger.php b/lib/public/ILogger.php index 2d1bf4b804d..28cc3b1433f 100644 --- a/lib/public/ILogger.php +++ b/lib/public/ILogger.php @@ -136,7 +136,7 @@ interface ILogger { * ]); * </code> * - * @param \Exception | \Throwable $exception + * @param \Exception|\Throwable $exception * @param array $context * @return void * @since 8.2.0 diff --git a/lib/public/JSON.php b/lib/public/JSON.php index 7db61ff1571..b289c2038a1 100644 --- a/lib/public/JSON.php +++ b/lib/public/JSON.php @@ -45,6 +45,8 @@ class JSON { * @param array $data The data to use * @param bool $setContentType the optional content type * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * + * @suppress PhanDeprecatedFunction */ public static function encodedPrint( $data, $setContentType=true ) { \OC_JSON::encodedPrint($data, $setContentType); @@ -63,6 +65,8 @@ class JSON { * Add this call to the start of all ajax method files that requires * an authenticated user. * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead + * + * @suppress PhanDeprecatedFunction */ public static function checkLoggedIn() { \OC_JSON::checkLoggedIn(); @@ -86,6 +90,8 @@ class JSON { * parameter to the ajax call, then assign it to the template and finally * add a hidden input field also named 'requesttoken' containing the value. * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead + * + * @suppress PhanDeprecatedFunction */ public static function callCheck() { \OC_JSON::callCheck(); @@ -98,8 +104,8 @@ class JSON { * @see \OCP\JSON::error() for the format to use. * * @param array $data The data to use - * @return string json formatted string. * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function success( $data = array() ) { \OC_JSON::success($data); @@ -121,17 +127,18 @@ class JSON { * {"status":"error","data":{"message":"An error happened", "id":[some value]}} * * @param array $data The data to use - * @return string json formatted error string. * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function error( $data = array() ) { - \OC_JSON::error( $data ); + \OC_JSON::error($data); } /** * Set Content-Type header to jsonrequest * @param string $type The content type header * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function setContentTypeHeader( $type='application/json' ) { \OC_JSON::setContentTypeHeader($type); @@ -152,6 +159,7 @@ class JSON { * * @param string $app The app to check * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. + * @suppress PhanDeprecatedFunction */ public static function checkAppEnabled( $app ) { \OC_JSON::checkAppEnabled($app); @@ -171,6 +179,7 @@ class JSON { * administrative rights. * * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead + * @suppress PhanDeprecatedFunction */ public static function checkAdminUser() { \OC_JSON::checkAdminUser(); @@ -181,6 +190,7 @@ class JSON { * @param array $data * @return string * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function encode($data) { return \OC_JSON::encode($data); @@ -190,6 +200,7 @@ class JSON { * Check is a given user exists - send json error msg if not * @param string $user * @deprecated 8.1.0 Use a AppFramework JSONResponse instead + * @suppress PhanDeprecatedFunction */ public static function checkUserExists($user) { \OC_JSON::checkUserExists($user); diff --git a/lib/public/Lock/LockedException.php b/lib/public/Lock/LockedException.php index 87ae4511ac9..c371c6c56b0 100644 --- a/lib/public/Lock/LockedException.php +++ b/lib/public/Lock/LockedException.php @@ -43,7 +43,7 @@ class LockedException extends \Exception { * LockedException constructor. * * @param string $path locked path - * @param \Exception $previous previous exception for cascading + * @param \Exception|null $previous previous exception for cascading * * @since 8.1.0 */ diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php index 6df83b4d10e..6d0591b019b 100644 --- a/lib/public/Mail/IEMailTemplate.php +++ b/lib/public/Mail/IEMailTemplate.php @@ -62,7 +62,7 @@ interface IEMailTemplate { * Adds a heading to the email * * @param string $title - * @param string $plainTitle|bool Title that is used in the plain text email + * @param string|bool $plainTitle Title that is used in the plain text email * if empty the $title is used, if false none will be used * * @since 12.0.0 diff --git a/lib/public/Response.php b/lib/public/Response.php index b68da644352..dd029e12dbf 100644 --- a/lib/public/Response.php +++ b/lib/public/Response.php @@ -109,6 +109,7 @@ class Response { * @param string $filepath of file to send * @since 4.0.0 * @deprecated 8.1.0 - Use \OCP\AppFramework\Http\StreamResponse or another AppFramework controller instead + * @suppress PhanDeprecatedFunction */ static public function sendFile( $filepath ) { \OC_Response::sendFile( $filepath ); diff --git a/lib/public/Search/PagedProvider.php b/lib/public/Search/PagedProvider.php index 3bd5b75cc2d..b1294fa6dc4 100644 --- a/lib/public/Search/PagedProvider.php +++ b/lib/public/Search/PagedProvider.php @@ -53,7 +53,7 @@ abstract class PagedProvider extends Provider { */ public function search($query) { // old apps might assume they get all results, so we use SIZE_ALL - $this->searchPaged($query, 1, self::SIZE_ALL); + return $this->searchPaged($query, 1, self::SIZE_ALL); } /** diff --git a/lib/public/Share.php b/lib/public/Share.php index ec3a7c8db1b..f3a0b53efec 100644 --- a/lib/public/Share.php +++ b/lib/public/Share.php @@ -265,8 +265,8 @@ class Share extends \OC\Share\Constants { * @param string $shareWith User or group the item is being shared with * @param int $permissions CRUDS * @param string $itemSourceName - * @param \DateTime $expirationDate - * @param bool $passwordChanged + * @param \DateTime|null $expirationDate + * @param bool|null $passwordChanged * @return bool|string Returns true on success or false on failure, Returns token on success for links * @throws \OC\HintException when the share type is remote and the shareWith is invalid * @throws \Exception diff --git a/lib/public/Share/Exceptions/GenericShareException.php b/lib/public/Share/Exceptions/GenericShareException.php index 8410a2d0037..21a3b2caa5b 100644 --- a/lib/public/Share/Exceptions/GenericShareException.php +++ b/lib/public/Share/Exceptions/GenericShareException.php @@ -35,7 +35,7 @@ class GenericShareException extends HintException { * @param string $message * @param string $hint * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 9.0.0 */ public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { diff --git a/lib/public/SystemTag/ManagerEvent.php b/lib/public/SystemTag/ManagerEvent.php index 85e7863492e..f7a9b8d6da7 100644 --- a/lib/public/SystemTag/ManagerEvent.php +++ b/lib/public/SystemTag/ManagerEvent.php @@ -48,7 +48,7 @@ class ManagerEvent extends Event { * * @param string $event * @param ISystemTag $tag - * @param ISystemTag $beforeTag + * @param ISystemTag|null $beforeTag * @since 9.0.0 */ public function __construct($event, ISystemTag $tag, ISystemTag $beforeTag = null) { diff --git a/lib/public/SystemTag/TagNotFoundException.php b/lib/public/SystemTag/TagNotFoundException.php index c983e2afc80..49008d1adde 100644 --- a/lib/public/SystemTag/TagNotFoundException.php +++ b/lib/public/SystemTag/TagNotFoundException.php @@ -38,7 +38,7 @@ class TagNotFoundException extends \RuntimeException { * * @param string $message * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @param string[] $tags * @since 9.0.0 */ diff --git a/lib/public/Template.php b/lib/public/Template.php index 3dcee14d880..edea99f9ef3 100644 --- a/lib/public/Template.php +++ b/lib/public/Template.php @@ -48,6 +48,7 @@ namespace OCP; * * @see \OCP\IURLGenerator::imagePath * @deprecated 8.0.0 Use \OCP\Template::image_path() instead + * @suppress PhanDeprecatedFunction */ function image_path($app, $image) { return \image_path($app, $image); @@ -59,6 +60,7 @@ function image_path($app, $image) { * @param string $mimetype * @return string to the image of this file type. * @deprecated 8.0.0 Use \OCP\Template::mimetype_icon() instead + * @suppress PhanDeprecatedFunction */ function mimetype_icon($mimetype) { return \mimetype_icon($mimetype); @@ -69,6 +71,7 @@ function mimetype_icon($mimetype) { * @param string $path path to file * @return string to the preview of the image * @deprecated 8.0.0 Use \OCP\Template::preview_icon() instead + * @suppress PhanDeprecatedFunction */ function preview_icon($path) { return \preview_icon($path); @@ -81,6 +84,7 @@ function preview_icon($path) { * @param string $token * @return string link to the preview * @deprecated 8.0.0 Use \OCP\Template::publicPreview_icon() instead + * @suppress PhanDeprecatedFunction */ function publicPreview_icon($path, $token) { return \publicPreview_icon($path, $token); @@ -92,6 +96,7 @@ function publicPreview_icon($path, $token) { * @param int $bytes in bytes * @return string size as string * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead + * @suppress PhanDeprecatedFunction */ function human_file_size($bytes) { return \human_file_size($bytes); @@ -105,6 +110,8 @@ function human_file_size($bytes) { * @return string human readable interpretation of the timestamp * * @deprecated 8.0.0 Use \OCP\Template::relative_modified_date() instead + * @suppress PhanDeprecatedFunction + * @suppress PhanTypeMismatchArgument */ function relative_modified_date($timestamp, $dateOnly = false) { return \relative_modified_date($timestamp, null, $dateOnly); @@ -116,6 +123,7 @@ function relative_modified_date($timestamp, $dateOnly = false) { * @param integer $bytes size of a file in byte * @return string human readable interpretation of a file size * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead + * @suppress PhanDeprecatedFunction */ function simple_file_size($bytes) { return \human_file_size($bytes); @@ -129,6 +137,7 @@ function simple_file_size($bytes) { * @param array $params the parameters * @return string html options * @deprecated 8.0.0 Use \OCP\Template::html_select_options() instead + * @suppress PhanDeprecatedFunction */ function html_select_options($options, $selected, $params=array()) { return \html_select_options($options, $selected, $params); @@ -151,6 +160,7 @@ class Template extends \OC_Template { * @param string $image * @return string to the image * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function image_path($app, $image) { return \image_path($app, $image); @@ -163,6 +173,7 @@ class Template extends \OC_Template { * @param string $mimetype * @return string to the image of this file type. * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function mimetype_icon($mimetype) { return \mimetype_icon($mimetype); @@ -174,6 +185,7 @@ class Template extends \OC_Template { * @param string $path path to file * @return string to the preview of the image * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function preview_icon($path) { return \preview_icon($path); @@ -187,6 +199,7 @@ class Template extends \OC_Template { * @param string $token * @return string link to the preview * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function publicPreview_icon($path, $token) { return \publicPreview_icon($path, $token); @@ -199,6 +212,7 @@ class Template extends \OC_Template { * @param int $bytes in bytes * @return string size as string * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function human_file_size($bytes) { return \human_file_size($bytes); @@ -211,6 +225,8 @@ class Template extends \OC_Template { * @param boolean $dateOnly * @return string human readable interpretation of the timestamp * @since 8.0.0 + * @suppress PhanDeprecatedFunction + * @suppress PhanTypeMismatchArgument */ public static function relative_modified_date($timestamp, $dateOnly = false) { return \relative_modified_date($timestamp, null, $dateOnly); @@ -224,6 +240,7 @@ class Template extends \OC_Template { * @param array $params the parameters * @return string html options * @since 8.0.0 + * @suppress PhanDeprecatedFunction */ public static function html_select_options($options, $selected, $params=array()) { return \html_select_options($options, $selected, $params); diff --git a/lib/public/User.php b/lib/public/User.php index 64398a7f1f8..ef0096deab4 100644 --- a/lib/public/User.php +++ b/lib/public/User.php @@ -89,6 +89,7 @@ class User { * @return array an array of all display names (value) and the correspondig uids (key) * @deprecated 8.1.0 use method searchDisplayName() of \OCP\IUserManager - \OC::$server->getUserManager() * @since 5.0.0 + * @suppress PhanDeprecatedFunction */ public static function getDisplayNames( $search = '', $limit = null, $offset = null ) { return \OC_User::getDisplayNames( $search, $limit, $offset ); @@ -111,8 +112,8 @@ class User { * @deprecated 8.1.0 use method userExists() of \OCP\IUserManager - \OC::$server->getUserManager() * @since 5.0.0 */ - public static function userExists( $uid, $excludingBackend = null ) { - return \OC_User::userExists( $uid, $excludingBackend ); + public static function userExists($uid, $excludingBackend = null) { + return \OC_User::userExists($uid); } /** * Logs the user out including all the session data diff --git a/lib/public/Util.php b/lib/public/Util.php index 6f2e455c3e4..e4ebdb5bfa7 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -252,6 +252,7 @@ class Util { * * @deprecated 8.0.0 Use \OC::$server->query('DateTimeFormatter') instead * @since 4.0.0 + * @suppress PhanDeprecatedFunction */ public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) { return \OC_Util::formatDate($timestamp, $dateOnly, $timeZone); @@ -351,7 +352,7 @@ class Util { * @since 5.0.0 */ public static function getServerHostName() { - $host_name = self::getServerHost(); + $host_name = \OC::$server->getRequest()->getServerHost(); // strip away port number (if existing) $colon_pos = strpos($host_name, ':'); if ($colon_pos != FALSE) { @@ -447,7 +448,7 @@ class Util { /** * Make a computer file size (2 kB to 2048) * @param string $str file size in a fancy format - * @return int a file size in bytes + * @return float a file size in bytes * * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 * @since 4.0.0 @@ -602,7 +603,7 @@ class Util { * * @param array $haystack the array to be searched * @param string $needle the search string - * @param int $index optional, only search this key name + * @param mixed $index optional, only search this key name * @return mixed the key of the matching field, otherwise false * @since 4.5.0 */ @@ -648,6 +649,7 @@ class Util { * @return bool true if the file name is valid, false otherwise * @deprecated 8.1.0 use \OC\Files\View::verifyPath() * @since 7.0.0 + * @suppress PhanDeprecatedFunction */ public static function isValidFileName($file) { return \OC_Util::isValidFileName($file); |