Skip to content

Commit

Permalink
Fix self:: calls
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf committed Jun 21, 2023
1 parent 4d27e0d commit 7ca3c8d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/private/Memcache/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public function set($key, $value, $ttl = 0) {
}

public function hasKey($key) {
return (bool)self::$cache->exists($this->getPrefix() . $key);
return (bool)$this->getCache()->exists($this->getPrefix() . $key);
}

public function remove($key) {
if (self::$cache->del($this->getPrefix() . $key)) {
if ($this->getCache()->unlink($this->getPrefix() . $key)) {
return true;
} else {
return false;
Expand All @@ -101,8 +101,8 @@ public function remove($key) {
public function clear($prefix = '') {
// TODO: this is slow and would fail with Redis cluster
$prefix = $this->getPrefix() . $prefix . '*';
$keys = self::$cache->keys($prefix);
$deleted = self::$cache->del($keys);
$keys = this->getCache()->keys($prefix);

Check failure on line 104 in lib/private/Memcache/Redis.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedConstant

lib/private/Memcache/Redis.php:104:11: UndefinedConstant: Const this is not defined (see https://psalm.dev/020)

Check failure

Code scanning / Psalm

UndefinedConstant Error

Const this is not defined
$deleted = $this->getCache()->del($keys);

return (is_array($keys) && (count($keys) === $deleted));
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public function add($key, $value, $ttl = 0) {
* @return int | bool
*/
public function inc($key, $step = 1) {
return self::$cache->incrBy($this->getPrefix() . $key, $step);
return $this->getCache()->incrBy($this->getPrefix() . $key, $step);
}

/**
Expand Down Expand Up @@ -178,7 +178,7 @@ public function cad($key, $old) {
}

public function setTTL($key, $ttl) {
self::$cache->expire($this->getPrefix() . $key, $ttl);
$this->getCache()->expire($this->getPrefix() . $key, $ttl);
}

public static function isAvailable(): bool {
Expand Down

0 comments on commit 7ca3c8d

Please sign in to comment.