Merge pull request #48046 from nextcloud/refactor/self-class-reference

refactor: Replace __CLASS__ with ::class references
pull/48060/head
Anna 2024-09-15 23:01:22 +07:00 committed by GitHub
commit 6892500405
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 15 deletions

@ -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,

@ -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, thats 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, thats 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,

@ -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(

@ -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(

@ -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";
}
}

@ -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";
}
/**

@ -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__
);