diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 21:40:55 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 21:40:55 +0200 |
commit | 1ee833efab85f484469f15267c6b32bb0ce55d20 (patch) | |
tree | 6dd02223489d9653630256790afca166c59419f0 | |
parent | 5a8d0a2721141f0edccc04feb21f0d35ab40eca9 (diff) | |
download | nextcloud-server-1ee833efab85f484469f15267c6b32bb0ce55d20.tar.gz nextcloud-server-1ee833efab85f484469f15267c6b32bb0ce55d20.zip |
refactor: Replace __CLASS__ with ::class referencesrefactor/self-class-reference
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
7 files changed, 15 insertions, 15 deletions
diff --git a/apps/user_ldap/lib/LoginListener.php b/apps/user_ldap/lib/LoginListener.php index c417300b45e..f397f4694d2 100644 --- a/apps/user_ldap/lib/LoginListener.php +++ b/apps/user_ldap/lib/LoginListener.php @@ -42,7 +42,7 @@ class LoginListener implements IEventListener { public function onPostLogin(IUser $user): void { $this->logger->info( - __CLASS__ . ' - {user} postLogin', + self::class . ' - {user} postLogin', [ 'app' => 'user_ldap', 'user' => $user->getUID(), @@ -67,7 +67,7 @@ class LoginListener implements IEventListener { $groupObject = $this->groupManager->get($groupId); if ($groupObject === null) { $this->logger->error( - __CLASS__ . ' - group {group} could not be found (user {user})', + self::class . ' - group {group} could not be found (user {user})', [ 'app' => 'user_ldap', 'user' => $userId, @@ -81,7 +81,7 @@ class LoginListener implements IEventListener { } catch (Exception $e) { if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { $this->logger->error( - __CLASS__ . ' - group {group} membership failed to be added (user {user})', + self::class . ' - group {group} membership failed to be added (user {user})', [ 'app' => 'user_ldap', 'user' => $userId, @@ -96,7 +96,7 @@ class LoginListener implements IEventListener { $this->groupBackend->addRelationshipToCaches($userId, null, $groupId); $this->dispatcher->dispatchTyped(new UserAddedEvent($groupObject, $userObject)); $this->logger->info( - __CLASS__ . ' - {user} added to {group}', + self::class . ' - {user} added to {group}', [ 'app' => 'user_ldap', 'user' => $userId, @@ -110,7 +110,7 @@ class LoginListener implements IEventListener { } catch (Exception $e) { if ($e->getReason() !== Exception::REASON_DATABASE_OBJECT_NOT_FOUND) { $this->logger->error( - __CLASS__ . ' - group {group} membership failed to be removed (user {user})', + self::class . ' - group {group} membership failed to be removed (user {user})', [ 'app' => 'user_ldap', 'user' => $userId, @@ -125,7 +125,7 @@ class LoginListener implements IEventListener { $groupObject = $this->groupManager->get($groupId); if ($groupObject === null) { $this->logger->error( - __CLASS__ . ' - group {group} could not be found (user {user})', + self::class . ' - group {group} could not be found (user {user})', [ 'app' => 'user_ldap', 'user' => $userId, diff --git a/apps/user_ldap/lib/Service/UpdateGroupsService.php b/apps/user_ldap/lib/Service/UpdateGroupsService.php index 4c007f7201f..94f2a7fd4a1 100644 --- a/apps/user_ldap/lib/Service/UpdateGroupsService.php +++ b/apps/user_ldap/lib/Service/UpdateGroupsService.php @@ -90,7 +90,7 @@ class UpdateGroupsService { if ($e->getReason() !== Exception::REASON_DATABASE_OBJECT_NOT_FOUND) { /* If reason is not found something else removed the membership, that’s fine */ $this->logger->error( - __CLASS__ . ' - group {group} membership failed to be removed (user {user})', + self::class . ' - group {group} membership failed to be removed (user {user})', [ 'app' => 'user_ldap', 'user' => $removedUser, @@ -121,7 +121,7 @@ class UpdateGroupsService { if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { /* If reason is unique constraint something else added the membership, that’s fine */ $this->logger->error( - __CLASS__ . ' - group {group} membership failed to be added (user {user})', + self::class . ' - group {group} membership failed to be added (user {user})', [ 'app' => 'user_ldap', 'user' => $addedUser, @@ -167,7 +167,7 @@ class UpdateGroupsService { } catch (Exception $e) { if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { $this->logger->error( - __CLASS__ . ' - group {group} membership failed to be added (user {user})', + self::class . ' - group {group} membership failed to be added (user {user})', [ 'app' => 'user_ldap', 'user' => $user, diff --git a/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php b/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php index 32571c72fae..bf076240bf8 100644 --- a/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php +++ b/lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php @@ -19,7 +19,7 @@ class MemoryCacheBackend implements IBackend { ICacheFactory $cacheFactory, private ITimeFactory $timeFactory, ) { - $this->cache = $cacheFactory->createDistributed(__CLASS__); + $this->cache = $cacheFactory->createDistributed(self::class); } private function hash( diff --git a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php index 84eb9fbd084..4c33b49d05e 100644 --- a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php +++ b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php @@ -27,7 +27,7 @@ class MemoryCacheBackend implements IBackend { ICacheFactory $cacheFactory, private ITimeFactory $timeFactory, ) { - $this->cache = $cacheFactory->createDistributed(__CLASS__); + $this->cache = $cacheFactory->createDistributed(self::class); } private function hash( diff --git a/lib/public/Files/LockNotAcquiredException.php b/lib/public/Files/LockNotAcquiredException.php index 19e0bbc2543..93d861c248f 100644 --- a/lib/public/Files/LockNotAcquiredException.php +++ b/lib/public/Files/LockNotAcquiredException.php @@ -35,6 +35,6 @@ class LockNotAcquiredException extends \Exception { * @since 7.0.0 */ public function __toString(): string { - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + return self::class . ": [{$this->code}]: {$this->message}\n"; } } diff --git a/lib/public/HintException.php b/lib/public/HintException.php index 97abf777ab1..6d9684bddea 100644 --- a/lib/public/HintException.php +++ b/lib/public/HintException.php @@ -43,7 +43,7 @@ class HintException extends \Exception { * @return string */ public function __toString(): string { - return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n"; + return self::class . ": [{$this->code}]: {$this->message} ({$this->hint})\n"; } /** diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index b7d14cb6cba..e3a1f3a288e 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -72,7 +72,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testGetAnnotationParameterSingle() { $reader = new ControllerMethodReflector(); $reader->reflect( - __CLASS__, + self::class, __FUNCTION__ ); @@ -85,7 +85,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testGetAnnotationParameterMultiple() { $reader = new ControllerMethodReflector(); $reader->reflect( - __CLASS__, + self::class, __FUNCTION__ ); |