diff options
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/db.php | 10 | ||||
-rw-r--r-- | lib/private/legacy/db/statementwrapper.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/eventsource.php | 1 | ||||
-rw-r--r-- | lib/private/legacy/helper.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/json.php | 9 | ||||
-rw-r--r-- | lib/private/legacy/response.php | 10 | ||||
-rw-r--r-- | lib/private/legacy/template.php | 14 | ||||
-rw-r--r-- | lib/private/legacy/template/functions.php | 13 | ||||
-rw-r--r-- | lib/private/legacy/user.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 22 |
10 files changed, 59 insertions, 30 deletions
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 |