summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-09 08:42:03 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-03-09 08:42:03 +0100
commit129a608ebe80c04a09cc8ad90741ffe46d1e4b9f (patch)
tree1adf3ce83db618ff0639212ffa3283bb0a790097
parenta20e9d7891a1ba0e16ddc373cdb4e9c89e8afd25 (diff)
downloadnextcloud-server-129a608ebe80c04a09cc8ad90741ffe46d1e4b9f.tar.gz
nextcloud-server-129a608ebe80c04a09cc8ad90741ffe46d1e4b9f.zip
OCP\AppFramework\App strict
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--lib/private/AppFramework/App.php7
-rw-r--r--lib/public/AppFramework/App.php16
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index 6e8c3736fdb..25708245e26 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -55,7 +56,7 @@ class App {
* the transformed app id, defaults to OCA\
* @return string the starting namespace for the app
*/
- public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
+ public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string {
// Hit the cache!
if (isset(self::$nameSpaceCache[$appId])) {
return $topNamespace . self::$nameSpaceCache[$appId];
@@ -81,7 +82,7 @@ class App {
* @param DIContainer $container an instance of a pimple container.
* @param array $urlParams list of URL parameters (optional)
*/
- public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
+ public static function main(string $controllerName, string $methodName, DIContainer $container, array $urlParams = null) {
if (!is_null($urlParams)) {
$container[IRequest::class]->setUrlParameters($urlParams);
} else if (isset($container['urlParams']) && !is_null($container['urlParams'])) {
@@ -171,7 +172,7 @@ class App {
* @param array $urlParams an array with variables extracted from the routes
* @param DIContainer $container an instance of a pimple container.
*/
- public static function part($controllerName, $methodName, array $urlParams,
+ public static function part(string $controllerName, string $methodName, array $urlParams,
DIContainer $container){
$container['urlParams'] = $urlParams;
diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php
index d5a9075fa3e..b6ed2da5076 100644
--- a/lib/public/AppFramework/App.php
+++ b/lib/public/AppFramework/App.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -33,6 +34,7 @@
namespace OCP\AppFramework;
use OC\AppFramework\Routing\RouteConfig;
+use OCP\Route\IRouter;
/**
@@ -45,6 +47,8 @@ use OC\AppFramework\Routing\RouteConfig;
*/
class App {
+ /** @var IAppContainer */
+ private $container;
/**
* Turns an app id into a namespace by convetion. The id is split at the
@@ -56,7 +60,7 @@ class App {
* @return string the starting namespace for the app
* @since 8.0.0
*/
- public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
+ public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string {
return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace);
}
@@ -65,17 +69,15 @@ class App {
* @param array $urlParams an array with variables extracted from the routes
* @since 6.0.0
*/
- public function __construct($appName, $urlParams = array()) {
+ public function __construct(string $appName, array $urlParams = []) {
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
}
- private $container;
-
/**
* @return IAppContainer
* @since 6.0.0
*/
- public function getContainer() {
+ public function getContainer(): IAppContainer {
return $this->container;
}
@@ -98,7 +100,7 @@ class App {
* @since 6.0.0
* @suppress PhanAccessMethodInternal
*/
- public function registerRoutes($router, $routes) {
+ public function registerRoutes(IRouter $router, array $routes) {
$routeConfig = new RouteConfig($this->container, $router, $routes);
$routeConfig->register();
}
@@ -134,7 +136,7 @@ class App {
* @param string $methodName the method that you want to call
* @since 6.0.0
*/
- public function dispatch($controllerName, $methodName) {
+ public function dispatch(string $controllerName, string $methodName) {
\OC\AppFramework\App::main($controllerName, $methodName, $this->container);
}
}