diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-26 01:16:13 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-29 14:03:47 +0300 |
commit | eb51f06a3b9e42686f462b9f7a56411d3fe6cb27 (patch) | |
tree | 0d96c86c4489b4e3fe60bcceaeb6759d856a36e9 /apps | |
parent | 1d8b90b8d3c8a85104d223b7f1d5693280370774 (diff) |
Use ::class statement instead of string
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
31 files changed, 147 insertions, 84 deletions
diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 470352f895e..03423121eb4 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -48,6 +48,7 @@ use OCP\IPreview; use OCP\IUserSession; use OCP\Util; use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\Share; class Application extends App { @@ -107,12 +108,12 @@ class Application extends App { protected function sharingHooks(ILogger $logger) { $shareActions = new Sharing($logger); - Util::connectHook('OCP\Share', 'post_shared', $shareActions, 'shared'); - Util::connectHook('OCP\Share', 'post_unshare', $shareActions, 'unshare'); - Util::connectHook('OCP\Share', 'post_update_permissions', $shareActions, 'updatePermissions'); - Util::connectHook('OCP\Share', 'post_update_password', $shareActions, 'updatePassword'); - Util::connectHook('OCP\Share', 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); - Util::connectHook('OCP\Share', 'share_link_access', $shareActions, 'shareAccessed'); + Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared'); + Util::connectHook(Share::class, 'post_unshare', $shareActions, 'unshare'); + Util::connectHook(Share::class, 'post_update_permissions', $shareActions, 'updatePermissions'); + Util::connectHook(Share::class, 'post_update_password', $shareActions, 'updatePassword'); + Util::connectHook(Share::class, 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); + Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed'); } protected function authHooks(ILogger $logger) { diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index 37000aa2eb8..e984267ff37 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -23,6 +23,7 @@ */ namespace OCA\DAV\CalDAV\Search; +use OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport; use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use OCA\DAV\CalDAV\CalendarHome; @@ -78,7 +79,7 @@ class SearchPlugin extends ServerPlugin { $server->on('report', [$this, 'report']); $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport'; + CalendarSearchReport::class; } /** diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index e77edd48651..fe747ee723b 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -27,6 +27,7 @@ use Sabre\CalDAV\Principal\User; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\INode; use \Sabre\DAV\PropFind; +use OCA\DAV\CardDAV\AddressBook; /** * Class DavAclPlugin is a wrapper around \Sabre\DAVACL\Plugin that returns 404 @@ -49,7 +50,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { $node = $this->server->tree->getNodeForPath($uri); switch(get_class($node)) { - case 'OCA\DAV\CardDAV\AddressBook': + case AddressBook::class: $type = 'Addressbook'; break; default: diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index 811a1fbfcbe..825b9821a2a 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -102,7 +102,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin { */ public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespacesMap[self::NS_OWNCLOUD] = 'oc'; - $server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList'; + $server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = ShareTypeList::class; $server->protectedProperties[] = self::SHARETYPES_PROPERTYNAME; $this->server = $server; diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index 229826c0a7a..c9c9ec8661f 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -112,7 +112,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin public function initialize(\Sabre\DAV\Server $server) { $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; - $server->xml->elementMap[self::TAGS_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\TagList'; + $server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class; $this->server = $server; $this->server->on('propFind', array($this, 'handleGetProperties')); diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index 2ac65f94478..4d44c116427 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -25,6 +25,7 @@ namespace OCA\DAV\DAV\Sharing; use OCA\DAV\Connector\Sabre\Auth; use OCA\DAV\DAV\Sharing\Xml\Invite; +use OCA\DAV\DAV\Sharing\Xml\ShareRequest; use OCP\IRequest; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\INode; @@ -100,8 +101,8 @@ class Plugin extends ServerPlugin { */ function initialize(Server $server) { $this->server = $server; - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; + $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class; + $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class; $this->server->on('method:POST', [$this, 'httpPost']); $this->server->on('propFind', [$this, 'propFind']); diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index bd0990e37c2..de2edfe60f7 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -120,7 +120,7 @@ class RetryJob extends Job { * @param array $argument */ protected function reAddJob(IJobList $jobList, array $argument) { - $jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob', + $jobList->add(RetryJob::class, [ 'remote' => $argument['remote'], 'remoteId' => $argument['remoteId'], diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php index ea8116e4353..3798a03cb54 100644 --- a/apps/federation/lib/AppInfo/Application.php +++ b/apps/federation/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ use OCP\SabrePluginEvent; use OCP\Util; use Sabre\DAV\Auth\Plugin; use Sabre\DAV\Server; +use OCP\Share; class Application extends App { @@ -59,7 +60,7 @@ class Application extends App { $hooksManager = $container->query(Hooks::class); Util::connectHook( - 'OCP\Share', + Share::class, 'federated_share_added', $hooksManager, 'addServerHook' diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php index 2067533c3e7..eda77a79325 100644 --- a/apps/federation/lib/TrustedServers.php +++ b/apps/federation/lib/TrustedServers.php @@ -28,6 +28,7 @@ namespace OCA\Federation; use OC\HintException; +use OCA\Federation\BackgroundJob\RequestSharedSecret; use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; @@ -116,7 +117,7 @@ class TrustedServers { $token = $this->secureRandom->generate(16); $this->dbHandler->addToken($url, $token); $this->jobList->add( - 'OCA\Federation\BackgroundJob\RequestSharedSecret', + RequestSharedSecret::class, [ 'url' => $url, 'token' => $token, diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index d91db8744c4..617ad18ac14 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -23,6 +23,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + +use OCP\Files\StorageNotAvailableException; +use OCP\Files\StorageInvalidException; + OCP\JSON::checkLoggedIn(); \OC::$server->getSession()->close(); $l = \OC::$server->getL10N('files'); @@ -80,7 +84,7 @@ try { \OCP\Util::logException('files', $e); OCP\JSON::error([ 'data' => [ - 'exception' => '\OCP\Files\StorageNotAvailableException', + 'exception' => StorageNotAvailableException::class, 'message' => $l->t('Storage is temporarily not available') ] ]); @@ -88,7 +92,7 @@ try { \OCP\Util::logException('files', $e); OCP\JSON::error(array( 'data' => array( - 'exception' => '\OCP\Files\StorageInvalidException', + 'exception' => StorageInvalidException::class, 'message' => $l->t('Storage invalid') ) )); @@ -96,7 +100,7 @@ try { \OCP\Util::logException('files', $e); OCP\JSON::error(array( 'data' => array( - 'exception' => '\Exception', + 'exception' => \Exception::class, 'message' => $l->t('Unknown error') ) )); diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index b540c2e7682..fbe33fb54fe 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -24,11 +24,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + +use OC\Search\Provider\File; + // required for translation purpose // t('Files') $l = \OC::$server->getL10N('files'); -\OC::$server->getSearch()->registerProvider('OC\Search\Provider\File', array('apps' => array('files'))); +\OC::$server->getSearch()->registerProvider(File::class, array('apps' => array('files'))); $templateManager = \OC_Helper::getFileTemplateManager(); $templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html'); diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index e55d1c549a5..064f2baa987 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -31,6 +31,7 @@ use OCP\AppFramework\App; use \OCA\Files\Service\TagService; use \OCP\IContainer; use OCA\Files\Controller\ViewController; +use OCA\Files\Capabilities; class Application extends App { public function __construct(array $urlParams=array()) { @@ -95,6 +96,6 @@ class Application extends App { /* * Register capabilities */ - $container->registerCapability('OCA\Files\Capabilities'); + $container->registerCapability(Capabilities::class); } } diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index 9d9717c9401..3ea1504bc8a 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -261,7 +261,7 @@ class Helper { } else if ($sortAttribute === 'size') { $sortFunc = 'compareSize'; } - usort($files, array('\OCA\Files\Helper', $sortFunc)); + usort($files, array(Helper::class, $sortFunc)); if ($sortDescending) { $files = array_reverse($files); } diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php index 4a1b7c1b09c..3f7094f4dca 100644 --- a/apps/files_external/appinfo/app.php +++ b/apps/files_external/appinfo/app.php @@ -26,6 +26,8 @@ * */ +use OCA\Files_External\Config\ConfigAdapter; + OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php'; require_once __DIR__ . '/../3rdparty/autoload.php'; @@ -45,5 +47,5 @@ $appContainer = \OC_Mount_Config::$app->getContainer(); ]; }); -$mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter'); +$mountProvider = $appContainer->query(ConfigAdapter::class); \OC::$server->getMountProviderCollection()->registerProvider($mountProvider); diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index 266665a58aa..e32828fbf4e 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -35,6 +35,30 @@ use \OCP\IContainer; use \OCA\Files_External\Service\BackendService; use \OCA\Files_External\Lib\Config\IBackendProvider; use \OCA\Files_External\Lib\Config\IAuthMechanismProvider; +use OCA\Files_External\Lib\Auth\AmazonS3\AccessKey; +use OCA\Files_External\Lib\Auth\OpenStack\Rackspace; +use OCA\Files_External\Lib\Auth\OpenStack\OpenStack; +use OCA\Files_External\Lib\Auth\PublicKey\RSA; +use OCA\Files_External\Lib\Auth\OAuth2\OAuth2; +use OCA\Files_External\Lib\Auth\OAuth1\OAuth1; +use OCA\Files_External\Lib\Auth\Password\GlobalAuth; +use OCA\Files_External\Lib\Auth\Password\UserProvided; +use OCA\Files_External\Lib\Auth\Password\LoginCredentials; +use OCA\Files_External\Lib\Auth\Password\SessionCredentials; +use OCA\Files_External\Lib\Auth\Password\Password; +use OCA\Files_External\Lib\Auth\Builtin; +use OCA\Files_External\Lib\Auth\NullMechanism; +use OCA\Files_External\Lib\Backend\SMB_OC; +use OCA\Files_External\Lib\Backend\SMB; +use OCA\Files_External\Lib\Backend\SFTP_Key; +use OCA\Files_External\Lib\Backend\Swift; +use OCA\Files_External\Lib\Backend\AmazonS3; +use OCA\Files_External\Lib\Backend\SFTP; +use OCA\Files_External\Lib\Backend\OwnCloud; +use OCA\Files_External\Lib\Backend\DAV; +use OCA\Files_External\Lib\Backend\FTP; +use OCA\Files_External\Lib\Backend\Local; +use OCP\Files\Config\IUserMountCache; /** * @package OCA\Files_External\AppInfo @@ -46,11 +70,11 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide $container = $this->getContainer(); - $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { + $container->registerService(IUserMountCache::class, function (IAppContainer $c) { return $c->getServer()->query('UserMountCache'); }); - $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); + $backendService = $container->query(BackendService::class); $backendService->registerBackendProvider($this); $backendService->registerAuthMechanismProvider($this); @@ -71,16 +95,16 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide $container = $this->getContainer(); $backends = [ - $container->query('OCA\Files_External\Lib\Backend\Local'), - $container->query('OCA\Files_External\Lib\Backend\FTP'), - $container->query('OCA\Files_External\Lib\Backend\DAV'), - $container->query('OCA\Files_External\Lib\Backend\OwnCloud'), - $container->query('OCA\Files_External\Lib\Backend\SFTP'), - $container->query('OCA\Files_External\Lib\Backend\AmazonS3'), - $container->query('OCA\Files_External\Lib\Backend\Swift'), - $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), - $container->query('OCA\Files_External\Lib\Backend\SMB'), - $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), + $container->query(Local::class), + $container->query(FTP::class), + $container->query(DAV::class), + $container->query(OwnCloud::class), + $container->query(SFTP::class), + $container->query(AmazonS3::class), + $container->query(Swift::class), + $container->query(SFTP_Key::class), + $container->query(SMB::class), + $container->query(SMB_OC::class), ]; return $backends; @@ -94,33 +118,33 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide return [ // AuthMechanism::SCHEME_NULL mechanism - $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), + $container->query(NullMechanism::class), // AuthMechanism::SCHEME_BUILTIN mechanism - $container->query('OCA\Files_External\Lib\Auth\Builtin'), + $container->query(Builtin::class), // AuthMechanism::SCHEME_PASSWORD mechanisms - $container->query('OCA\Files_External\Lib\Auth\Password\Password'), - $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), - $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), - $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), - $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), + $container->query(Password::class), + $container->query(SessionCredentials::class), + $container->query(LoginCredentials::class), + $container->query(UserProvided::class), + $container->query(GlobalAuth::class), // AuthMechanism::SCHEME_OAUTH1 mechanisms - $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), + $container->query(OAuth1::class), // AuthMechanism::SCHEME_OAUTH2 mechanisms - $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), + $container->query(OAuth2::class), // AuthMechanism::SCHEME_PUBLICKEY mechanisms - $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), + $container->query(RSA::class), // AuthMechanism::SCHEME_OPENSTACK mechanisms - $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), - $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), + $container->query(OpenStack::class), + $container->query(Rackspace::class), // Specialized mechanisms - $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), + $container->query(AccessKey::class), ]; } diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index ae04daf4f31..5238eaa42b2 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -41,6 +41,12 @@ use \OCA\Files_External\Lib\Backend\LegacyBackend; use \OCA\Files_External\Lib\StorageConfig; use \OCA\Files_External\Lib\Backend\Backend; use \OCP\Files\StorageNotAvailableException; +use OCA\Files_External\Service\BackendService; +use OCA\Files_External\Lib\Auth\Builtin; +use OCA\Files_External\Service\UserGlobalStoragesService; +use OCP\IUserManager; +use OCA\Files_External\Service\GlobalStoragesService; +use OCA\Files_External\Service\UserStoragesService; /** * Class to configure mount.json globally and for users @@ -66,8 +72,8 @@ class OC_Mount_Config { * @deprecated 8.2.0 use \OCA\Files_External\Service\BackendService::registerBackend() */ public static function registerBackend($class, $definition) { - $backendService = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService'); - $auth = self::$app->getContainer()->query('OCA\Files_External\Lib\Auth\Builtin'); + $backendService = self::$app->getContainer()->query(BackendService::class); + $auth = self::$app->getContainer()->query(Builtin::class); $backendService->registerBackend(new LegacyBackend($class, $definition, $auth)); @@ -86,9 +92,9 @@ class OC_Mount_Config { public static function getAbsoluteMountPoints($uid) { $mountPoints = array(); - $userGlobalStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserGlobalStoragesService'); - $userStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); - $user = self::$app->getContainer()->query('OCP\IUserManager')->get($uid); + $userGlobalStoragesService = self::$app->getContainer()->query(UserGlobalStoragesService::class); + $userStoragesService = self::$app->getContainer()->query(UserStoragesService::class); + $user = self::$app->getContainer()->query(IUserManager::class)->get($uid); $userGlobalStoragesService->setUser($user); $userStoragesService->setUser($user); @@ -127,7 +133,7 @@ class OC_Mount_Config { */ public static function getSystemMountPoints() { $mountPoints = []; - $service = self::$app->getContainer()->query('OCA\Files_External\Service\GlobalStoragesService'); + $service = self::$app->getContainer()->query(GlobalStoragesService::class); foreach ($service->getStorages() as $storage) { $mountPoints[] = self::prepareMountPointEntry($storage, false); @@ -145,7 +151,7 @@ class OC_Mount_Config { */ public static function getPersonalMountPoints() { $mountPoints = []; - $service = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); + $service = self::$app->getContainer()->query(UserStoragesService::class); foreach ($service->getStorages() as $storage) { $mountPoints[] = self::prepareMountPointEntry($storage, true); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 4782ac1b94f..f5aa1fc09a1 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -27,10 +27,13 @@ * */ +use OCA\Files_Sharing\ShareBackend\File; +use OCA\Files_Sharing\ShareBackend\Folder; + \OCA\Files_Sharing\Helper::registerHooks(); -\OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); -\OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file'); +\OC\Share\Share::registerBackend('file', File::class); +\OC\Share\Share::registerBackend('folder', Folder::class, 'file'); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index fe2669640ca..e0c40730b31 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -41,6 +41,8 @@ use OCP\Defaults; use OCP\Federation\ICloudIdManager; use \OCP\IContainer; use OCP\IServerContainer; +use OCA\Files_Sharing\Capabilities; +use OCA\Files_Sharing\External\Manager; class Application extends App { public function __construct(array $urlParams = array()) { @@ -104,7 +106,7 @@ class Application extends App { $uid ); }); - $container->registerAlias('OCA\Files_Sharing\External\Manager', 'ExternalManager'); + $container->registerAlias(Manager::class, 'ExternalManager'); /** * Middleware @@ -163,7 +165,7 @@ class Application extends App { /* * Register capabilities */ - $container->registerCapability('OCA\Files_Sharing\Capabilities'); + $container->registerCapability(Capabilities::class); } public function registerMountProviders() { diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index fdd69987658..eff6cf65142 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -244,7 +244,7 @@ class ShareController extends Controller { $exception = $e; } } - \OC_Hook::emit('OCP\Share', 'share_link_access', [ + \OC_Hook::emit(Share::class, 'share_link_access', [ 'itemType' => $itemType, 'itemSource' => $itemSource, 'uidOwner' => $uidOwner, diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 6935685685c..c9303ac224c 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -39,6 +39,7 @@ use OCP\Http\Client\IClientService; use OCP\IDBConnection; use OCP\Notification\IManager; use OCP\OCS\IDiscoveryService; +use OCP\Share; class Manager { const STORAGE = '\OCA\Files_Sharing\External\Storage'; @@ -217,7 +218,7 @@ class Manager { $updated = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid)); if ($updated === true) { $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept'); - \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $share['remote']]); + \OC_Hook::emit(Share::class, 'federated_share_added', ['server' => $share['remote']]); $result = true; } } diff --git a/apps/files_sharing/lib/Hooks.php b/apps/files_sharing/lib/Hooks.php index 97b1079f1eb..51511ca6b64 100644 --- a/apps/files_sharing/lib/Hooks.php +++ b/apps/files_sharing/lib/Hooks.php @@ -53,7 +53,7 @@ class Hooks { $mountManager = \OC\Files\Filesystem::getMountManager(); $mountedShares = $mountManager->findIn($path); foreach ($mountedShares as $mount) { - if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { + if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) { $mountPoint = $mount->getMountPoint(); $view->unlink($mountPoint); } diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php index c96b559daf5..4b630d0a8da 100644 --- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php +++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php @@ -121,11 +121,11 @@ class SharingCheckMiddleware extends Middleware { * @throws \Exception */ public function afterException($controller, $methodName, \Exception $exception) { - if(is_a($exception, '\OCP\Files\NotFoundException')) { + if(is_a($exception, NotFoundException::class)) { return new NotFoundResponse(); } - if (is_a($exception, '\OCA\Files_Sharing\Exceptions\S2SException')) { + if (is_a($exception, S2SException::class)) { return new JSONResponse($exception->getMessage(), 405); } diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php index de45b45ab37..784fe8b72b1 100644 --- a/apps/files_sharing/lib/Updater.php +++ b/apps/files_sharing/lib/Updater.php @@ -96,7 +96,7 @@ class Updater { $mountManager = \OC\Files\Filesystem::getMountManager(); $mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath); foreach ($mountedShares as $mount) { - if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { + if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) { $mountPoint = $mount->getMountPoint(); $target = str_replace($absOldPath, $absNewPath, $mountPoint); $mount->moveMount($target); diff --git a/apps/files_trashbin/lib/AppInfo/Application.php b/apps/files_trashbin/lib/AppInfo/Application.php index ee1c9481286..e9d4e6ecc1d 100644 --- a/apps/files_trashbin/lib/AppInfo/Application.php +++ b/apps/files_trashbin/lib/AppInfo/Application.php @@ -25,6 +25,8 @@ namespace OCA\Files_Trashbin\AppInfo; use OCP\AppFramework\App; use OCA\Files_Trashbin\Expiration; +use OCP\AppFramework\Utility\ITimeFactory; +use OCA\Files_Trashbin\Capabilities; class Application extends App { public function __construct (array $urlParams = []) { @@ -34,7 +36,7 @@ class Application extends App { /* * Register capabilities */ - $container->registerCapability('OCA\Files_Trashbin\Capabilities'); + $container->registerCapability(Capabilities::class); /* * Register expiration @@ -42,7 +44,7 @@ class Application extends App { $container->registerService('Expiration', function($c) { return new Expiration( $c->query('ServerContainer')->getConfig(), - $c->query('OCP\AppFramework\Utility\ITimeFactory') + $c->query(ITimeFactory::class) ); }); } diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index f75fea1e117..e09299c8bc8 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -25,6 +25,8 @@ namespace OCA\Files_Versions\AppInfo; use OCP\AppFramework\App; use OCA\Files_Versions\Expiration; +use OCP\AppFramework\Utility\ITimeFactory; +use OCA\Files_Versions\Capabilities; class Application extends App { public function __construct(array $urlParams = array()) { @@ -35,7 +37,7 @@ class Application extends App { /* * Register capabilities */ - $container->registerCapability('OCA\Files_Versions\Capabilities'); + $container->registerCapability(Capabilities::class); /* * Register expiration @@ -43,7 +45,7 @@ class Application extends App { $container->registerService('Expiration', function($c) { return new Expiration( $c->query('ServerContainer')->getConfig(), - $c->query('OCP\AppFramework\Utility\ITimeFactory') + $c->query(ITimeFactory::class) ); }); } diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php index 52dbf54b485..3c4049e2139 100644 --- a/apps/files_versions/lib/Hooks.php +++ b/apps/files_versions/lib/Hooks.php @@ -39,17 +39,17 @@ class Hooks { public static function connectHooks() { // Listen to write signals - \OCP\Util::connectHook('OC_Filesystem', 'write', 'OCA\Files_Versions\Hooks', 'write_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook'); // Listen to delete and rename signals - \OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\Files_Versions\Hooks', 'remove_hook'); - \OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Files_Versions\Hooks', 'pre_remove_hook'); - \OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Files_Versions\Hooks', 'rename_hook'); - \OCP\Util::connectHook('OC_Filesystem', 'post_copy', 'OCA\Files_Versions\Hooks', 'copy_hook'); - \OCP\Util::connectHook('OC_Filesystem', 'rename', 'OCA\Files_Versions\Hooks', 'pre_renameOrCopy_hook'); - \OCP\Util::connectHook('OC_Filesystem', 'copy', 'OCA\Files_Versions\Hooks', 'pre_renameOrCopy_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook'); + \OCP\Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook'); $eventDispatcher = \OC::$server->getEventDispatcher(); - $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', ['OCA\Files_Versions\Hooks', 'onLoadFilesAppScripts']); + $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', [Hooks::class, 'onLoadFilesAppScripts']); } /** diff --git a/apps/sharebymail/lib/AppInfo/Application.php b/apps/sharebymail/lib/AppInfo/Application.php index 12419a8c3d9..3eabc9ec89f 100644 --- a/apps/sharebymail/lib/AppInfo/Application.php +++ b/apps/sharebymail/lib/AppInfo/Application.php @@ -26,6 +26,7 @@ namespace OCA\ShareByMail\AppInfo; use OCA\ShareByMail\Settings; use OCP\AppFramework\App; use OCP\Util; +use OCA\ShareByMail\Capabilities; class Application extends App { @@ -37,7 +38,7 @@ class Application extends App { /** register capabilities */ $container = $this->getContainer(); - $container->registerCapability('OCA\ShareByMail\Capabilities'); + $container->registerCapability(Capabilities::class); /** register hooks */ Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider'); diff --git a/apps/systemtags/appinfo/app.php b/apps/systemtags/appinfo/app.php index e1c86939458..58c291895e1 100644 --- a/apps/systemtags/appinfo/app.php +++ b/apps/systemtags/appinfo/app.php @@ -26,6 +26,7 @@ use OCP\SystemTag\ManagerEvent; use OCP\SystemTag\MapperEvent; +use OCA\SystemTags\Activity\Listener; $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( @@ -43,7 +44,7 @@ $eventDispatcher->addListener( $managerListener = function(ManagerEvent $event) { $application = new \OCP\AppFramework\App('systemtags'); /** @var \OCA\SystemTags\Activity\Listener $listener */ - $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); + $listener = $application->getContainer()->query(Listener::class); $listener->event($event); }; @@ -54,7 +55,7 @@ $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); $mapperListener = function(MapperEvent $event) { $application = new \OCP\AppFramework\App('systemtags'); /** @var \OCA\SystemTags\Activity\Listener $listener */ - $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); + $listener = $application->getContainer()->query(Listener::class); $listener->mapperEvent($event); }; diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 2188605b5e8..6d5c416f04f 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -26,6 +26,7 @@ namespace OCA\User_LDAP\AppInfo; use OCA\User_LDAP\Controller\RenewPasswordController; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; +use OCP\IL10N; class Application extends App { public function __construct () { @@ -44,7 +45,7 @@ class Application extends App { $server->getRequest(), $c->query('UserManager'), $server->getConfig(), - $c->query('OCP\IL10N'), + $c->query(IL10N::class), $c->query('Session'), $server->getURLGenerator() ); diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index f7794168760..74c7aa7a68f 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -221,7 +221,7 @@ class Helper { public function setLDAPProvider() { $current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null); if(is_null($current)) { - \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', '\\OCA\\User_LDAP\\LDAPProviderFactory'); + \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class); } } diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index 28e32092419..8032112e863 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -21,13 +21,17 @@ namespace OCA\WorkflowEngine\AppInfo; +use OCP\Template; +use OCA\WorkflowEngine\Controller\RequestTime; +use OCA\WorkflowEngine\Controller\FlowOperations; + class Application extends \OCP\AppFramework\App { public function __construct() { parent::__construct('workflowengine'); - $this->getContainer()->registerAlias('FlowOperationsController', 'OCA\WorkflowEngine\Controller\FlowOperations'); - $this->getContainer()->registerAlias('RequestTimeController', 'OCA\WorkflowEngine\Controller\RequestTime'); + $this->getContainer()->registerAlias('FlowOperationsController', FlowOperations::class); + $this->getContainer()->registerAlias('RequestTimeController', RequestTime::class); } /** @@ -40,7 +44,7 @@ class Application extends \OCP\AppFramework\App { function() { if (!function_exists('style')) { // This is hacky, but we need to load the template class - class_exists('OCP\Template', true); + class_exists(Template::class, true); } style('workflowengine', [ |