diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-01-25 09:56:44 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-04-18 17:15:05 +0200 |
commit | 2c0cfd3772bd7fc9bcb90ec84b929133c3580a89 (patch) | |
tree | 8cec15155047fbb14cff539f72c6d22ab13273f6 /lib/public/AppFramework | |
parent | b6d9e1d1ccf7b154d39cf3b6720906ae8b1b96f5 (diff) | |
download | nextcloud-server-2c0cfd3772bd7fc9bcb90ec84b929133c3580a89.tar.gz nextcloud-server-2c0cfd3772bd7fc9bcb90ec84b929133c3580a89.zip |
feat(app-framework): Add native argument types for middleware
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/AppFramework')
-rw-r--r-- | lib/public/AppFramework/Middleware.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/public/AppFramework/Middleware.php b/lib/public/AppFramework/Middleware.php index 62b5e47c4cf..91d8b7617bb 100644 --- a/lib/public/AppFramework/Middleware.php +++ b/lib/public/AppFramework/Middleware.php @@ -25,6 +25,7 @@ */ namespace OCP\AppFramework; +use Exception; use OCP\AppFramework\Http\Response; /** @@ -45,7 +46,7 @@ abstract class Middleware { * @return void * @since 6.0.0 */ - public function beforeController($controller, $methodName) { + public function beforeController(Controller $controller, string $methodName) { } @@ -59,12 +60,12 @@ abstract class Middleware { * @param Controller $controller the controller that is being called * @param string $methodName the name of the method that will be called on * the controller - * @param \Exception $exception the thrown exception - * @throws \Exception the passed in exception if it can't handle it + * @param Exception $exception the thrown exception + * @throws Exception the passed in exception if it can't handle it * @return Response a Response object in case that the exception was handled * @since 6.0.0 */ - public function afterException($controller, $methodName, \Exception $exception) { + public function afterException(Controller $controller, string $methodName, Exception $exception) { throw $exception; } @@ -80,7 +81,7 @@ abstract class Middleware { * @return Response a Response object * @since 6.0.0 */ - public function afterController($controller, $methodName, Response $response) { + public function afterController(Controller $controller, string $methodName, Response $response) { return $response; } @@ -96,7 +97,7 @@ abstract class Middleware { * @return string the output that should be printed * @since 6.0.0 */ - public function beforeOutput($controller, $methodName, $output) { + public function beforeOutput(Controller $controller, string $methodName, string $output) { return $output; } } |