summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-08-01 17:32:03 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-08-01 17:32:03 +0200
commitf93a82b8b09109e391b0314f92d02d285c356ad6 (patch)
treec85246eadd2103200e26af6b208756dc87822e76 /lib
parent84c22fdeef6986f9038d8563937cc234751d5147 (diff)
downloadnextcloud-server-f93a82b8b09109e391b0314f92d02d285c356ad6.tar.gz
nextcloud-server-f93a82b8b09109e391b0314f92d02d285c356ad6.zip
Remove explicit type hints for Controller
This is public API and breaks the middlewares of existing apps. Since this also requires maintaining two different code paths for 12 and 13 I'm at the moment voting for reverting this change. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Middleware/OCSMiddleware.php6
-rw-r--r--lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php4
-rw-r--r--lib/private/AppFramework/Middleware/Security/CORSMiddleware.php6
-rw-r--r--lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php4
-rw-r--r--lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php6
-rw-r--r--lib/private/AppFramework/Middleware/SessionMiddleware.php4
-rw-r--r--lib/public/AppFramework/Middleware.php8
7 files changed, 19 insertions, 19 deletions
diff --git a/lib/private/AppFramework/Middleware/OCSMiddleware.php b/lib/private/AppFramework/Middleware/OCSMiddleware.php
index 50ee40b7b4a..46f2881b076 100644
--- a/lib/private/AppFramework/Middleware/OCSMiddleware.php
+++ b/lib/private/AppFramework/Middleware/OCSMiddleware.php
@@ -55,7 +55,7 @@ class OCSMiddleware extends Middleware {
* @param Controller $controller
* @param string $methodName
*/
- public function beforeController(Controller $controller, $methodName) {
+ public function beforeController($controller, $methodName) {
if ($controller instanceof OCSController) {
if (substr_compare($this->request->getScriptName(), '/ocs/v2.php', -strlen('/ocs/v2.php')) === 0) {
$this->ocsVersion = 2;
@@ -73,7 +73,7 @@ class OCSMiddleware extends Middleware {
* @throws \Exception
* @return BaseResponse
*/
- public function afterException(Controller $controller, $methodName, \Exception $exception) {
+ public function afterException($controller, $methodName, \Exception $exception) {
if ($controller instanceof OCSController && $exception instanceof OCSException) {
$code = $exception->getCode();
if ($code === 0) {
@@ -92,7 +92,7 @@ class OCSMiddleware extends Middleware {
* @param Response $response
* @return \OCP\AppFramework\Http\Response
*/
- public function afterController(Controller $controller, $methodName, Response $response) {
+ public function afterController($controller, $methodName, Response $response) {
/*
* If a different middleware has detected that a request unauthorized or forbidden
* we need to catch the response and convert it to a proper OCS response.
diff --git a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
index b7ec137062f..e349960115d 100644
--- a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php
@@ -59,7 +59,7 @@ class BruteForceMiddleware extends Middleware {
/**
* {@inheritDoc}
*/
- public function beforeController(Controller $controller, $methodName) {
+ public function beforeController($controller, $methodName) {
parent::beforeController($controller, $methodName);
if($this->reflector->hasAnnotation('BruteForceProtection')) {
@@ -71,7 +71,7 @@ class BruteForceMiddleware extends Middleware {
/**
* {@inheritDoc}
*/
- public function afterController(Controller $controller, $methodName, Response $response) {
+ public function afterController($controller, $methodName, Response $response) {
if($this->reflector->hasAnnotation('BruteForceProtection') && $response->isThrottled()) {
$action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action');
$ip = $this->request->getRemoteAddress();
diff --git a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php
index 77ad7430599..4b50b0d20b3 100644
--- a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php
@@ -80,7 +80,7 @@ class CORSMiddleware extends Middleware {
* @throws SecurityException
* @since 6.0.0
*/
- public function beforeController(Controller $controller, $methodName){
+ public function beforeController($controller, $methodName){
// ensure that @CORS annotated API routes are not used in conjunction
// with session authentication since this enables CSRF attack vectors
if ($this->reflector->hasAnnotation('CORS') &&
@@ -110,7 +110,7 @@ class CORSMiddleware extends Middleware {
* @return Response a Response object
* @throws SecurityException
*/
- public function afterController(Controller $controller, $methodName, Response $response){
+ public function afterController($controller, $methodName, Response $response){
// only react if its a CORS request and if the request sends origin and
if(isset($this->request->server['HTTP_ORIGIN']) &&
@@ -143,7 +143,7 @@ class CORSMiddleware extends Middleware {
* @throws \Exception the passed in exception if it can't handle it
* @return Response a Response object or null in case that the exception could not be handled
*/
- public function afterException(Controller $controller, $methodName, \Exception $exception){
+ public function afterException($controller, $methodName, \Exception $exception){
if($exception instanceof SecurityException){
$response = new JSONResponse(['message' => $exception->getMessage()]);
if($exception->getCode() !== 0) {
diff --git a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
index c73b31a6177..28ef8b43ffc 100644
--- a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
@@ -77,7 +77,7 @@ class RateLimitingMiddleware extends Middleware {
* {@inheritDoc}
* @throws RateLimitExceededException
*/
- public function beforeController(Controller $controller, $methodName) {
+ public function beforeController($controller, $methodName) {
parent::beforeController($controller, $methodName);
$anonLimit = $this->reflector->getAnnotationParameter('AnonRateThrottle', 'limit');
@@ -105,7 +105,7 @@ class RateLimitingMiddleware extends Middleware {
/**
* {@inheritDoc}
*/
- public function afterException(Controller $controller, $methodName, \Exception $exception) {
+ public function afterException($controller, $methodName, \Exception $exception) {
if($exception instanceof RateLimitExceededException) {
if (stripos($this->request->getHeader('Accept'),'html') === false) {
$response = new JSONResponse(
diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
index becbd7b9ca2..4e41c946432 100644
--- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
@@ -136,7 +136,7 @@ class SecurityMiddleware extends Middleware {
* @param string $methodName the name of the method
* @throws SecurityException when a security check fails
*/
- public function beforeController(Controller $controller, $methodName) {
+ public function beforeController($controller, $methodName) {
// this will set the current navigation entry of the app, use this only
// for normal HTML requests and not for AJAX requests
@@ -205,7 +205,7 @@ class SecurityMiddleware extends Middleware {
* @param Response $response
* @return Response
*/
- public function afterController(Controller $controller, $methodName, Response $response) {
+ public function afterController($controller, $methodName, Response $response) {
$policy = !is_null($response->getContentSecurityPolicy()) ? $response->getContentSecurityPolicy() : new ContentSecurityPolicy();
if (get_class($policy) === EmptyContentSecurityPolicy::class) {
@@ -234,7 +234,7 @@ class SecurityMiddleware extends Middleware {
* @throws \Exception the passed in exception if it can't handle it
* @return Response a Response object or null in case that the exception could not be handled
*/
- public function afterException(Controller $controller, $methodName, \Exception $exception) {
+ public function afterException($controller, $methodName, \Exception $exception) {
if($exception instanceof SecurityException) {
if($exception instanceof StrictCookieMissingException) {
return new RedirectResponse(\OC::$WEBROOT);
diff --git a/lib/private/AppFramework/Middleware/SessionMiddleware.php b/lib/private/AppFramework/Middleware/SessionMiddleware.php
index f2545653e8f..dd2029bf053 100644
--- a/lib/private/AppFramework/Middleware/SessionMiddleware.php
+++ b/lib/private/AppFramework/Middleware/SessionMiddleware.php
@@ -59,7 +59,7 @@ class SessionMiddleware extends Middleware {
* @param Controller $controller
* @param string $methodName
*/
- public function beforeController(Controller $controller, $methodName) {
+ public function beforeController($controller, $methodName) {
$useSession = $this->reflector->hasAnnotation('UseSession');
if (!$useSession) {
$this->session->close();
@@ -72,7 +72,7 @@ class SessionMiddleware extends Middleware {
* @param Response $response
* @return Response
*/
- public function afterController(Controller $controller, $methodName, Response $response){
+ public function afterController($controller, $methodName, Response $response){
$useSession = $this->reflector->hasAnnotation('UseSession');
if ($useSession) {
$this->session->close();
diff --git a/lib/public/AppFramework/Middleware.php b/lib/public/AppFramework/Middleware.php
index fbd75981b59..677e5c2e7ee 100644
--- a/lib/public/AppFramework/Middleware.php
+++ b/lib/public/AppFramework/Middleware.php
@@ -52,7 +52,7 @@ abstract class Middleware {
* the controller
* @since 6.0.0
*/
- public function beforeController(Controller $controller, $methodName){
+ public function beforeController($controller, $methodName){
}
@@ -72,7 +72,7 @@ abstract class Middleware {
* @return Response a Response object in case that the exception was handled
* @since 6.0.0
*/
- public function afterException(Controller $controller, $methodName, \Exception $exception){
+ public function afterException($controller, $methodName, \Exception $exception){
throw $exception;
}
@@ -88,7 +88,7 @@ abstract class Middleware {
* @return Response a Response object
* @since 6.0.0
*/
- public function afterController(Controller $controller, $methodName, Response $response){
+ public function afterController($controller, $methodName, Response $response){
return $response;
}
@@ -104,7 +104,7 @@ abstract class Middleware {
* @return string the output that should be printed
* @since 6.0.0
*/
- public function beforeOutput(Controller $controller, $methodName, $output){
+ public function beforeOutput($controller, $methodName, $output){
return $output;
}