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 | |
parent | 1d8b90b8d3c8a85104d223b7f1d5693280370774 (diff) |
Use ::class statement instead of string
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
53 files changed, 270 insertions, 184 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', [ diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php index a7ef9024326..82a137e58e1 100644 --- a/core/Command/App/CheckCode.php +++ b/core/Command/App/CheckCode.php @@ -38,6 +38,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use OC\App\CodeChecker\StrongComparisonCheck; +use OC\App\CodeChecker\DeprecationCheck; +use OC\App\CodeChecker\PrivateCheck; class CheckCode extends Command implements CompletionAwareInterface { @@ -45,9 +48,9 @@ class CheckCode extends Command implements CompletionAwareInterface { private $infoParser; protected $checkers = [ - 'private' => '\OC\App\CodeChecker\PrivateCheck', - 'deprecation' => '\OC\App\CodeChecker\DeprecationCheck', - 'strong-comparison' => '\OC\App\CodeChecker\StrongComparisonCheck', + 'private' => PrivateCheck::class, + 'deprecation' => DeprecationCheck::class, + 'strong-comparison' => StrongComparisonCheck::class, ]; public function __construct(InfoParser $infoParser) { diff --git a/lib/base.php b/lib/base.php index fdebe283b9c..444c0df7e9e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -54,6 +54,12 @@ * */ +use OC\Settings\RemoveOrphaned; +use OCP\Share; +use OC\Encryption\HookManager; +use OC\Files\Filesystem; +use OC\Share20\Hooks; + require_once 'public/Constants.php'; /** @@ -836,7 +842,7 @@ class OC { $dispatcher->addListener(OCP\App\ManagerEvent::EVENT_APP_UPDATE, function($event) { /** @var \OCP\App\ManagerEvent $event */ $jobList = \OC::$server->getJobList(); - $job = 'OC\\Settings\\RemoveOrphaned'; + $job = RemoveOrphaned::class; if(!$jobList->has($job, null)) { $jobList->add($job); } @@ -851,10 +857,10 @@ class OC { private static function registerEncryptionHooks() { $enabled = self::$server->getEncryptionManager()->isEnabled(); if ($enabled) { - \OCP\Util::connectHook('OCP\Share', 'post_shared', 'OC\Encryption\HookManager', 'postShared'); - \OCP\Util::connectHook('OCP\Share', 'post_unshare', 'OC\Encryption\HookManager', 'postUnshared'); - \OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OC\Encryption\HookManager', 'postRename'); - \OCP\Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', 'OC\Encryption\HookManager', 'postRestore'); + \OCP\Util::connectHook(Share::class, 'post_shared', HookManager::class, 'postShared'); + \OCP\Util::connectHook(Share::class, 'post_unshare', HookManager::class, 'postUnshared'); + \OCP\Util::connectHook('OC_Filesystem', 'post_rename', HookManager::class, 'postRename'); + \OCP\Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', HookManager::class, 'postRestore'); } } @@ -868,8 +874,8 @@ class OC { */ public static function registerFilesystemHooks() { // Check for blacklisted files - OC_Hook::connect('OC_Filesystem', 'write', 'OC\Files\Filesystem', 'isBlacklisted'); - OC_Hook::connect('OC_Filesystem', 'rename', 'OC\Files\Filesystem', 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'write', Filesystem::class, 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'rename', Filesystem::class, 'isBlacklisted'); } /** @@ -877,9 +883,9 @@ class OC { */ public static function registerShareHooks() { if (\OC::$server->getSystemConfig()->getValue('installed')) { - OC_Hook::connect('OC_User', 'post_deleteUser', 'OC\Share20\Hooks', 'post_deleteUser'); - OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OC\Share20\Hooks', 'post_removeFromGroup'); - OC_Hook::connect('OC_User', 'post_deleteGroup', 'OC\Share20\Hooks', 'post_deleteGroup'); + OC_Hook::connect('OC_User', 'post_deleteUser', Hooks::class, 'post_deleteUser'); + OC_Hook::connect('OC_User', 'post_removeFromGroup', Hooks::class, 'post_removeFromGroup'); + OC_Hook::connect('OC_User', 'post_deleteGroup', Hooks::class, 'post_deleteGroup'); } } diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 8c79de7f9e1..524d378f940 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -31,6 +31,7 @@ use OCP\IDBConnection; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; +use OC\Settings\BackgroundJobs\VerifyUserData; /** * Class AccountManager @@ -167,7 +168,7 @@ class AccountManager { */ protected function checkEmailVerification($oldData, $newData, IUser $user) { if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) { - $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', + $this->jobList->add(VerifyUserData::class, [ 'verificationCode' => '', 'data' => $newData[self::PROPERTY_EMAIL]['value'], diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index 653000ab726..6e8c3736fdb 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -33,6 +33,8 @@ use OC\AppFramework\DependencyInjection\DIContainer; use OCP\AppFramework\Http; use OCP\AppFramework\QueryException; use OCP\AppFramework\Http\ICallbackResponse; +use OCP\AppFramework\Http\IOutput; +use OCP\IRequest; /** * Entry point for every request in your app. You can consider this as your @@ -81,9 +83,9 @@ class App { */ public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) { if (!is_null($urlParams)) { - $container['OCP\\IRequest']->setUrlParameters($urlParams); + $container[IRequest::class]->setUrlParameters($urlParams); } else if (isset($container['urlParams']) && !is_null($container['urlParams'])) { - $container['OCP\\IRequest']->setUrlParameters($container['urlParams']); + $container[IRequest::class]->setUrlParameters($container['urlParams']); } $appName = $container['AppName']; @@ -114,7 +116,7 @@ class App { $response ) = $dispatcher->dispatch($controller, $methodName); - $io = $container['OCP\\AppFramework\\Http\\IOutput']; + $io = $container[IOutput::class]; if(!is_null($httpHeaders)) { $io->setHeader($httpHeaders); diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index d9e82819d14..5fe925c2998 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -62,6 +62,8 @@ use OCP\IServerContainer; use OCP\IUserSession; use OCP\RichObjectStrings\IValidator; use OCP\Util; +use OCP\Encryption\IManager; +use OCA\WorkflowEngine\Manager; class DIContainer extends SimpleContainer implements IAppContainer { @@ -134,7 +136,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { $this->registerAlias('ServerContainer', IServerContainer::class); $this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) { - return $c->query('OCA\WorkflowEngine\Manager'); + return $c->query(Manager::class); }); $this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) { @@ -143,7 +145,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { // commonly used attributes $this->registerService('UserId', function ($c) { - return $c->query('OCP\\IUserSession')->getSession()->get('user_id'); + return $c->query(IUserSession::class)->getSession()->get('user_id'); }); $this->registerService('WebRoot', function ($c) { @@ -158,7 +160,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $c->getServer()->getThemingDefaults(); }); - $this->registerService('OCP\Encryption\IManager', function ($c) { + $this->registerService(IManager::class, function ($c) { return $this->getServer()->getEncryptionManager(); }); diff --git a/lib/private/Authentication/Token/DefaultTokenCleanupJob.php b/lib/private/Authentication/Token/DefaultTokenCleanupJob.php index 389a25a9bba..60bb0adbf7b 100644 --- a/lib/private/Authentication/Token/DefaultTokenCleanupJob.php +++ b/lib/private/Authentication/Token/DefaultTokenCleanupJob.php @@ -29,7 +29,7 @@ class DefaultTokenCleanupJob extends Job { protected function run($argument) { /* @var $provider IProvider */ - $provider = OC::$server->query('OC\Authentication\Token\IProvider'); + $provider = OC::$server->query(IProvider::class); $provider->invalidateOldTokens(); } diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 87244fcaa45..b3ee1ae6313 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -51,11 +51,11 @@ class CronBus extends AsyncBus { */ private function getJobClass($command) { if ($command instanceof \Closure) { - return 'OC\Command\ClosureJob'; + return ClosureJob::class; } else if (is_callable($command)) { - return 'OC\Command\CallableJob'; + return CallableJob::class; } else if ($command instanceof ICommand) { - return 'OC\Command\CommandJob'; + return CommandJob::class; } else { throw new \InvalidArgumentException('Invalid command'); } diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index fcb0117a0db..c841a36bb5a 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -46,26 +46,26 @@ class ConnectionFactory { */ protected $defaultConnectionParams = [ 'mysql' => [ - 'adapter' => '\OC\DB\AdapterMySQL', + 'adapter' => AdapterMySQL::class, 'charset' => 'UTF8', 'driver' => 'pdo_mysql', - 'wrapperClass' => 'OC\DB\Connection', + 'wrapperClass' => Connection::class, ], 'oci' => [ - 'adapter' => '\OC\DB\AdapterOCI8', + 'adapter' => AdapterOCI8::class, 'charset' => 'AL32UTF8', 'driver' => 'oci8', - 'wrapperClass' => 'OC\DB\OracleConnection', + 'wrapperClass' => OracleConnection::class, ], 'pgsql' => [ - 'adapter' => '\OC\DB\AdapterPgSql', + 'adapter' => AdapterPgSql::class, 'driver' => 'pdo_pgsql', - 'wrapperClass' => 'OC\DB\Connection', + 'wrapperClass' => Connection::class, ], 'sqlite3' => [ - 'adapter' => '\OC\DB\AdapterSqlite', + 'adapter' => AdapterSqlite::class, 'driver' => 'pdo_sqlite', - 'wrapperClass' => 'OC\DB\Connection', + 'wrapperClass' => Connection::class, ], ]; diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 22d82a36c4d..8f5f09319dd 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -110,7 +110,7 @@ class Scanner extends BasicEmitter implements IScanner { protected function getData($path) { $data = $this->storage->getMetaData($path); if (is_null($data)) { - \OCP\Util::writeLog('OC\Files\Cache\Scanner', "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG); + \OCP\Util::writeLog(Scanner::class, "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG); } return $data; } diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 05107652c91..05be5a5b286 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -157,7 +157,7 @@ class Encryption extends Wrapper { $unencryptedSize, $headerSize, $signed, - $wrapper = 'OC\Files\Stream\Encryption') { + $wrapper = Encryption::class) { $context = stream_context_create(array( 'ocencryption' => array( diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index 162e5759121..dd20e11fb63 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -38,6 +38,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorage; use OCP\Files\StorageNotAvailableException; use OCP\ILogger; +use OC\Files\Storage\FailedStorage; /** * Class Scanner @@ -146,7 +147,7 @@ class Scanner extends PublicEmitter { } // don't bother scanning failed storages (shortcut for same result) - if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) { + if ($storage->instanceOfStorage(FailedStorage::class)) { continue; } @@ -196,7 +197,7 @@ class Scanner extends PublicEmitter { } // don't bother scanning failed storages (shortcut for same result) - if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) { + if ($storage->instanceOfStorage(FailedStorage::class)) { continue; } diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index 1788cbfa6e1..d7c554374fd 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -49,6 +49,6 @@ class Rotate extends \OC\BackgroundJob\Job { $rotatedLogfile = $logfile.'.1'; rename($logfile, $rotatedLogfile); $msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"'; - \OCP\Util::writeLog('OC\Log\Rotate', $msg, \OCP\Util::WARN); + \OCP\Util::writeLog(Rotate::class, $msg, \OCP\Util::WARN); } } diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index b79f17ba8ea..cb2cd8aabe2 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -37,7 +37,7 @@ use OCP\ILogger; use OCP\IMemcache; class Factory implements ICacheFactory { - const NULL_CACHE = '\\OC\\Memcache\\NullCache'; + const NULL_CACHE = NullCache::class; /** * @var string $globalPrefix diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index f9c96aa6e7a..979208d0aed 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -306,20 +306,20 @@ class PreviewManager implements IPreview { } $imageProviders = [ - 'OC\Preview\PNG', - 'OC\Preview\JPEG', - 'OC\Preview\GIF', - 'OC\Preview\BMP', - 'OC\Preview\XBitmap' + Preview\PNG::class, + Preview\JPEG::class, + Preview\GIF::class, + Preview\BMP::class, + Preview\XBitmap::class ]; $this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([ - 'OC\Preview\MarkDown', - 'OC\Preview\MP3', - 'OC\Preview\TXT', + Preview\MarkDown::class, + Preview\MP3::class, + Preview\TXT::class, ], $imageProviders)); - if (in_array('OC\Preview\Image', $this->defaultProviders)) { + if (in_array(Preview\Image::class, $this->defaultProviders)) { $this->defaultProviders = array_merge($this->defaultProviders, $imageProviders); } $this->defaultProviders = array_unique($this->defaultProviders); @@ -349,27 +349,27 @@ class PreviewManager implements IPreview { } $this->registeredCoreProviders = true; - $this->registerCoreProvider('OC\Preview\TXT', '/text\/plain/'); - $this->registerCoreProvider('OC\Preview\MarkDown', '/text\/(x-)?markdown/'); - $this->registerCoreProvider('OC\Preview\PNG', '/image\/png/'); - $this->registerCoreProvider('OC\Preview\JPEG', '/image\/jpeg/'); - $this->registerCoreProvider('OC\Preview\GIF', '/image\/gif/'); - $this->registerCoreProvider('OC\Preview\BMP', '/image\/bmp/'); - $this->registerCoreProvider('OC\Preview\XBitmap', '/image\/x-xbitmap/'); - $this->registerCoreProvider('OC\Preview\MP3', '/audio\/mpeg/'); + $this->registerCoreProvider(Preview\TXT::class, '/text\/plain/'); + $this->registerCoreProvider(Preview\MarkDown::class, '/text\/(x-)?markdown/'); + $this->registerCoreProvider(Preview\PNG::class, '/image\/png/'); + $this->registerCoreProvider(Preview\JPEG::class, '/image\/jpeg/'); + $this->registerCoreProvider(Preview\GIF::class, '/image\/gif/'); + $this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/'); + $this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/'); + $this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/'); // SVG, Office and Bitmap require imagick if (extension_loaded('imagick')) { $checkImagick = new \Imagick(); $imagickProviders = [ - 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => '\OC\Preview\SVG'], - 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => '\OC\Preview\TIFF'], - 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => '\OC\Preview\PDF'], - 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => '\OC\Preview\Illustrator'], - 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => '\OC\Preview\Photoshop'], - 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => '\OC\Preview\Postscript'], - 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => '\OC\Preview\Font'], + 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => Preview\SVG::class], + 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => Preview\TIFF::class], + 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => Preview\PDF::class], + 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => Preview\Illustrator::class], + 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => Preview\Photoshop::class], + 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class], + 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class], ]; foreach ($imagickProviders as $queryFormat => $provider) { @@ -398,18 +398,18 @@ class PreviewManager implements IPreview { } if ($officeFound) { - $this->registerCoreProvider('\OC\Preview\MSOfficeDoc', '/application\/msword/'); - $this->registerCoreProvider('\OC\Preview\MSOffice2003', '/application\/vnd.ms-.*/'); - $this->registerCoreProvider('\OC\Preview\MSOffice2007', '/application\/vnd.openxmlformats-officedocument.*/'); - $this->registerCoreProvider('\OC\Preview\OpenDocument', '/application\/vnd.oasis.opendocument.*/'); - $this->registerCoreProvider('\OC\Preview\StarOffice', '/application\/vnd.sun.xml.*/'); + $this->registerCoreProvider(Preview\MSOfficeDoc::class, '/application\/msword/'); + $this->registerCoreProvider(Preview\MSOffice2003::class, '/application\/vnd.ms-.*/'); + $this->registerCoreProvider(Preview\MSOffice2007::class, '/application\/vnd.openxmlformats-officedocument.*/'); + $this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/'); + $this->registerCoreProvider(Preview\StarOffice::class, '/application\/vnd.sun.xml.*/'); } } } } // Video requires avconv or ffmpeg - if (in_array('OC\Preview\Movie', $this->getEnabledDefaultProvider())) { + if (in_array(Preview\Movie::class, $this->getEnabledDefaultProvider())) { $avconvBinary = \OC_Helper::findBinaryPath('avconv'); $ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg'); @@ -418,7 +418,7 @@ class PreviewManager implements IPreview { \OC\Preview\Movie::$avconvBinary = $avconvBinary; \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary; - $this->registerCoreProvider('\OC\Preview\Movie', '/video\/.*/'); + $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/'); } } } diff --git a/lib/private/Server.php b/lib/private/Server.php index 1f572280c7c..8799223345e 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -57,11 +57,13 @@ use OC\AppFramework\Http\Request; use OC\AppFramework\Utility\SimpleContainer; use OC\AppFramework\Utility\TimeFactory; use OC\Authentication\LoginCredentials\Store; +use OC\Authentication\Token\IProvider; use OC\Collaboration\Collaborators\GroupPlugin; use OC\Collaboration\Collaborators\MailPlugin; use OC\Collaboration\Collaborators\RemotePlugin; use OC\Collaboration\Collaborators\UserPlugin; use OC\Command\CronBus; +use OC\Comments\ManagerFactory as CommentsManagerFactory; use OC\Contacts\ContactsMenu\ActionFactory; use OC\Contacts\ContactsMenu\ContactsStore; use OC\Diagnostics\EventLogger; @@ -106,7 +108,9 @@ use OC\Security\CredentialsManager; use OC\Security\SecureRandom; use OC\Security\TrustedDomainHelper; use OC\Session\CryptoWrapper; +use OC\Share20\ProviderFactory; use OC\Share20\ShareHelper; +use OC\SystemTag\ManagerFactory as SystemTagManagerFactory; use OC\Tagging\TagMapper; use OC\Template\SCSSCacher; use OCA\Theming\ThemingDefaults; @@ -132,7 +136,6 @@ use OCP\Remote\Api\IApiFactory; use OCP\Remote\IInstanceFactory; use OCP\RichObjectStrings\IValidator; use OCP\Security\IContentSecurityPolicyManager; -use OCP\Share; use OCP\Share\IShareHelper; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -242,7 +245,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('SystemTagManagerFactory', function (Server $c) { $config = $c->getConfig(); - $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); + $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); return new $factoryClass($this); }); $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { @@ -317,7 +320,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(Store::class, function (Server $c) { $session = $c->getSession(); if (\OC::$server->getSystemConfig()->getValue('installed', false)) { - $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); + $tokenProvider = $c->query(IProvider::class); } else { $tokenProvider = null; } @@ -325,19 +328,19 @@ class Server extends ServerContainer implements IServerContainer { return new Store($session, $logger, $tokenProvider); }); $this->registerAlias(IStore::class, Store::class); - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { + $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) { $dbConnection = $c->getDatabaseConnection(); return new Authentication\Token\DefaultTokenMapper($dbConnection); }); - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { - $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); + $this->registerService(Authentication\Token\DefaultTokenProvider::class, function (Server $c) { + $mapper = $c->query(Authentication\Token\DefaultTokenMapper::class); $crypto = $c->getCrypto(); $config = $c->getConfig(); $logger = $c->getLogger(); $timeFactory = new TimeFactory(); return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory); }); - $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); + $this->registerAlias(IProvider::class, Authentication\Token\DefaultTokenProvider::class); $this->registerService(\OCP\IUserSession::class, function (Server $c) { $manager = $c->getUserManager(); @@ -346,7 +349,7 @@ class Server extends ServerContainer implements IServerContainer { // Token providers might require a working database. This code // might however be called when ownCloud is not yet setup. if (\OC::$server->getSystemConfig()->getValue('installed', false)) { - $defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider'); + $defaultTokenProvider = $c->query(IProvider::class); } else { $defaultTokenProvider = null; } @@ -417,7 +420,7 @@ class Server extends ServerContainer implements IServerContainer { $c->getConfig(), $c->getActivityManager(), $c->getLogger(), - $c->query(\OC\Authentication\Token\IProvider::class), + $c->query(IProvider::class), $c->query(ITimeFactory::class), $c->query(EventDispatcherInterface::class) ); @@ -480,9 +483,9 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(Factory::class, function (Server $c) { $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), - '\\OC\\Memcache\\ArrayCache', - '\\OC\\Memcache\\ArrayCache', - '\\OC\\Memcache\\ArrayCache' + ArrayCache::class, + ArrayCache::class, + ArrayCache::class ); $config = $c->getConfig(); $request = $c->getRequest(); @@ -903,7 +906,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { $config = $c->getConfig(); - $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); + $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); /** @var \OCP\Comments\ICommentsManagerFactory $factory */ $factory = new $factoryClass($this); $manager = $factory->getManager(); @@ -1020,7 +1023,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(\OCP\Share\IManager::class, function (Server $c) { $config = $c->getConfig(); - $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); + $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); /** @var \OCP\Share\IProviderFactory $factory */ $factory = new $factoryClass($this); diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 465446c52b7..9507eaf5c1f 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -849,11 +849,11 @@ class Share extends Constants { $hookParams['fileTarget'] = $item['file_target']; } - \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams); + \OC_Hook::emit(\OCP\Share::class, 'pre_unshare', $hookParams); $deletedShares = Helper::delete($item['id'], false, null, $newParent); $deletedShares[] = $hookParams; $hookParams['deletedShares'] = $deletedShares; - \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams); + \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { list(, $remote) = Helper::splitUserRemote($item['share_with']); self::sendRemoteUnshare($remote, $item['id'], $item['token']); @@ -1549,7 +1549,7 @@ class Share extends Constants { $preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget; $preHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith; - \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData); + \OC_Hook::emit(\OCP\Share::class, 'pre_shared', $preHookData); if ($run === false) { throw new \Exception($error); @@ -1663,7 +1663,7 @@ class Share extends Constants { $postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget; $postHookData['fileTarget'] = $isGroupShare ? $groupFileTarget : $fileTarget; - \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData); + \OC_Hook::emit(\OCP\Share::class, 'post_shared', $postHookData); return $id ? $id : false; @@ -2037,7 +2037,7 @@ class Share extends Constants { $status = json_decode($result['result'], true); if ($result['success'] && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200)) { - \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $remote]); + \OC_Hook::emit(\OCP\Share::class, 'federated_share_added', ['server' => $remote]); return true; } diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 77db4c5d0e0..c3a4e9d999d 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -27,6 +27,7 @@ use OCP\Files\File; use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\Share; class LegacyHooks { /** @var EventDispatcher */ @@ -55,7 +56,7 @@ class LegacyHooks { $share = $e->getSubject(); $formatted = $this->formatHookParams($share); - \OC_Hook::emit('OCP\Share', 'pre_unshare', $formatted); + \OC_Hook::emit(Share::class, 'pre_unshare', $formatted); } /** @@ -76,7 +77,7 @@ class LegacyHooks { $formatted['deletedShares'] = $formattedDeletedShares; - \OC_Hook::emit('OCP\Share', 'post_unshare', $formatted); + \OC_Hook::emit(Share::class, 'post_unshare', $formatted); } /** @@ -90,7 +91,7 @@ class LegacyHooks { $formatted['itemTarget'] = $formatted['fileTarget']; $formatted['unsharedItems'] = [$formatted]; - \OC_Hook::emit('OCP\Share', 'post_unshareFromSelf', $formatted); + \OC_Hook::emit(Share::class, 'post_unshareFromSelf', $formatted); } private function formatHookParams(IShare $share) { @@ -138,7 +139,7 @@ class LegacyHooks { 'run' => &$run, 'error' => &$error, ]; - \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData); + \OC_Hook::emit(Share::class, 'pre_shared', $preHookData); if ($run === false) { $e->setArgument('error', $error); @@ -167,7 +168,7 @@ class LegacyHooks { 'fileTarget' => $share->getTarget(), ]; - \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData); + \OC_Hook::emit(Share::class, 'post_shared', $postHookData); } } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 48c70606835..0ae96f29ded 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -64,6 +64,7 @@ use OCP\Share\IProviderFactory; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; use OCP\Share\IShareProvider; +use OCP\Share; /** * This class is the communication hub for all sharing related operations. @@ -838,7 +839,7 @@ class Manager implements IManager { } if ($expirationDateUpdated === true) { - \OC_Hook::emit('OCP\Share', 'post_set_expiration_date', [ + \OC_Hook::emit(Share::class, 'post_set_expiration_date', [ 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder', 'itemSource' => $share->getNode()->getId(), 'date' => $share->getExpirationDate(), @@ -847,7 +848,7 @@ class Manager implements IManager { } if ($share->getPassword() !== $originalShare->getPassword()) { - \OC_Hook::emit('OCP\Share', 'post_update_password', [ + \OC_Hook::emit(Share::class, 'post_update_password', [ 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder', 'itemSource' => $share->getNode()->getId(), 'uidOwner' => $share->getSharedBy(), @@ -862,7 +863,7 @@ class Manager implements IManager { } else { $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); } - \OC_Hook::emit('OCP\Share', 'post_update_permissions', array( + \OC_Hook::emit(Share::class, 'post_update_permissions', array( 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder', 'itemSource' => $share->getNode()->getId(), 'shareType' => $share->getShareType(), diff --git a/lib/private/Tagging/TagMapper.php b/lib/private/Tagging/TagMapper.php index d52a3f3eb83..e5ca41f69e3 100644 --- a/lib/private/Tagging/TagMapper.php +++ b/lib/private/Tagging/TagMapper.php @@ -39,7 +39,7 @@ class TagMapper extends Mapper { * @param IDBConnection $db Instance of the Db abstraction layer. */ public function __construct(IDBConnection $db) { - parent::__construct($db, 'vcategory', 'OC\Tagging\Tag'); + parent::__construct($db, 'vcategory', Tag::class); } /** diff --git a/lib/public/ITags.php b/lib/public/ITags.php index ef9b3e8796e..fce47bb5bc7 100644 --- a/lib/public/ITags.php +++ b/lib/public/ITags.php @@ -33,8 +33,10 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; +use OC\Tags; + // FIXME: Where should I put this? Or should it be implemented as a Listener? -\OC_Hook::connect('OC_User', 'post_deleteUser', 'OC\Tags', 'post_deleteUser'); +\OC_Hook::connect('OC_User', 'post_deleteUser', Tags::class, 'post_deleteUser'); /** * Class for easily tagging objects by their id diff --git a/settings/BackgroundJobs/VerifyUserData.php b/settings/BackgroundJobs/VerifyUserData.php index 8dc89830167..128a79a6683 100644 --- a/settings/BackgroundJobs/VerifyUserData.php +++ b/settings/BackgroundJobs/VerifyUserData.php @@ -253,7 +253,7 @@ class VerifyUserData extends Job { * @param array $argument */ protected function reAddJob(IJobList $jobList, array $argument) { - $jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', + $jobList->add(VerifyUserData::class, [ 'verificationCode' => $argument['verificationCode'], 'data' => $argument['data'], diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 7b18eda6833..f92f073e879 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -64,6 +64,7 @@ use OCP\IAvatarManager; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; use OCP\Util; +use OC\Settings\BackgroundJobs\VerifyUserData; /** * @package OC\Settings\Controller @@ -688,7 +689,7 @@ class UsersController extends Controller { if ($onlyVerificationCode === false) { $this->accountManager->updateUser($user, $accountData); - $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', + $this->jobList->add(VerifyUserData::class, [ 'verificationCode' => $code, 'data' => $data, |