Skip to content

Commit 6892500

Browse files
authored
Merge pull request #48046 from nextcloud/refactor/self-class-reference
refactor: Replace __CLASS__ with ::class references
2 parents 6e983ce + 1ee833e commit 6892500

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

apps/user_ldap/lib/LoginListener.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function handle(Event $event): void {
4242

4343
public function onPostLogin(IUser $user): void {
4444
$this->logger->info(
45-
__CLASS__ . ' - {user} postLogin',
45+
self::class . ' - {user} postLogin',
4646
[
4747
'app' => 'user_ldap',
4848
'user' => $user->getUID(),
@@ -67,7 +67,7 @@ private function updateGroups(IUser $userObject): void {
6767
$groupObject = $this->groupManager->get($groupId);
6868
if ($groupObject === null) {
6969
$this->logger->error(
70-
__CLASS__ . ' - group {group} could not be found (user {user})',
70+
self::class . ' - group {group} could not be found (user {user})',
7171
[
7272
'app' => 'user_ldap',
7373
'user' => $userId,
@@ -81,7 +81,7 @@ private function updateGroups(IUser $userObject): void {
8181
} catch (Exception $e) {
8282
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
8383
$this->logger->error(
84-
__CLASS__ . ' - group {group} membership failed to be added (user {user})',
84+
self::class . ' - group {group} membership failed to be added (user {user})',
8585
[
8686
'app' => 'user_ldap',
8787
'user' => $userId,
@@ -96,7 +96,7 @@ private function updateGroups(IUser $userObject): void {
9696
$this->groupBackend->addRelationshipToCaches($userId, null, $groupId);
9797
$this->dispatcher->dispatchTyped(new UserAddedEvent($groupObject, $userObject));
9898
$this->logger->info(
99-
__CLASS__ . ' - {user} added to {group}',
99+
self::class . ' - {user} added to {group}',
100100
[
101101
'app' => 'user_ldap',
102102
'user' => $userId,
@@ -110,7 +110,7 @@ private function updateGroups(IUser $userObject): void {
110110
} catch (Exception $e) {
111111
if ($e->getReason() !== Exception::REASON_DATABASE_OBJECT_NOT_FOUND) {
112112
$this->logger->error(
113-
__CLASS__ . ' - group {group} membership failed to be removed (user {user})',
113+
self::class . ' - group {group} membership failed to be removed (user {user})',
114114
[
115115
'app' => 'user_ldap',
116116
'user' => $userId,
@@ -125,7 +125,7 @@ private function updateGroups(IUser $userObject): void {
125125
$groupObject = $this->groupManager->get($groupId);
126126
if ($groupObject === null) {
127127
$this->logger->error(
128-
__CLASS__ . ' - group {group} could not be found (user {user})',
128+
self::class . ' - group {group} could not be found (user {user})',
129129
[
130130
'app' => 'user_ldap',
131131
'user' => $userId,

apps/user_ldap/lib/Service/UpdateGroupsService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function handleKnownGroups(array $groups): void {
9090
if ($e->getReason() !== Exception::REASON_DATABASE_OBJECT_NOT_FOUND) {
9191
/* If reason is not found something else removed the membership, that’s fine */
9292
$this->logger->error(
93-
__CLASS__ . ' - group {group} membership failed to be removed (user {user})',
93+
self::class . ' - group {group} membership failed to be removed (user {user})',
9494
[
9595
'app' => 'user_ldap',
9696
'user' => $removedUser,
@@ -121,7 +121,7 @@ public function handleKnownGroups(array $groups): void {
121121
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
122122
/* If reason is unique constraint something else added the membership, that’s fine */
123123
$this->logger->error(
124-
__CLASS__ . ' - group {group} membership failed to be added (user {user})',
124+
self::class . ' - group {group} membership failed to be added (user {user})',
125125
[
126126
'app' => 'user_ldap',
127127
'user' => $addedUser,
@@ -167,7 +167,7 @@ public function handleCreatedGroups(array $createdGroups): void {
167167
} catch (Exception $e) {
168168
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
169169
$this->logger->error(
170-
__CLASS__ . ' - group {group} membership failed to be added (user {user})',
170+
self::class . ' - group {group} membership failed to be added (user {user})',
171171
[
172172
'app' => 'user_ldap',
173173
'user' => $user,

lib/private/Security/Bruteforce/Backend/MemoryCacheBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(
1919
ICacheFactory $cacheFactory,
2020
private ITimeFactory $timeFactory,
2121
) {
22-
$this->cache = $cacheFactory->createDistributed(__CLASS__);
22+
$this->cache = $cacheFactory->createDistributed(self::class);
2323
}
2424

2525
private function hash(

lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727
ICacheFactory $cacheFactory,
2828
private ITimeFactory $timeFactory,
2929
) {
30-
$this->cache = $cacheFactory->createDistributed(__CLASS__);
30+
$this->cache = $cacheFactory->createDistributed(self::class);
3131
}
3232

3333
private function hash(

lib/public/Files/LockNotAcquiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ public function __construct($path, $lockType, $code = 0, ?\Exception $previous =
3535
* @since 7.0.0
3636
*/
3737
public function __toString(): string {
38-
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
38+
return self::class . ": [{$this->code}]: {$this->message}\n";
3939
}
4040
}

lib/public/HintException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct($message, $hint = '', $code = 0, ?\Exception $previo
4343
* @return string
4444
*/
4545
public function __toString(): string {
46-
return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
46+
return self::class . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
4747
}
4848

4949
/**

tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testReadAnnotation() {
7272
public function testGetAnnotationParameterSingle() {
7373
$reader = new ControllerMethodReflector();
7474
$reader->reflect(
75-
__CLASS__,
75+
self::class,
7676
__FUNCTION__
7777
);
7878

@@ -85,7 +85,7 @@ public function testGetAnnotationParameterSingle() {
8585
public function testGetAnnotationParameterMultiple() {
8686
$reader = new ControllerMethodReflector();
8787
$reader->reflect(
88-
__CLASS__,
88+
self::class,
8989
__FUNCTION__
9090
);
9191

0 commit comments

Comments
 (0)