Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 025d114e6a | |||
| e271318e5b |
@@ -308,7 +308,7 @@ class Connection extends LDAPUtility {
|
||||
}
|
||||
$key = $this->getCacheKey($key);
|
||||
$value = base64_encode(json_encode($value));
|
||||
$ttl = $ttlOverride ?? $this->configuration->ldapCacheTTL;
|
||||
$ttl = $ttlOverride ?? (int) $this->configuration->ldapCacheTTL;
|
||||
$this->cache->set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@ namespace OCP\Accounts;
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,5 +41,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);
|
||||
}
|
||||
|
||||
@@ -27,5 +27,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);
|
||||
}
|
||||
|
||||
@@ -27,12 +27,11 @@ interface IAppManager {
|
||||
/**
|
||||
* Returns the app information from "appinfo/info.xml" for an app
|
||||
*
|
||||
* @param string|null $lang
|
||||
* @return array|null
|
||||
* @since 14.0.0
|
||||
* @since 31.0.0 Usage of $path is discontinued and throws an \InvalidArgumentException, use {@see self::getAppInfoByPath} instead.
|
||||
*/
|
||||
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 a given path ending with "/appinfo/info.xml"
|
||||
@@ -72,12 +71,11 @@ interface IAppManager {
|
||||
/**
|
||||
* 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
|
||||
@@ -89,7 +87,7 @@ interface IAppManager {
|
||||
* @since 8.0.0
|
||||
* @deprecated 32.0.0 Use either {@see self::isEnabledForUser} or {@see self::isEnabledForAnyone}
|
||||
*/
|
||||
public function isInstalled($appId);
|
||||
public function isInstalled(string $appId);
|
||||
|
||||
/**
|
||||
* Check if an app is enabled in the instance, either for everyone or for specific groups
|
||||
@@ -140,7 +138,7 @@ interface IAppManager {
|
||||
* @return bool
|
||||
* @since 12.0.0
|
||||
*/
|
||||
public function hasProtectedAppType($types);
|
||||
public function hasProtectedAppType(array $types);
|
||||
|
||||
/**
|
||||
* Enable an app only for specific groups
|
||||
@@ -160,7 +158,7 @@ interface IAppManager {
|
||||
* @param bool $automaticDisabled
|
||||
* @since 8.0.0
|
||||
*/
|
||||
public function disableApp($appId, $automaticDisabled = false): void;
|
||||
public function disableApp(string $appId, bool $automaticDisabled = false): void;
|
||||
|
||||
/**
|
||||
* Get the directory for the given app.
|
||||
@@ -183,7 +181,7 @@ interface IAppManager {
|
||||
/**
|
||||
* List all apps enabled for a user
|
||||
*
|
||||
* @param \OCP\IUser $user
|
||||
* @param IUser $user
|
||||
* @return list<string>
|
||||
* @since 8.1.0
|
||||
*/
|
||||
@@ -217,7 +215,7 @@ interface IAppManager {
|
||||
* @return boolean
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function isShipped($appId);
|
||||
public function isShipped(string $appId);
|
||||
|
||||
/**
|
||||
* Loads all apps
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -100,7 +100,7 @@ interface IRegistrationContext {
|
||||
*
|
||||
* @since 20.0.0
|
||||
*/
|
||||
public function registerParameter(string $name, $value): void;
|
||||
public function registerParameter(string $name, mixed $value): void;
|
||||
|
||||
/**
|
||||
* Register a service listener
|
||||
|
||||
@@ -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 @@ abstract class Controller {
|
||||
* @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 @@ abstract class Controller {
|
||||
* @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 @@ abstract class Controller {
|
||||
* @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];
|
||||
|
||||
|
||||
@@ -15,11 +15,9 @@ namespace OCP\AppFramework\Db;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,9 @@ namespace OCP\AppFramework\Db;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class DataDownloadResponse extends DownloadResponse {
|
||||
* @param string $data
|
||||
* @since 8.0.0
|
||||
*/
|
||||
public function setData($data) {
|
||||
public function setData(string $data) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class DataResponse extends Response {
|
||||
* @return DataResponse Reference to this object
|
||||
* @since 8.0.0
|
||||
*/
|
||||
public function setData($data) {
|
||||
public function setData(mixed $data) {
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -96,7 +96,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 11.0.0
|
||||
*/
|
||||
public function useJsNonce($nonce) {
|
||||
public function useJsNonce(string $nonce) {
|
||||
$this->jsNonce = $nonce;
|
||||
return $this;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @since 8.1.0
|
||||
* @deprecated 17.0.0 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 @@ class EmptyContentSecurityPolicy {
|
||||
/**
|
||||
* 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 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedStyleDomain($domain) {
|
||||
public function addAllowedStyleDomain(string $domain) {
|
||||
$this->allowedStyleDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedFontDomain($domain) {
|
||||
public function addAllowedFontDomain(string $domain) {
|
||||
$this->allowedFontDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedImageDomain($domain) {
|
||||
public function addAllowedImageDomain(string $domain) {
|
||||
$this->allowedImageDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedConnectDomain($domain) {
|
||||
public function addAllowedConnectDomain(string $domain) {
|
||||
$this->allowedConnectDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedMediaDomain($domain) {
|
||||
public function addAllowedMediaDomain(string $domain) {
|
||||
$this->allowedMediaDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedObjectDomain($domain) {
|
||||
public function addAllowedObjectDomain(string $domain) {
|
||||
$this->allowedObjectDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 8.1.0
|
||||
*/
|
||||
public function addAllowedFrameDomain($domain) {
|
||||
public function addAllowedFrameDomain(string $domain) {
|
||||
$this->allowedFrameDomains[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @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 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function addAllowedFrameAncestorDomain($domain) {
|
||||
public function addAllowedFrameAncestorDomain(string $domain) {
|
||||
$this->allowedFrameAncestors[] = $domain;
|
||||
return $this;
|
||||
}
|
||||
@@ -367,7 +367,7 @@ class EmptyContentSecurityPolicy {
|
||||
* @return $this
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function disallowFrameAncestorDomain($domain) {
|
||||
public function disallowFrameAncestorDomain(string $domain) {
|
||||
$this->allowedFrameAncestors = array_diff($this->allowedFrameAncestors, [$domain]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -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 @@ interface IOutput {
|
||||
* @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 @@ interface IOutput {
|
||||
* @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 @@ interface IOutput {
|
||||
* @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');
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class JSONResponse extends Response {
|
||||
* @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;
|
||||
|
||||
@@ -116,7 +116,7 @@ class Response {
|
||||
* @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;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class Response {
|
||||
* @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;
|
||||
}
|
||||
@@ -171,11 +171,11 @@ class Response {
|
||||
* Adds a new header to the response that will be called before the render
|
||||
* function
|
||||
* @param string $name The name of the HTTP header
|
||||
* @param string $value The value, null will delete it
|
||||
* @param ?string $value The value, null will delete it
|
||||
* @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
|
||||
@@ -267,7 +267,7 @@ class Response {
|
||||
* @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;
|
||||
|
||||
@@ -369,7 +369,7 @@ class Response {
|
||||
* @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;
|
||||
|
||||
@@ -40,7 +40,7 @@ class PublicTemplateResponse extends TemplateResponse {
|
||||
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);
|
||||
|
||||
@@ -143,13 +143,13 @@ class TemplateResponse extends Response {
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -16,13 +16,9 @@ use OCP\AppFramework\Http;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,9 @@ use OCP\AppFramework\Http;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,9 @@ use OCP\AppFramework\Http;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,9 @@ use OCP\AppFramework\Http;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 @@ abstract class OCSController extends ApiController {
|
||||
* @since 11.0.0
|
||||
* @internal
|
||||
*/
|
||||
public function setOCSVersion($version) {
|
||||
public function setOCSVersion(int $version) {
|
||||
$this->ocsVersion = $version;
|
||||
}
|
||||
|
||||
@@ -87,7 +89,7 @@ abstract class OCSController extends ApiController {
|
||||
* @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 @@ abstract class OCSController extends ApiController {
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -295,7 +295,7 @@ interface IAppConfig {
|
||||
* @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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -14,10 +14,9 @@ namespace OCP;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,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;
|
||||
|
||||
@@ -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 @@ interface GroupInterface {
|
||||
*
|
||||
* 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 @@ interface GroupInterface {
|
||||
* 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 @@ interface GroupInterface {
|
||||
* @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 @@ interface GroupInterface {
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -53,14 +53,14 @@ namespace OCP {
|
||||
* ]
|
||||
* @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',
|
||||
@@ -78,7 +78,7 @@ namespace OCP {
|
||||
* @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,
|
||||
|
||||
@@ -495,7 +495,7 @@ interface IAppConfig {
|
||||
* @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
|
||||
@@ -506,13 +506,5 @@ interface IAppConfig {
|
||||
* @since 12.0.0
|
||||
* @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()}
|
||||
*/
|
||||
public function getFilteredValues($app);
|
||||
|
||||
/**
|
||||
* Returns the installed version of all apps
|
||||
*
|
||||
* @return array<string, string>
|
||||
* @since 32.0.0
|
||||
*/
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array;
|
||||
public function getFilteredValues(string $app);
|
||||
}
|
||||
|
||||
@@ -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 @@ interface ICache {
|
||||
* @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 @@ interface ICache {
|
||||
* @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 @@ interface ICache {
|
||||
* @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 @@ interface ICache {
|
||||
* @return bool
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public function clear($prefix = '');
|
||||
public function clear(string $prefix = '');
|
||||
|
||||
/**
|
||||
* Check if the cache implementation is available
|
||||
|
||||
Reference in New Issue
Block a user