diff options
Diffstat (limited to 'lib/public')
52 files changed, 318 insertions, 367 deletions
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/Controller.php b/lib/public/AppFramework/Controller.php index 9fb7646e1ae..bec8296490e 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -32,7 +32,6 @@ namespace OCP\AppFramework; -use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\Response; @@ -102,6 +101,7 @@ abstract class Controller { /** * Parses an HTTP accept header and returns the supported responder type * @param string $acceptHeader + * @param string $default * @return string the responder type * @since 7.0.0 * @since 9.1.0 Added default parameter @@ -156,108 +156,4 @@ abstract class Controller { throw new \DomainException('No responder registered for format '. $format . '!'); } - - - /** - * Lets you access post and get parameters by the index - * @deprecated 7.0.0 write your parameters as method arguments instead - * @param string $key the key which you want to access in the URL Parameter - * placeholder, $_POST or $_GET array. - * The priority how they're returned is the following: - * 1. URL parameters - * 2. POST parameters - * 3. GET parameters - * @param string $default If the key is not found, this value will be returned - * @return mixed the content of the array - * @since 6.0.0 - */ - public function params($key, $default=null){ - return $this->request->getParam($key, $default); - } - - - /** - * Returns all params that were received, be it from the request - * (as GET or POST) or through the URL by the route - * @deprecated 7.0.0 use $this->request instead - * @return array the array with all parameters - * @since 6.0.0 - */ - public function getParams() { - return $this->request->getParams(); - } - - - /** - * Returns the method of the request - * @deprecated 7.0.0 use $this->request instead - * @return string the method of the request (POST, GET, etc) - * @since 6.0.0 - */ - public function method() { - return $this->request->getMethod(); - } - - - /** - * Shortcut for accessing an uploaded file through the $_FILES array - * @deprecated 7.0.0 use $this->request instead - * @param string $key the key that will be taken from the $_FILES array - * @return array the file in the $_FILES element - * @since 6.0.0 - */ - public function getUploadedFile($key) { - return $this->request->getUploadedFile($key); - } - - - /** - * Shortcut for getting env variables - * @deprecated 7.0.0 use $this->request instead - * @param string $key the key that will be taken from the $_ENV array - * @return array the value in the $_ENV element - * @since 6.0.0 - */ - public function env($key) { - return $this->request->getEnv($key); - } - - - /** - * Shortcut for getting cookie variables - * @deprecated 7.0.0 use $this->request instead - * @param string $key the key that will be taken from the $_COOKIE array - * @return array the value in the $_COOKIE element - * @since 6.0.0 - */ - public function cookie($key) { - return $this->request->getCookie($key); - } - - - /** - * Shortcut for rendering a template - * @deprecated 7.0.0 return a template response instead - * @param string $templateName the name of the template - * @param array $params the template parameters in key => value structure - * @param string $renderAs user renders a full page, blank only your template - * admin an entry in the admin settings - * @param string[] $headers set additional headers in name/value pairs - * @return \OCP\AppFramework\Http\TemplateResponse containing the page - * @since 6.0.0 - */ - public function render($templateName, array $params=array(), - $renderAs='user', array $headers=array()){ - $response = new TemplateResponse($this->appName, $templateName); - $response->setParams($params); - $response->renderAs($renderAs); - - foreach($headers as $name => $value){ - $response->addHeader($name, $value); - } - - return $response; - } - - } diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 0fc10129b8a..820e00ff963 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -46,7 +46,7 @@ class DataDisplayResponse extends Response { * @param array $headers additional key value based headers * @since 8.1.0 */ - public function __construct($data="", $statusCode=Http::STATUS_OK, + public function __construct($data='', $statusCode=Http::STATUS_OK, $headers=[]) { $this->data = $data; $this->setStatus($statusCode); diff --git a/lib/public/AppFramework/Http/ICallbackResponse.php b/lib/public/AppFramework/Http/ICallbackResponse.php index 4bf5ce36f7e..2e23946112e 100644 --- a/lib/public/AppFramework/Http/ICallbackResponse.php +++ b/lib/public/AppFramework/Http/ICallbackResponse.php @@ -39,6 +39,6 @@ interface ICallbackResponse { * @param IOutput $output a small wrapper that handles output * @since 8.1.0 */ - function callback(IOutput $output); + public function callback(IOutput $output); } 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..94f09a55737 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -83,6 +83,8 @@ class Response { /** @var bool */ private $throttled = false; + /** @var array */ + private $throttleMetadata = []; /** * Caches the response @@ -228,7 +230,7 @@ class Response { /** * By default renders no output - * @return null + * @return string|null * @since 6.0.0 */ public function render() { @@ -328,10 +330,22 @@ class Response { * Marks the response as to throttle. Will be throttled when the * @BruteForceProtection annotation is added. * + * @param array $metadata * @since 12.0.0 */ - public function throttle() { + public function throttle(array $metadata = []) { $this->throttled = true; + $this->throttleMetadata = $metadata; + } + + /** + * Returns the throttle metadata, defaults to empty array + * + * @return array + * @since 13.0.0 + */ + public function getThrottleMetadata() { + return $this->throttleMetadata; } /** diff --git a/lib/public/AppFramework/IApi.php b/lib/public/AppFramework/IApi.php index 419e1782686..1c3f9419ccd 100644 --- a/lib/public/AppFramework/IApi.php +++ b/lib/public/AppFramework/IApi.php @@ -43,7 +43,7 @@ interface IApi { * @return string the user id of the current user * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID() */ - function getUserId(); + public function getUserId(); /** @@ -53,7 +53,7 @@ interface IApi { * @param string $appName the name of the app, defaults to the current one * @return void */ - function addScript($scriptName, $appName = null); + public function addScript($scriptName, $appName = null); /** @@ -63,7 +63,7 @@ interface IApi { * @param string $appName the name of the app, defaults to the current one * @return void */ - function addStyle($styleName, $appName = null); + public function addStyle($styleName, $appName = null); /** @@ -72,7 +72,7 @@ interface IApi { * @param string $name the name of the file without the suffix * @return void */ - function add3rdPartyScript($name); + public function add3rdPartyScript($name); /** @@ -81,7 +81,7 @@ interface IApi { * @param string $name the name of the file without the suffix * @return void */ - function add3rdPartyStyle($name); + public function add3rdPartyStyle($name); /** diff --git a/lib/public/AppFramework/IAppContainer.php b/lib/public/AppFramework/IAppContainer.php index f26afbdcd17..4aac6085d63 100644 --- a/lib/public/AppFramework/IAppContainer.php +++ b/lib/public/AppFramework/IAppContainer.php @@ -42,41 +42,41 @@ interface IAppContainer extends IContainer { * @return string the name of your application * @since 6.0.0 */ - function getAppName(); + public function getAppName(); /** * @deprecated 8.0.0 implements only deprecated methods * @return IApi * @since 6.0.0 */ - function getCoreApi(); + public function getCoreApi(); /** * @return \OCP\IServerContainer * @since 6.0.0 */ - function getServer(); + public function getServer(); /** * @param string $middleWare * @return boolean * @since 6.0.0 */ - function registerMiddleWare($middleWare); + public function registerMiddleWare($middleWare); /** * @deprecated 8.0.0 use IUserSession->isLoggedIn() * @return boolean * @since 6.0.0 */ - function isLoggedIn(); + public function isLoggedIn(); /** * @deprecated 8.0.0 use IGroupManager->isAdmin($userId) * @return boolean * @since 6.0.0 */ - function isAdminUser(); + public function isAdminUser(); /** * @deprecated 8.0.0 use the ILogger instead @@ -85,7 +85,7 @@ interface IAppContainer extends IContainer { * @return mixed * @since 6.0.0 */ - function log($message, $level); + public function log($message, $level); /** * Register a capability 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/Contacts/IManager.php b/lib/public/Contacts/IManager.php index 328b40931d7..117d28525fb 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -32,140 +32,139 @@ // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes -namespace OCP\Contacts { +namespace OCP\Contacts; + +/** + * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. + * + * Contacts in general will be expressed as an array of key-value-pairs. + * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 + * + * Proposed workflow for working with contacts: + * - search for the contacts + * - manipulate the results array + * - createOrUpdate will save the given contacts overwriting the existing data + * + * For updating it is mandatory to keep the id. + * Without an id a new contact will be created. + * + * @since 6.0.0 + */ +interface IManager { /** - * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. + * This function is used to search and find contacts within the users address books. + * In case $pattern is empty all contacts will be returned. + * + * Example: + * Following function shows how to search for contacts for the name and the email address. + * + * public static function getMatchingRecipient($term) { + * $cm = \OC::$server->getContactsManager(); + * // The API is not active -> nothing to do + * if (!$cm->isEnabled()) { + * return array(); + * } * - * Contacts in general will be expressed as an array of key-value-pairs. - * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 + * $result = $cm->search($term, array('FN', 'EMAIL')); + * $receivers = array(); + * foreach ($result as $r) { + * $id = $r['id']; + * $fn = $r['FN']; + * $email = $r['EMAIL']; + * if (!is_array($email)) { + * $email = array($email); + * } * - * Proposed workflow for working with contacts: - * - search for the contacts - * - manipulate the results array - * - createOrUpdate will save the given contacts overwriting the existing data + * // loop through all email addresses of this contact + * foreach ($email as $e) { + * $displayName = $fn . " <$e>"; + * $receivers[] = array( + * 'id' => $id, + * 'label' => $displayName, + * 'value' => $displayName); + * } + * } * - * For updating it is mandatory to keep the id. - * Without an id a new contact will be created. + * return $receivers; + * } * + * + * @param string $pattern which should match within the $searchProperties + * @param array $searchProperties defines the properties within the query pattern should match + * @param array $options - for future use. One should always have options! + * @return array an array of contacts which are arrays of key-value-pairs * @since 6.0.0 */ - interface IManager { - - /** - * This function is used to search and find contacts within the users address books. - * In case $pattern is empty all contacts will be returned. - * - * Example: - * Following function shows how to search for contacts for the name and the email address. - * - * public static function getMatchingRecipient($term) { - * $cm = \OC::$server->getContactsManager(); - * // The API is not active -> nothing to do - * if (!$cm->isEnabled()) { - * return array(); - * } - * - * $result = $cm->search($term, array('FN', 'EMAIL')); - * $receivers = array(); - * foreach ($result as $r) { - * $id = $r['id']; - * $fn = $r['FN']; - * $email = $r['EMAIL']; - * if (!is_array($email)) { - * $email = array($email); - * } - * - * // loop through all email addresses of this contact - * foreach ($email as $e) { - * $displayName = $fn . " <$e>"; - * $receivers[] = array( - * 'id' => $id, - * 'label' => $displayName, - * 'value' => $displayName); - * } - * } - * - * return $receivers; - * } - * - * - * @param string $pattern which should match within the $searchProperties - * @param array $searchProperties defines the properties within the query pattern should match - * @param array $options - for future use. One should always have options! - * @return array an array of contacts which are arrays of key-value-pairs - * @since 6.0.0 - */ - function search($pattern, $searchProperties = array(), $options = array()); + public function search($pattern, $searchProperties = array(), $options = array()); - /** - * This function can be used to delete the contact identified by the given id - * - * @param object $id the unique identifier to a contact - * @param string $address_book_key identifier of the address book in which the contact shall be deleted - * @return bool successful or not - * @since 6.0.0 - */ - function delete($id, $address_book_key); + /** + * This function can be used to delete the contact identified by the given id + * + * @param object $id the unique identifier to a contact + * @param string $address_book_key identifier of the address book in which the contact shall be deleted + * @return bool successful or not + * @since 6.0.0 + */ + public function delete($id, $address_book_key); - /** - * This function is used to create a new contact if 'id' is not given or not present. - * Otherwise the contact will be updated by replacing the entire data set. - * - * @param array $properties this array if key-value-pairs defines a contact - * @param string $address_book_key identifier of the address book in which the contact shall be created or updated - * @return array an array representing the contact just created or updated - * @since 6.0.0 - */ - function createOrUpdate($properties, $address_book_key); + /** + * This function is used to create a new contact if 'id' is not given or not present. + * Otherwise the contact will be updated by replacing the entire data set. + * + * @param array $properties this array if key-value-pairs defines a contact + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated + * @return array an array representing the contact just created or updated + * @since 6.0.0 + */ + public function createOrUpdate($properties, $address_book_key); - /** - * Check if contacts are available (e.g. contacts app enabled) - * - * @return bool true if enabled, false if not - * @since 6.0.0 - */ - function isEnabled(); + /** + * Check if contacts are available (e.g. contacts app enabled) + * + * @return bool true if enabled, false if not + * @since 6.0.0 + */ + public function isEnabled(); - /** - * Registers an address book - * - * @param \OCP\IAddressBook $address_book - * @return void - * @since 6.0.0 - */ - function registerAddressBook(\OCP\IAddressBook $address_book); + /** + * Registers an address book + * + * @param \OCP\IAddressBook $address_book + * @return void + * @since 6.0.0 + */ + public function registerAddressBook(\OCP\IAddressBook $address_book); - /** - * Unregisters an address book - * - * @param \OCP\IAddressBook $address_book - * @return void - * @since 6.0.0 - */ - function unregisterAddressBook(\OCP\IAddressBook $address_book); + /** + * Unregisters an address book + * + * @param \OCP\IAddressBook $address_book + * @return void + * @since 6.0.0 + */ + public function unregisterAddressBook(\OCP\IAddressBook $address_book); - /** - * In order to improve lazy loading a closure can be registered which will be called in case - * address books are actually requested - * - * @param \Closure $callable - * @return void - * @since 6.0.0 - */ - function register(\Closure $callable); + /** + * In order to improve lazy loading a closure can be registered which will be called in case + * address books are actually requested + * + * @param \Closure $callable + * @return void + * @since 6.0.0 + */ + public function register(\Closure $callable); - /** - * @return array - * @since 6.0.0 - */ - function getAddressBooks(); + /** + * @return array + * @since 6.0.0 + */ + public function getAddressBooks(); - /** - * removes all registered address book instances - * @return void - * @since 6.0.0 - */ - function clear(); - } + /** + * removes all registered address book instances + * @return void + * @since 6.0.0 + */ + public function clear(); } diff --git a/lib/public/DB.php b/lib/public/DB.php index d22da39d9c2..645f77076db 100644 --- a/lib/public/DB.php +++ b/lib/public/DB.php @@ -57,7 +57,7 @@ class DB { * @since 4.5.0 */ static public function prepare( $query, $limit=null, $offset=null ) { - return(\OC_DB::prepare($query, $limit, $offset)); + return \OC_DB::prepare($query, $limit, $offset); } /** @@ -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); } /** @@ -117,7 +117,7 @@ class DB { * @since 8.0.0 */ public static function rollback() { - \OC::$server->getDatabaseConnection()->rollback(); + \OC::$server->getDatabaseConnection()->rollBack(); } /** diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php index c123875b803..eab93b52f8a 100644 --- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php +++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php @@ -305,6 +305,24 @@ interface IExpressionBuilder { */ public function notIn($x, $y, $type = null); + /** + * Creates a $x = '' statement, because Oracle needs a different check + * + * @param string $x The field in string format to be inspected by the comparison. + * @return string + * @since 13.0.0 + */ + public function emptyString($x); + + /** + * Creates a `$x <> ''` statement, because Oracle needs a different check + * + * @param string $x The field in string format to be inspected by the comparison. + * @return string + * @since 13.0.0 + */ + public function nonEmptyString($x); + /** * Creates a bitwise AND comparison 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/Defaults.php b/lib/public/Defaults.php index 543657694c5..4bf638fda9f 100644 --- a/lib/public/Defaults.php +++ b/lib/public/Defaults.php @@ -143,9 +143,10 @@ class Defaults { * logo claim * @return string * @since 6.0.0 + * @deprecated 13.0.0 */ public function getLogoClaim() { - return $this->defaults->getLogoClaim(); + return ''; } /** 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.php b/lib/public/Files.php index 08fcbe0bbeb..3b924ea6a29 100644 --- a/lib/public/Files.php +++ b/lib/public/Files.php @@ -50,7 +50,7 @@ class Files { * @return bool * @since 5.0.0 */ - static function rmdirr( $dir ) { + static public function rmdirr( $dir ) { return \OC_Helper::rmdirr( $dir ); } @@ -61,7 +61,7 @@ class Files { * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead * @since 5.0.0 */ - static function getMimeType( $path ) { + static public function getMimeType( $path ) { return \OC::$server->getMimeTypeDetector()->detect($path); } @@ -71,8 +71,8 @@ class Files { * @return array * @since 6.0.0 */ - static public function searchByMime( $mimetype ) { - return(\OC\Files\Filesystem::searchByMime( $mimetype )); + static public function searchByMime($mimetype) { + return \OC\Files\Filesystem::searchByMime($mimetype); } /** @@ -119,8 +119,8 @@ class Files { * @return string * @since 5.0.0 */ - public static function buildNotExistingFileName( $path, $filename ) { - return(\OC_Helper::buildNotExistingFileName( $path, $filename )); + public static function buildNotExistingFileName($path, $filename) { + return \OC_Helper::buildNotExistingFileName($path, $filename); } /** @@ -130,7 +130,7 @@ class Files { * @return \OC\Files\View * @since 5.0.0 */ - public static function getStorage( $app ) { + public static function getStorage($app) { return \OC_App::getStorage( $app ); } } 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/ObjectStore/IObjectStore.php b/lib/public/Files/ObjectStore/IObjectStore.php index 7ae34ce1bc0..3126791d873 100644 --- a/lib/public/Files/ObjectStore/IObjectStore.php +++ b/lib/public/Files/ObjectStore/IObjectStore.php @@ -34,7 +34,7 @@ interface IObjectStore { * @return string the container or bucket name where objects are stored * @since 7.0.0 */ - function getStorageId(); + public function getStorageId(); /** * @param string $urn the unified resource name used to identify the object @@ -42,7 +42,7 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function readObject($urn); + public function readObject($urn); /** * @param string $urn the unified resource name used to identify the object @@ -50,7 +50,7 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function writeObject($urn, $stream); + public function writeObject($urn, $stream); /** * @param string $urn the unified resource name used to identify the object @@ -58,6 +58,5 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function deleteObject($urn); - + public function deleteObject($urn); } 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/IL10N.php b/lib/public/IL10N.php index 0dfe28c2ce8..7856a74219d 100644 --- a/lib/public/IL10N.php +++ b/lib/public/IL10N.php @@ -47,7 +47,7 @@ interface IL10N { * Translating * @param string $text The text we need a translation for * @param array $parameters default:array() Parameters for sprintf - * @return \OC_L10N_String Translation or the same text + * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. @@ -61,7 +61,7 @@ interface IL10N { * @param string $text_plural the string to translate for n objects * @param integer $count Number of objects * @param array $parameters default:array() Parameters for sprintf - * @return \OC_L10N_String Translation or the same text + * @return string Translation or the same text * * Returns the translation. If no translation is found, $text will be * returned. %n will be replaced with the number of objects. 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 02c515e863e..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(); @@ -95,11 +101,11 @@ class JSON { * Send json success msg * * Return a json success message with optional extra data. - * @see OCP\JSON::error() for the format to use. + * @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 43d8c316652..b1294fa6dc4 100644 --- a/lib/public/Search/PagedProvider.php +++ b/lib/public/Search/PagedProvider.php @@ -42,7 +42,7 @@ abstract class PagedProvider extends Provider { * @since 8.0.0 */ public function __construct($options) { - $this->options = $options; + parent::__construct($options); } /** @@ -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/Security/ISecureRandom.php b/lib/public/Security/ISecureRandom.php index 14190639f44..2f74a003f51 100644 --- a/lib/public/Security/ISecureRandom.php +++ b/lib/public/Security/ISecureRandom.php @@ -49,7 +49,7 @@ interface ISecureRandom { * generate human readable random strings. Lower- and upper-case characters and digits * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on. */ - const CHAR_HUMAN_READABLE = "abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789"; + const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789'; /** * Convenience method to get a low strength random number generator. 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 590f430e24c..edea99f9ef3 100644 --- a/lib/public/Template.php +++ b/lib/public/Template.php @@ -48,9 +48,10 @@ 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 )); +function image_path($app, $image) { + return \image_path($app, $image); } @@ -59,9 +60,10 @@ 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 )); +function mimetype_icon($mimetype) { + return \mimetype_icon($mimetype); } /** @@ -69,9 +71,10 @@ 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 )); +function preview_icon($path) { + return \preview_icon($path); } /** @@ -81,9 +84,10 @@ 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 )); +function publicPreview_icon($path, $token) { + return \publicPreview_icon($path, $token); } /** @@ -92,9 +96,10 @@ 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 )); +function human_file_size($bytes) { + return \human_file_size($bytes); } @@ -102,12 +107,14 @@ function human_file_size( $bytes ) { * Return the relative date in relation to today. Returns something like "last hour" or "two month ago" * @param int $timestamp unix timestamp * @param boolean $dateOnly - * @return \OC_L10N_String human readable interpretation of the timestamp + * @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)); +function relative_modified_date($timestamp, $dateOnly = false) { + return \relative_modified_date($timestamp, null, $dateOnly); } @@ -116,9 +123,10 @@ 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)); + return \human_file_size($bytes); } @@ -129,9 +137,10 @@ 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)); + 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/UserInterface.php b/lib/public/UserInterface.php index 119564da736..61136783b3c 100644 --- a/lib/public/UserInterface.php +++ b/lib/public/UserInterface.php @@ -46,7 +46,7 @@ interface UserInterface { * @return boolean * * Returns the supported actions as int to be - * compared with \OC_User_Backend::CREATE_USER etc. + * compared with \OC\User\Backend::CREATE_USER etc. * @since 4.5.0 */ public function implementsActions($actions); diff --git a/lib/public/Util.php b/lib/public/Util.php index 02b59c370a0..e4ebdb5bfa7 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -73,7 +73,7 @@ class Util { * @since 4.0.0 */ public static function getVersion() { - return(\OC_Util::getVersion()); + return \OC_Util::getVersion(); } /** @@ -119,11 +119,11 @@ class Util { $message->setPlainBody($mailtext); $message->setFrom([$fromaddress => $fromname]); if($html === 1) { - $message->setHTMLBody($altbody); + $message->setHtmlBody($altbody); } if($altbody === '') { - $message->setHTMLBody($mailtext); + $message->setHtmlBody($mailtext); $message->setPlainBody(''); } else { $message->setHtmlBody($mailtext); @@ -252,9 +252,10 @@ 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)); + 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) { @@ -440,20 +441,20 @@ class Util { * @return string a human readable file size * @since 4.0.0 */ - public static function humanFileSize( $bytes ) { - return(\OC_Helper::humanFileSize( $bytes )); + public static function humanFileSize($bytes) { + return \OC_Helper::humanFileSize($bytes); } /** * 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 */ - public static function computerFileSize( $str ) { - return(\OC_Helper::computerFileSize( $str )); + public static function computerFileSize($str) { + return \OC_Helper::computerFileSize($str); } /** @@ -470,8 +471,8 @@ class Util { * TODO: write example * @since 4.0.0 */ - static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) { - return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName )); + static public function connectHook($signalClass, $signalName, $slotClass, $slotName) { + return \OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName); } /** @@ -484,8 +485,8 @@ class Util { * TODO: write example * @since 4.0.0 */ - static public function emitHook( $signalclass, $signalname, $params = array()) { - return(\OC_Hook::emit( $signalclass, $signalname, $params )); + static public function emitHook($signalclass, $signalname, $params = array()) { + return \OC_Hook::emit($signalclass, $signalname, $params); } /** @@ -518,7 +519,7 @@ class Util { exit(); } - if (!(\OC::$server->getRequest()->passesCSRFCheck())) { + if (!\OC::$server->getRequest()->passesCSRFCheck()) { exit(); } } @@ -549,7 +550,7 @@ class Util { * @since 6.0.0 */ public static function encodePath($component) { - return(\OC_Util::encodePath($component)); + return \OC_Util::encodePath($component); } /** @@ -562,7 +563,7 @@ class Util { * @since 4.5.0 */ public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') { - return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding)); + return \OC_Helper::mb_array_change_key_case($input, $case, $encoding); } /** @@ -602,12 +603,12 @@ 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 */ public static function recursiveArraySearch($haystack, $needle, $index = null) { - return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index)); + return \OC_Helper::recursiveArraySearch($haystack, $needle, $index); } /** @@ -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); |