Skip to content

Commit

Permalink
ENH Use class name instead of self
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 14, 2024
1 parent 6dc6d14 commit 7552424
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/FormFields/SessionManagerField.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function setTitleLinkHref(string $titleLinkHref)

public function Field($properties = array())
{
return $this->renderWith(self::class);
return $this->renderWith(SessionManagerField::class);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/GarbageCollectionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function requireDefaultJob(): void

private function queueNextJob(): void
{
$timestamp = time() + self::config()->get('seconds_between_jobs');
$timestamp = time() + static::config()->get('seconds_between_jobs');
QueuedJobService::singleton()->queueJob(
Injector::inst()->create(self::class),
Injector::inst()->create(GarbageCollectionJob::class),
DBDatetime::create()->setValue($timestamp)->Rfc2822()
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/LoginSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function getFriendlyUserAgent(): string
* @param HTTPRequest|null $request
* @return LoginSession|null
*/
public static function getCurrentLoginSession(?HTTPRequest $request = null): ?self
public static function getCurrentLoginSession(?HTTPRequest $request = null): ?LoginSession
{
// Fall back to retrieving request from current Controller if available
if ($request === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Services/GarbageCollectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function collect(): void

private function batchRemoveAll($datalist)
{
$limit = self::config()->get('batch_remove_limit');
$limit = static::config()->get('batch_remove_limit');
$limitedList = $datalist->limit($limit);
DB::get_conn()->transactionStart();
foreach ($limitedList as $record) {
Expand Down
16 changes: 8 additions & 8 deletions tests/php/Extensions/ForcePermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ class ForcePermission extends DataExtension implements TestOnly

public static function forceCanView($val)
{
self::$canView = $val;
ForcePermission::$canView = $val;
}

public static function forceCanDelete($val)
{
self::$canDelete = $val;
ForcePermission::$canDelete = $val;
}

public static function reset()
{
self::$canView = null;
self::$canDelete = null;
ForcePermission::$canView = null;
ForcePermission::$canDelete = null;
}

public function canView($member)
{
if (self::$canView !== null) {
return self::$canView;
if (ForcePermission::$canView !== null) {
return ForcePermission::$canView;
}
}

public function canDelete($member)
{
if (self::$canDelete !== null) {
return self::$canDelete;
if (ForcePermission::$canDelete !== null) {
return ForcePermission::$canDelete;
}
}
}

0 comments on commit 7552424

Please sign in to comment.