Skip to content

Commit

Permalink
refactor: Replace __CLASS__ with ::class references
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Sep 15, 2024
1 parent 5a8d0a2 commit 1ee833e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions apps/user_ldap/lib/LoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(Event $event): void {

public function onPostLogin(IUser $user): void {
$this->logger->info(
__CLASS__ . ' - {user} postLogin',
self::class . ' - {user} postLogin',
[
'app' => 'user_ldap',
'user' => $user->getUID(),
Expand All @@ -67,7 +67,7 @@ private function updateGroups(IUser $userObject): void {
$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,
Expand All @@ -81,7 +81,7 @@ private function updateGroups(IUser $userObject): void {
} 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,
Expand All @@ -96,7 +96,7 @@ private function updateGroups(IUser $userObject): void {
$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,
Expand All @@ -110,7 +110,7 @@ private function updateGroups(IUser $userObject): void {
} 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,
Expand All @@ -125,7 +125,7 @@ private function updateGroups(IUser $userObject): void {
$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,
Expand Down
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Service/UpdateGroupsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function handleKnownGroups(array $groups): void {
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,
Expand Down Expand Up @@ -121,7 +121,7 @@ public function handleKnownGroups(array $groups): void {
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,
Expand Down Expand Up @@ -167,7 +167,7 @@ public function handleCreatedGroups(array $createdGroups): void {
} 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
ICacheFactory $cacheFactory,
private ITimeFactory $timeFactory,
) {
$this->cache = $cacheFactory->createDistributed(__CLASS__);
$this->cache = $cacheFactory->createDistributed(self::class);
}

private function hash(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
ICacheFactory $cacheFactory,
private ITimeFactory $timeFactory,
) {
$this->cache = $cacheFactory->createDistributed(__CLASS__);
$this->cache = $cacheFactory->createDistributed(self::class);
}

private function hash(
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/LockNotAcquiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public function __construct($path, $lockType, $code = 0, ?\Exception $previous =
* @since 7.0.0
*/
public function __toString(): string {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
return self::class . ": [{$this->code}]: {$this->message}\n";
}
}
2 changes: 1 addition & 1 deletion lib/public/HintException.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct($message, $hint = '', $code = 0, ?\Exception $previo
* @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";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testReadAnnotation() {
public function testGetAnnotationParameterSingle() {
$reader = new ControllerMethodReflector();
$reader->reflect(
__CLASS__,
self::class,
__FUNCTION__
);

Expand All @@ -85,7 +85,7 @@ public function testGetAnnotationParameterSingle() {
public function testGetAnnotationParameterMultiple() {
$reader = new ControllerMethodReflector();
$reader->reflect(
__CLASS__,
self::class,
__FUNCTION__
);

Expand Down

0 comments on commit 1ee833e

Please sign in to comment.