From dfd8125aeb4a95df20041890dcffd50ba2592fee Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 19 Jul 2017 19:44:10 +0200 Subject: Replace wrong PHPDocs Signed-off-by: Lukas Reschke --- ...nsufficientDataForMeaningfulAnswerException.php | 2 +- lib/private/Files/Storage/Common.php | 9 ++++--- lib/private/Files/Storage/FailedStorage.php | 5 ++-- lib/private/Files/Storage/Local.php | 9 ++++--- lib/private/Files/Storage/Wrapper/Availability.php | 6 +++-- lib/private/Files/Storage/Wrapper/Encoding.php | 9 ++++--- lib/private/Files/Storage/Wrapper/Encryption.php | 16 ++++++------ lib/private/Files/Storage/Wrapper/Jail.php | 9 ++++--- lib/private/Files/Storage/Wrapper/Quota.php | 9 ++++--- lib/private/Files/Storage/Wrapper/Wrapper.php | 9 ++++--- lib/private/Lockdown/Filesystem/NullStorage.php | 5 ++-- lib/private/Security/CSRF/CsrfToken.php | 2 +- lib/private/legacy/response.php | 10 ++++---- lib/private/legacy/template.php | 10 +++++--- lib/private/legacy/template/functions.php | 5 ++-- lib/private/legacy/user.php | 4 ++- lib/private/legacy/util.php | 19 +++++++++++--- lib/public/App/ManagerEvent.php | 4 +-- lib/public/AppFramework/ApiController.php | 2 +- lib/public/AppFramework/Http/OCSResponse.php | 1 + lib/public/AppFramework/Http/Response.php | 2 +- lib/public/Comments/ICommentsManager.php | 4 +-- lib/public/DB.php | 2 +- lib/public/Diagnostics/IQueryLogger.php | 4 +-- .../Exceptions/GenericEncryptionException.php | 2 +- lib/public/Files/ForbiddenException.php | 2 +- lib/public/Files/Storage.php | 8 +++--- lib/public/Files/Storage/IStorage.php | 8 +++--- lib/public/Files/StorageAuthException.php | 5 ++-- lib/public/Files/StorageBadConfigException.php | 5 ++-- lib/public/Files/StorageConnectionException.php | 5 ++-- lib/public/Files/StorageNotAvailableException.php | 2 +- lib/public/Files/StorageTimeoutException.php | 5 ++-- lib/public/IDateTimeFormatter.php | 30 ++++++++++------------ lib/public/Lock/LockedException.php | 2 +- lib/public/Response.php | 1 + lib/public/Search/PagedProvider.php | 2 +- lib/public/Share.php | 4 +-- .../Share/Exceptions/GenericShareException.php | 2 +- lib/public/SystemTag/ManagerEvent.php | 2 +- lib/public/SystemTag/TagNotFoundException.php | 2 +- tests/lib/Files/ViewTest.php | 5 ++-- 42 files changed, 136 insertions(+), 113 deletions(-) diff --git a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php index 925dae7030d..6b335f82b56 100644 --- a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php +++ b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php @@ -34,7 +34,7 @@ class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableEx * * @param string $message * @param int $code - * @param \Exception $previous + * @param \Exception|null $previous * @since 6.0.0 */ public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { 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/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/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/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 08ee0abaafe..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'); @@ -328,6 +329,7 @@ class OC_Template extends \OC\Template\Base { * @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 d1818a9a072..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