From 174129af946b912f842cffc474b7ee5119f76247 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sun, 19 Jan 2020 16:29:55 +0100 Subject: [PATCH] add missing namespaces/fix wrong class-names --- doc/Addons.md | 2 ++ doc/autoloader.md | 6 +++++- mod/fsuggest.php | 1 + mod/wall_attach.php | 1 + src/App/Router.php | 1 + src/Core/Installer.php | 1 + src/Database/DBStructure.php | 1 + src/Model/Contact.php | 2 +- src/Module/Credits.php | 1 + src/Module/Debug/Babel.php | 1 + src/Module/Search/Acl.php | 1 + src/Module/Settings/UserExport.php | 2 +- tests/Util/DbaCacheMockTrait.php | 4 +++- 13 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/Addons.md b/doc/Addons.md index 9260ee013c..171f58ff4a 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -181,6 +181,8 @@ Put your tpl files in the *templates/* subfolder of your addon. In your code, like in the function addon_name_content(), load the template file and execute it passing needed values: ```php +use Friendica\Core\Renderer; + # load template file. first argument is the template name, # second is the addon path relative to friendica top folder $tpl = Renderer::getMarkupTemplate('mytemplate.tpl', __DIR__); diff --git a/doc/autoloader.md b/doc/autoloader.md index 29d3a005fd..e1588688f1 100644 --- a/doc/autoloader.md +++ b/doc/autoloader.md @@ -47,8 +47,10 @@ The code will be something like: // mod/network.php getAll(); // pass $items to template @@ -117,6 +119,8 @@ If your code is in same namespace as the class you need, you don't need to prepe namespace Friendica; +use Friendica\Protocol\DFRN; + // this is the same content of current include/delivery.php, // but has been declared to be in "Friendica" namespace diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 6d23c31158..73b0f09e87 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\ACL; use Friendica\Core\Worker; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; use Friendica\Worker\Delivery; diff --git a/mod/wall_attach.php b/mod/wall_attach.php index f04698c564..749d09dc06 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\Session; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Attach; use Friendica\Model\User; use Friendica\Util\Strings; diff --git a/src/App/Router.php b/src/App/Router.php index 27ea4ac605..6ae42bb141 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -8,6 +8,7 @@ use FastRoute\Dispatcher; use FastRoute\RouteCollector; use FastRoute\RouteParser\Std; use Friendica\Core\Hook; +use Friendica\DI; use Friendica\Network\HTTPException; /** diff --git a/src/Core/Installer.php b/src/Core/Installer.php index 3e790e2e3b..01ef1d8c92 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -9,6 +9,7 @@ use Exception; use Friendica\Core\Config\Cache\ConfigCache; use Friendica\Database\Database; use Friendica\Database\DBStructure; +use Friendica\DI; use Friendica\Util\Images; use Friendica\Util\Network; use Friendica\Util\Strings; diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index e2a45783ba..d70f7f4ec6 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -9,6 +9,7 @@ use Exception; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\Logger; +use Friendica\DI; use Friendica\Util\DateTimeFormat; require_once __DIR__ . '/../../include/dba.php'; diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 5d2c4aa197..9cbf591de0 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -342,7 +342,7 @@ class Contact * @param integer $uid User ID * * @return integer|boolean Public contact id for given user id - * @throws Exception + * @throws \Exception */ public static function getPublicIdByUserId($uid) { diff --git a/src/Module/Credits.php b/src/Module/Credits.php index 5f2156e649..bafe6311f3 100644 --- a/src/Module/Credits.php +++ b/src/Module/Credits.php @@ -4,6 +4,7 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\Renderer; +use Friendica\DI; /** * Show a credits page for all the developers who helped with the project diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index 03b27e9ab8..4b3b47f649 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -5,6 +5,7 @@ namespace Friendica\Module\Debug; use Friendica\BaseModule; use Friendica\Content\Text; use Friendica\Core\Renderer; +use Friendica\DI; use Friendica\Model\Item; use Friendica\Util\XML; diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php index 6f8a02cb5d..a5a73fb18d 100644 --- a/src/Module/Search/Acl.php +++ b/src/Module/Search/Acl.php @@ -9,6 +9,7 @@ use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Search; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Network\HTTPException; diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index 71a18f4eed..19b0312672 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -209,7 +209,7 @@ class UserExport extends BaseSettingsModule * echoes account data and items as separated json, one per line * * @param App $a - * @throws Exception + * @throws \Exception */ private static function exportAll(App $a) { diff --git a/tests/Util/DbaCacheMockTrait.php b/tests/Util/DbaCacheMockTrait.php index 95e7cbcb1d..9d59690c07 100644 --- a/tests/Util/DbaCacheMockTrait.php +++ b/tests/Util/DbaCacheMockTrait.php @@ -2,6 +2,8 @@ namespace Friendica\Test\Util; +use Friendica\Core\Cache\Duration; + trait DbaCacheMockTrait { /** @@ -30,7 +32,7 @@ trait DbaCacheMockTrait $this->mockIsResult(['v' => $value], isset($return), $times); } - protected function mockSet($key, $value, $ttl = Cache::FIVE_MINUTES, $time = null, $return = true, $times = null) + protected function mockSet($key, $value, $ttl = Duration::FIVE_MINUTES, $time = null, $return = true, $times = null) { if ($time === null) { $time = time();