diff --git a/lib/public/Accounts/PropertyDoesNotExistException.php b/lib/public/Accounts/PropertyDoesNotExistException.php index d0f10cdf12fe9..ecbdd2e93354f 100644 --- a/lib/public/Accounts/PropertyDoesNotExistException.php +++ b/lib/public/Accounts/PropertyDoesNotExistException.php @@ -13,11 +13,9 @@ */ class PropertyDoesNotExistException extends \Exception { /** - * Constructor - * @param string $msg the error message * @since 15.0.0 */ - public function __construct($property) { + public function __construct(string $property) { parent::__construct('Property ' . $property . ' does not exist.'); } } diff --git a/lib/public/Activity/IEventMerger.php b/lib/public/Activity/IEventMerger.php index e9355c8800475..c0f1a5e31de6c 100644 --- a/lib/public/Activity/IEventMerger.php +++ b/lib/public/Activity/IEventMerger.php @@ -40,5 +40,5 @@ interface IEventMerger { * @return IEvent * @since 11.0 */ - public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null); + public function mergeEvents(string $mergeParameter, IEvent $event, ?IEvent $previousEvent = null); } diff --git a/lib/public/Activity/IProvider.php b/lib/public/Activity/IProvider.php index 17fffbb26e235..2e2165a7b984e 100644 --- a/lib/public/Activity/IProvider.php +++ b/lib/public/Activity/IProvider.php @@ -26,5 +26,5 @@ interface IProvider { * when they did not handle the event. Throwing \InvalidArgumentException directly is deprecated and will * be logged as an error in Nextcloud 39. */ - public function parse($language, IEvent $event, ?IEvent $previousEvent = null); + public function parse(string $language, IEvent $event, ?IEvent $previousEvent = null); } diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php index 580288fbff7d5..10af279015f35 100644 --- a/lib/public/App/IAppManager.php +++ b/lib/public/App/IAppManager.php @@ -27,11 +27,10 @@ interface IAppManager { /** * Returns the app information from "appinfo/info.xml". * - * @param string|null $lang * @return array|null * @since 14.0.0 */ - public function getAppInfo(string $appId, bool $path = false, $lang = null); + public function getAppInfo(string $appId, bool $path = false, ?string $lang = null); /** * Returns the app information from "appinfo/info.xml". @@ -56,12 +55,11 @@ public function getAppIcon(string $appId, bool $dark = false): string|null; /** * Check if an app is enabled for user * - * @param string $appId - * @param \OCP\IUser|null $user (optional) if not defined, the currently loggedin user will be used + * @param IUser|null $user (optional) if not defined, the currently loggedin user will be used * @return bool * @since 8.0.0 */ - public function isEnabledForUser($appId, $user = null); + public function isEnabledForUser(string $appId, ?IUser $user = null); /** * Check if an app is enabled in the instance @@ -72,7 +70,7 @@ public function isEnabledForUser($appId, $user = null); * @return bool * @since 8.0.0 */ - public function isInstalled($appId); + public function isInstalled(string $appId); /** * Check if an app should be enabled by default @@ -116,7 +114,7 @@ public function enableApp(string $appId, bool $forceEnable = false): void; * @return bool * @since 12.0.0 */ - public function hasProtectedAppType($types); + public function hasProtectedAppType(array $types); /** * Enable an app only for specific groups @@ -136,7 +134,7 @@ public function enableAppForGroups(string $appId, array $groups, bool $forceEnab * @param bool $automaticDisabled * @since 8.0.0 */ - public function disableApp($appId, $automaticDisabled = false); + public function disableApp(string $appId, bool $automaticDisabled = false); /** * Get the directory for the given app. @@ -159,7 +157,7 @@ public function getAppWebPath(string $appId): string; /** * List all apps enabled for a user * - * @param \OCP\IUser $user + * @param IUser $user * @return string[] * @since 8.1.0 */ @@ -184,7 +182,7 @@ public function clearAppsCache(); * @return boolean * @since 9.0.0 */ - public function isShipped($appId); + public function isShipped(string $appId); /** * Loads all apps diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php index e02a82195e2d5..76f5eb1f0da98 100644 --- a/lib/public/App/ManagerEvent.php +++ b/lib/public/App/ManagerEvent.php @@ -49,12 +49,10 @@ class ManagerEvent extends Event { /** * DispatcherEvent constructor. * - * @param string $event - * @param $appID * @param \OCP\IGroup[]|null $groups * @since 9.0.0 */ - public function __construct($event, $appID, ?array $groups = null) { + public function __construct(string $event, string $appID, ?array $groups = null) { $this->event = $event; $this->appID = $appID; $this->groups = $groups; diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index dae80456e26b7..b3176f96ece2a 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -36,11 +36,13 @@ abstract class ApiController extends Controller { * request should be cached, defaults to 1728000 seconds * @since 7.0.0 */ - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, - $corsMethods = 'PUT, POST, GET, DELETE, PATCH', - $corsAllowedHeaders = 'Authorization, Content-Type, Accept', - $corsMaxAge = 1728000) { + string $corsMethods = 'PUT, POST, GET, DELETE, PATCH', + string $corsAllowedHeaders = 'Authorization, Content-Type, Accept', + int $corsMaxAge = 1728000, + ) { parent::__construct($appName, $request); $this->corsMethods = $corsMethods; $this->corsAllowedHeaders = $corsAllowedHeaders; diff --git a/lib/public/AppFramework/AuthPublicShareController.php b/lib/public/AppFramework/AuthPublicShareController.php index b79f530dc4dcd..b5186f1a2b412 100644 --- a/lib/public/AppFramework/AuthPublicShareController.php +++ b/lib/public/AppFramework/AuthPublicShareController.php @@ -36,10 +36,12 @@ abstract class AuthPublicShareController extends PublicShareController { /** * @since 14.0.0 */ - public function __construct(string $appName, + public function __construct( + string $appName, IRequest $request, ISession $session, - IURLGenerator $urlGenerator) { + IURLGenerator $urlGenerator, + ) { parent::__construct($appName, $request, $session); $this->urlGenerator = $urlGenerator; diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 57e76f268d986..13a1f920eeb19 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -100,7 +100,7 @@ public function registerServiceAlias(string $alias, string $target): void; * * @since 20.0.0 */ - public function registerParameter(string $name, $value): void; + public function registerParameter(string $name, mixed $value): void; /** * Register a service listener diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 99fed5350e59a..289130bb19cf0 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -43,8 +43,10 @@ abstract class Controller { * @param IRequest $request an instance of the request * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 */ - public function __construct($appName, - IRequest $request) { + public function __construct( + string $appName, + IRequest $request, + ) { $this->appName = $appName; $this->request = $request; @@ -90,7 +92,7 @@ public function __construct($appName, * @since 7.0.0 * @since 9.1.0 Added default parameter */ - public function getResponderByHTTPHeader($acceptHeader, $default = 'json') { + public function getResponderByHTTPHeader(string $acceptHeader, string $default = 'json') { $headers = explode(',', $acceptHeader); // return the first matching responder @@ -115,7 +117,7 @@ public function getResponderByHTTPHeader($acceptHeader, $default = 'json') { * @param \Closure $responder * @since 7.0.0 */ - protected function registerResponder($format, \Closure $responder) { + protected function registerResponder(string $format, \Closure $responder) { $this->responders[$format] = $responder; } @@ -129,7 +131,7 @@ protected function registerResponder($format, \Closure $responder) { * @return Response * @since 7.0.0 */ - public function buildResponse($response, $format = 'json') { + public function buildResponse($response, string $format = 'json') { if (array_key_exists($format, $this->responders)) { $responder = $this->responders[$format]; diff --git a/lib/public/AppFramework/Db/DoesNotExistException.php b/lib/public/AppFramework/Db/DoesNotExistException.php index 416268b27c1c8..213636fbc0454 100644 --- a/lib/public/AppFramework/Db/DoesNotExistException.php +++ b/lib/public/AppFramework/Db/DoesNotExistException.php @@ -15,11 +15,9 @@ */ class DoesNotExistException extends \Exception implements IMapperException { /** - * Constructor - * @param string $msg the error message * @since 7.0.0 */ - public function __construct($msg) { + public function __construct(string $msg) { parent::__construct($msg); } } diff --git a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php index e83bc1647d70c..a5aa3893aba97 100644 --- a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php +++ b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php @@ -15,11 +15,9 @@ */ class MultipleObjectsReturnedException extends \Exception implements IMapperException { /** - * Constructor - * @param string $msg the error message * @since 7.0.0 */ - public function __construct($msg) { + public function __construct(string $msg) { parent::__construct($msg); } } diff --git a/lib/public/AppFramework/Http/DataDownloadResponse.php b/lib/public/AppFramework/Http/DataDownloadResponse.php index 80100137c48d5..af429e29818f8 100644 --- a/lib/public/AppFramework/Http/DataDownloadResponse.php +++ b/lib/public/AppFramework/Http/DataDownloadResponse.php @@ -42,7 +42,7 @@ public function __construct(string $data, string $filename, string $contentType, * @param string $data * @since 8.0.0 */ - public function setData($data) { + public function setData(string $data) { $this->data = $data; } diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index 2ebb66f9e73e9..e5883af33b77e 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -47,7 +47,7 @@ public function __construct(mixed $data = [], int $statusCode = Http::STATUS_OK, * @return DataResponse Reference to this object * @since 8.0.0 */ - public function setData($data) { + public function setData(mixed $data) { $this->data = $data; return $this; diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php index 0a6258be94138..8dc7ac8366cf8 100644 --- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php @@ -96,7 +96,7 @@ public function useStrictDynamicOnScripts(bool $state = false): self { * @return $this * @since 11.0.0 */ - public function useJsNonce($nonce) { + public function useJsNonce(string $nonce) { $this->jsNonce = $nonce; return $this; } @@ -108,7 +108,7 @@ public function useJsNonce($nonce) { * @since 8.1.0 * @deprecated Eval should not be used anymore. Please update your scripts. This function will stop functioning in a future version of Nextcloud. */ - public function allowEvalScript($state = true) { + public function allowEvalScript(bool $state = true) { $this->evalScriptAllowed = $state; return $this; } @@ -127,11 +127,11 @@ public function allowEvalWasm(bool $state = true) { /** * Allows to execute JavaScript files from a specific domain. Use * to * allow JavaScript from all domains. - * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. + * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this * @since 8.1.0 */ - public function addAllowedScriptDomain($domain) { + public function addAllowedScriptDomain(string $domain) { $this->allowedScriptDomains[] = $domain; return $this; } @@ -143,7 +143,7 @@ public function addAllowedScriptDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowScriptDomain($domain) { + public function disallowScriptDomain(string $domain) { $this->allowedScriptDomains = array_diff($this->allowedScriptDomains, [$domain]); return $this; } @@ -154,7 +154,7 @@ public function disallowScriptDomain($domain) { * @return $this * @since 8.1.0 */ - public function allowInlineStyle($state = true) { + public function allowInlineStyle(bool $state = true) { $this->inlineStyleAllowed = $state; return $this; } @@ -166,7 +166,7 @@ public function allowInlineStyle($state = true) { * @return $this * @since 8.1.0 */ - public function addAllowedStyleDomain($domain) { + public function addAllowedStyleDomain(string $domain) { $this->allowedStyleDomains[] = $domain; return $this; } @@ -178,7 +178,7 @@ public function addAllowedStyleDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowStyleDomain($domain) { + public function disallowStyleDomain(string $domain) { $this->allowedStyleDomains = array_diff($this->allowedStyleDomains, [$domain]); return $this; } @@ -190,7 +190,7 @@ public function disallowStyleDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedFontDomain($domain) { + public function addAllowedFontDomain(string $domain) { $this->allowedFontDomains[] = $domain; return $this; } @@ -202,7 +202,7 @@ public function addAllowedFontDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowFontDomain($domain) { + public function disallowFontDomain(string $domain) { $this->allowedFontDomains = array_diff($this->allowedFontDomains, [$domain]); return $this; } @@ -214,7 +214,7 @@ public function disallowFontDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedImageDomain($domain) { + public function addAllowedImageDomain(string $domain) { $this->allowedImageDomains[] = $domain; return $this; } @@ -226,7 +226,7 @@ public function addAllowedImageDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowImageDomain($domain) { + public function disallowImageDomain(string $domain) { $this->allowedImageDomains = array_diff($this->allowedImageDomains, [$domain]); return $this; } @@ -237,7 +237,7 @@ public function disallowImageDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedConnectDomain($domain) { + public function addAllowedConnectDomain(string $domain) { $this->allowedConnectDomains[] = $domain; return $this; } @@ -249,7 +249,7 @@ public function addAllowedConnectDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowConnectDomain($domain) { + public function disallowConnectDomain(string $domain) { $this->allowedConnectDomains = array_diff($this->allowedConnectDomains, [$domain]); return $this; } @@ -260,7 +260,7 @@ public function disallowConnectDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedMediaDomain($domain) { + public function addAllowedMediaDomain(string $domain) { $this->allowedMediaDomains[] = $domain; return $this; } @@ -272,7 +272,7 @@ public function addAllowedMediaDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowMediaDomain($domain) { + public function disallowMediaDomain(string $domain) { $this->allowedMediaDomains = array_diff($this->allowedMediaDomains, [$domain]); return $this; } @@ -283,7 +283,7 @@ public function disallowMediaDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedObjectDomain($domain) { + public function addAllowedObjectDomain(string $domain) { $this->allowedObjectDomains[] = $domain; return $this; } @@ -295,7 +295,7 @@ public function addAllowedObjectDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowObjectDomain($domain) { + public function disallowObjectDomain(string $domain) { $this->allowedObjectDomains = array_diff($this->allowedObjectDomains, [$domain]); return $this; } @@ -306,7 +306,7 @@ public function disallowObjectDomain($domain) { * @return $this * @since 8.1.0 */ - public function addAllowedFrameDomain($domain) { + public function addAllowedFrameDomain(string $domain) { $this->allowedFrameDomains[] = $domain; return $this; } @@ -318,7 +318,7 @@ public function addAllowedFrameDomain($domain) { * @return $this * @since 8.1.0 */ - public function disallowFrameDomain($domain) { + public function disallowFrameDomain(string $domain) { $this->allowedFrameDomains = array_diff($this->allowedFrameDomains, [$domain]); return $this; } @@ -330,7 +330,7 @@ public function disallowFrameDomain($domain) { * @since 8.1.0 * @deprecated 15.0.0 use addAllowedWorkerSrcDomains or addAllowedFrameDomain */ - public function addAllowedChildSrcDomain($domain) { + public function addAllowedChildSrcDomain(string $domain) { $this->allowedChildSrcDomains[] = $domain; return $this; } @@ -343,7 +343,7 @@ public function addAllowedChildSrcDomain($domain) { * @since 8.1.0 * @deprecated 15.0.0 use the WorkerSrcDomains or FrameDomain */ - public function disallowChildSrcDomain($domain) { + public function disallowChildSrcDomain(string $domain) { $this->allowedChildSrcDomains = array_diff($this->allowedChildSrcDomains, [$domain]); return $this; } @@ -355,7 +355,7 @@ public function disallowChildSrcDomain($domain) { * @return $this * @since 13.0.0 */ - public function addAllowedFrameAncestorDomain($domain) { + public function addAllowedFrameAncestorDomain(string $domain) { $this->allowedFrameAncestors[] = $domain; return $this; } @@ -367,7 +367,7 @@ public function addAllowedFrameAncestorDomain($domain) { * @return $this * @since 13.0.0 */ - public function disallowFrameAncestorDomain($domain) { + public function disallowFrameAncestorDomain(string $domain) { $this->allowedFrameAncestors = array_diff($this->allowedFrameAncestors, [$domain]); return $this; } diff --git a/lib/public/AppFramework/Http/IOutput.php b/lib/public/AppFramework/Http/IOutput.php index 105eaa0edb98d..fea24842cb1e9 100644 --- a/lib/public/AppFramework/Http/IOutput.php +++ b/lib/public/AppFramework/Http/IOutput.php @@ -16,7 +16,7 @@ interface IOutput { * @param string $out * @since 8.1.0 */ - public function setOutput($out); + public function setOutput(string $out); /** * @param string|resource $path or file handle @@ -30,7 +30,7 @@ public function setReadfile($path); * @param string $header * @since 8.1.0 */ - public function setHeader($header); + public function setHeader(string $header); /** * @return int returns the current http response code @@ -42,7 +42,7 @@ public function getHttpResponseCode(); * @param int $code sets the http status code * @since 8.1.0 */ - public function setHttpResponseCode($code); + public function setHttpResponseCode(int $code); /** * @param string $name @@ -55,5 +55,5 @@ public function setHttpResponseCode($code); * @param string $sameSite (added in 20) * @since 8.1.0 */ - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax'); + public function setCookie(string $name, string $value, int $expire, string $path, string $domain, bool $secure, bool $httpOnly, string $sameSite = 'Lax'); } diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index afe36c4a8c386..a2eb9937031d2 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -71,7 +71,7 @@ public function render() { * @return JSONResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function setData($data) { + public function setData(mixed $data) { $this->data = $data; return $this; diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 940f0f124e882..57a051de55186 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -117,7 +117,7 @@ public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutabl * @return $this * @since 8.0.0 */ - public function addCookie($name, $value, ?\DateTime $expireDate = null, $sameSite = 'Lax') { + public function addCookie(string $name, string $value, ?\DateTime $expireDate = null, string $sameSite = 'Lax') { $this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate, 'sameSite' => $sameSite]; return $this; } @@ -141,7 +141,7 @@ public function setCookies(array $cookies) { * @return $this * @since 8.0.0 */ - public function invalidateCookie($name) { + public function invalidateCookie(string $name) { $this->addCookie($name, 'expired', new \DateTime('1971-01-01 00:00')); return $this; } @@ -176,7 +176,7 @@ public function getCookies() { * @return $this * @since 6.0.0 - return value was added in 7.0.0 */ - public function addHeader($name, $value) { + public function addHeader(string $name, string $value) { $name = trim($name); // always remove leading and trailing whitespace // to be able to reliably check for security // headers @@ -268,7 +268,7 @@ public function render() { * @return static * @since 6.0.0 - return value was added in 7.0.0 */ - public function setStatus($status): static { + public function setStatus(int $status): static { /** @psalm-suppress InvalidPropertyAssignmentValue Expected due to @psalm-this-out */ $this->status = $status; @@ -370,7 +370,7 @@ public function setETag($ETag) { * @return Response Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function setLastModified($lastModified) { + public function setLastModified(\DateTime $lastModified) { $this->lastModified = $lastModified; return $this; diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 1000f4db549a7..f8f5f45cf9604 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -39,7 +39,7 @@ public function __construct( string $appName, string $templateName, array $params = [], - $status = Http::STATUS_OK, + int $status = Http::STATUS_OK, array $headers = [], ) { parent::__construct($appName, $templateName, $params, 'public', $status, $headers); diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 2c7567c080b88..e1bea847f1e37 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -137,13 +137,13 @@ public function getTemplateName() { /** * Sets the template page * @param string $renderAs admin, user or blank. Admin also prints the admin - * settings header and footer, user renders the normal + * settings header and footer, user renders the * normal page including footer and header and blank * just renders the plain template * @return TemplateResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function renderAs($renderAs) { + public function renderAs(string $renderAs) { $this->renderAs = $renderAs; return $this; diff --git a/lib/public/AppFramework/OCS/OCSBadRequestException.php b/lib/public/AppFramework/OCS/OCSBadRequestException.php index c229468fb0ddc..9646ed5ff0cfe 100644 --- a/lib/public/AppFramework/OCS/OCSBadRequestException.php +++ b/lib/public/AppFramework/OCS/OCSBadRequestException.php @@ -15,13 +15,9 @@ */ class OCSBadRequestException extends OCSException { /** - * OCSBadRequestException constructor. - * - * @param string $message - * @param Exception|null $previous * @since 9.1.0 */ - public function __construct($message = '', ?Exception $previous = null) { + public function __construct(string $message = '', ?Exception $previous = null) { parent::__construct($message, Http::STATUS_BAD_REQUEST, $previous); } } diff --git a/lib/public/AppFramework/OCS/OCSForbiddenException.php b/lib/public/AppFramework/OCS/OCSForbiddenException.php index 03b1db6104f21..9d85c23a59053 100644 --- a/lib/public/AppFramework/OCS/OCSForbiddenException.php +++ b/lib/public/AppFramework/OCS/OCSForbiddenException.php @@ -15,13 +15,9 @@ */ class OCSForbiddenException extends OCSException { /** - * OCSForbiddenException constructor. - * - * @param string $message - * @param Exception|null $previous * @since 9.1.0 */ - public function __construct($message = '', ?Exception $previous = null) { + public function __construct(string $message = '', ?Exception $previous = null) { parent::__construct($message, Http::STATUS_FORBIDDEN, $previous); } } diff --git a/lib/public/AppFramework/OCS/OCSNotFoundException.php b/lib/public/AppFramework/OCS/OCSNotFoundException.php index 997b0c390f9fc..5656c808deb31 100644 --- a/lib/public/AppFramework/OCS/OCSNotFoundException.php +++ b/lib/public/AppFramework/OCS/OCSNotFoundException.php @@ -15,13 +15,9 @@ */ class OCSNotFoundException extends OCSException { /** - * OCSNotFoundException constructor. - * - * @param string $message - * @param Exception|null $previous * @since 9.1.0 */ - public function __construct($message = '', ?Exception $previous = null) { + public function __construct(string $message = '', ?Exception $previous = null) { parent::__construct($message, Http::STATUS_NOT_FOUND, $previous); } } diff --git a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php index 2e67263bcb917..de5696990d557 100644 --- a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php +++ b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php @@ -15,13 +15,9 @@ */ class OCSPreconditionFailedException extends OCSException { /** - * OCSPreconditionFailedException constructor. - * - * @param string $message - * @param Exception|null $previous * @since 9.1.0 */ - public function __construct($message = '', ?Exception $previous = null) { + public function __construct(string $message = '', ?Exception $previous = null) { parent::__construct($message, Http::STATUS_PRECONDITION_FAILED, $previous); } } diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index 7cde2a7e427f6..1b054dbcd9ba4 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -53,11 +53,13 @@ abstract class OCSController extends ApiController { * request should be cached, defaults to 1728000 seconds * @since 8.1.0 */ - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, - $corsMethods = 'PUT, POST, GET, DELETE, PATCH', - $corsAllowedHeaders = 'Authorization, Content-Type, Accept, OCS-APIRequest', - $corsMaxAge = 1728000) { + string $corsMethods = 'PUT, POST, GET, DELETE, PATCH', + string $corsAllowedHeaders = 'Authorization, Content-Type, Accept, OCS-APIRequest', + int $corsMaxAge = 1728000, + ) { parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge); $this->registerResponder('json', function ($data) { @@ -73,7 +75,7 @@ public function __construct($appName, * @since 11.0.0 * @internal */ - public function setOCSVersion($version) { + public function setOCSVersion(int $version) { $this->ocsVersion = $version; } @@ -87,7 +89,7 @@ public function setOCSVersion($version) { * @return Response * @since 9.1.0 */ - public function buildResponse($response, $format = 'xml') { + public function buildResponse($response, string $format = 'xml') { return parent::buildResponse($response, $format); } @@ -98,7 +100,7 @@ public function buildResponse($response, $format = 'xml') { * @since 8.1.0 * @return \OC\AppFramework\OCS\BaseResponse */ - private function buildOCSResponse($format, DataResponse $data) { + private function buildOCSResponse(string $format, DataResponse $data) { if ($this->ocsVersion === 1) { return new \OC\AppFramework\OCS\V1Response($data, $format); } diff --git a/lib/public/AppFramework/PublicShareController.php b/lib/public/AppFramework/PublicShareController.php index 458606455d165..7da2eb4f977a6 100644 --- a/lib/public/AppFramework/PublicShareController.php +++ b/lib/public/AppFramework/PublicShareController.php @@ -34,9 +34,11 @@ abstract class PublicShareController extends Controller { /** * @since 14.0.0 */ - public function __construct(string $appName, + public function __construct( + string $appName, IRequest $request, - ISession $session) { + ISession $session, + ) { parent::__construct($appName, $request); $this->session = $session; diff --git a/lib/public/AppFramework/Services/IAppConfig.php b/lib/public/AppFramework/Services/IAppConfig.php index aa95e66560482..e7f3cf44ae977 100644 --- a/lib/public/AppFramework/Services/IAppConfig.php +++ b/lib/public/AppFramework/Services/IAppConfig.php @@ -295,7 +295,7 @@ public function deleteAppValues(): void; * @param string $userId the userId of the user that we want to store the value under * @param string $key the key under which the value is being stored * @param string $value the value that you want to store - * @param string $preCondition only update if the config value was previously the value passed as $preCondition + * @param ?string $preCondition only update if the config value was previously the value passed as $preCondition * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met * @throws \UnexpectedValueException when trying to store an unexpected value * @since 20.0.0 diff --git a/lib/public/AppFramework/Services/IInitialState.php b/lib/public/AppFramework/Services/IInitialState.php index 24698108d68c3..83b3b97c968d8 100644 --- a/lib/public/AppFramework/Services/IInitialState.php +++ b/lib/public/AppFramework/Services/IInitialState.php @@ -24,7 +24,7 @@ interface IInitialState { * @param string $key * @param bool|int|float|string|array|\JsonSerializable $data */ - public function provideInitialState(string $key, $data): void; + public function provideInitialState(string $key, bool|int|float|string|array|\JsonSerializable $data): void; /** * Allows an app to provide its initial state via a lazy method. diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php index 15e5ed92509dc..42ca855df35a2 100644 --- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php +++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php @@ -20,7 +20,8 @@ class TwoFactorProviderChallengeFailed extends Event { */ public function __construct( private IUser $user, - private IProvider $provider) { + private IProvider $provider, + ) { parent::__construct(); } diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php index 2dc91a98880bc..396fbf9e9a5bd 100644 --- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php +++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php @@ -20,7 +20,8 @@ class TwoFactorProviderChallengePassed extends Event { */ public function __construct( private IUser $user, - private IProvider $provider) { + private IProvider $provider, + ) { parent::__construct(); } diff --git a/lib/public/AutoloadNotAllowedException.php b/lib/public/AutoloadNotAllowedException.php index 6e897b49406cf..62a03237c1caa 100644 --- a/lib/public/AutoloadNotAllowedException.php +++ b/lib/public/AutoloadNotAllowedException.php @@ -14,10 +14,9 @@ */ class AutoloadNotAllowedException extends \DomainException { /** - * @param string $path * @since 8.2.0 */ - public function __construct($path) { + public function __construct(string $path) { parent::__construct('Autoload path not allowed: '.$path); } } diff --git a/lib/public/Color.php b/lib/public/Color.php index c8ba3a1ff1559..ff1189d291c61 100644 --- a/lib/public/Color.php +++ b/lib/public/Color.php @@ -17,7 +17,7 @@ class Color { /** * @since 25.0.0 */ - public function __construct($r, $g, $b) { + public function __construct(int $r, int $g, int $b) { $this->r = $r; $this->g = $g; $this->b = $b; diff --git a/lib/public/GroupInterface.php b/lib/public/GroupInterface.php index 9329fe4a45409..f854d8fe7c45d 100644 --- a/lib/public/GroupInterface.php +++ b/lib/public/GroupInterface.php @@ -70,7 +70,7 @@ interface GroupInterface { * Returns the supported actions as int to be * compared with \OC_Group_Backend::CREATE_GROUP etc. */ - public function implementsActions($actions); + public function implementsActions(int $actions); /** * is user in group? @@ -81,7 +81,7 @@ public function implementsActions($actions); * * Checks whether the user is member of a group or not. */ - public function inGroup($uid, $gid); + public function inGroup(string $uid, string $gid); /** * Get all groups a user belongs to @@ -92,7 +92,7 @@ public function inGroup($uid, $gid); * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ - public function getUserGroups($uid); + public function getUserGroups(string $uid); /** * @brief Get a list of all groups @@ -114,7 +114,7 @@ public function getGroups(string $search = '', int $limit = -1, int $offset = 0) * @return bool * @since 4.5.0 */ - public function groupExists($gid); + public function groupExists(string $gid); /** * @brief Get a list of user ids in a group matching the given search parameters. @@ -127,5 +127,5 @@ public function groupExists($gid); * @since 4.5.0 * @deprecated 27.0.0 Use searchInGroup instead, for performance reasons */ - public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0); + public function usersInGroup(string $gid, string $search = '', int $limit = -1, int $offset = 0); } diff --git a/lib/public/HintException.php b/lib/public/HintException.php index 6d9684bddeab0..7cfebe73a68f5 100644 --- a/lib/public/HintException.php +++ b/lib/public/HintException.php @@ -30,7 +30,7 @@ class HintException extends \Exception { * @param int $code * @param \Exception|null $previous */ - public function __construct($message, $hint = '', $code = 0, ?\Exception $previous = null) { + public function __construct(string $message, string $hint = '', int $code = 0, ?\Exception $previous = null) { $this->hint = $hint; parent::__construct($message, $code, $previous); } diff --git a/lib/public/IAddressBook.php b/lib/public/IAddressBook.php index 780b005fe8db2..02532413e2f7d 100644 --- a/lib/public/IAddressBook.php +++ b/lib/public/IAddressBook.php @@ -52,14 +52,14 @@ public function getDisplayName(); * ] * @since 5.0.0 */ - public function search($pattern, $searchProperties, $options); + public function search(string $pattern, array $searchProperties, array $options); /** * @param array $properties this array if key-value-pairs defines a contact * @return array an array representing the contact just created or updated * @since 5.0.0 */ - public function createOrUpdate($properties); + public function createOrUpdate(array $properties); // // dummy // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif', @@ -77,7 +77,7 @@ public function getPermissions(); * @return bool successful or not * @since 5.0.0 */ - public function delete($id); + public function delete(int $id); /** * Returns true if this address-book is not owned by the current user, diff --git a/lib/public/IAppConfig.php b/lib/public/IAppConfig.php index 49f5146730883..ebd63c2fc0f14 100644 --- a/lib/public/IAppConfig.php +++ b/lib/public/IAppConfig.php @@ -492,7 +492,7 @@ public function clearCache(bool $reload = false): void; * @since 7.0.0 * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()} */ - public function getValues($app, $key); + public function getValues(string|false $app, string|false $key); /** * get all values of the app or and filters out sensitive data @@ -503,5 +503,5 @@ public function getValues($app, $key); * @since 12.0.0 * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()} */ - public function getFilteredValues($app); + public function getFilteredValues(string $app); } diff --git a/lib/public/ICache.php b/lib/public/ICache.php index 5e755d81e1448..88146079ce9f3 100644 --- a/lib/public/ICache.php +++ b/lib/public/ICache.php @@ -26,7 +26,7 @@ interface ICache { * @return mixed * @since 6.0.0 */ - public function get($key); + public function get(string $key); /** * Set a value in the user cache @@ -36,7 +36,7 @@ public function get($key); * @return bool * @since 6.0.0 */ - public function set($key, $value, $ttl = 0); + public function set(string $key, mixed $value, int $ttl = 0); /** * Check if a value is set in the user cache @@ -45,7 +45,7 @@ public function set($key, $value, $ttl = 0); * @since 6.0.0 * @deprecated 9.1.0 Directly read from GET to prevent race conditions */ - public function hasKey($key); + public function hasKey(string $key); /** * Remove an item from the user cache @@ -53,7 +53,7 @@ public function hasKey($key); * @return bool * @since 6.0.0 */ - public function remove($key); + public function remove(string $key); /** * Clear the user cache of all entries starting with a prefix @@ -61,7 +61,7 @@ public function remove($key); * @return bool * @since 6.0.0 */ - public function clear($prefix = ''); + public function clear(string $prefix = ''); /** * Check if the cache implementation is available