chore: codeql and linter

This commit is contained in:
Christy Jacob committed 2024-12-20 19:41:20 +05:30
1 parent 82a0215eb9
commit d3119238ea
6 files changed
+29 -29

No files matched your search

+4 -4
View File
@@ -44,13 +44,13 @@ class Abuse
}
/**
* Delete all logs older than $datetime
* Delete all logs older than $timestamp
*
* @param string $datetime
* @param int $timestamp
* @return bool
*/
public function cleanup(string $datetime): bool
public function cleanup(int $timestamp): bool
{
return $this->adapter->cleanup($datetime);
return $this->adapter->cleanup($timestamp);
}
}
+3 -3
View File
@@ -90,14 +90,14 @@ class ReCaptcha extends Adapter
}
/**
* Delete logs older than $datetime
* Delete logs older than $timestamp
*
* @param string $datetime
* @param int $timestamp
* @return bool
*
* @throws Exception
*/
public function cleanup(string $datetime): bool
public function cleanup(int $timestamp): bool
{
throw new Exception('Method not supported');
}
@@ -23,10 +23,10 @@ class RedisCluster extends TimeLimit
}
/**
* Get count for a key at specific datetime
* Get count for a key at specific timestamp
*
* @param string $key
* @param string $datetime
* @param int $timestamp
* @return integer
*/
protected function count(string $key, int $timestamp): int
@@ -51,10 +51,10 @@ class RedisCluster extends TimeLimit
}
/**
* Record a hit for a key at specific datetime
* Record a hit for a key at specific timestamp
*
* @param string $key
* @param string $datetime
* @param int $timestamp
* @return void
*/
protected function hit(string $key, int $timestamp): void
+6 -5
View File
@@ -13,13 +13,15 @@ use Utopia\Database\Database;
class DatabaseTest extends Base
{
protected static ?Database $db = null;
protected static Database $db;
public static function setUpBeforeClass(): void
{
if (self::$db === null) {
self::$db = self::initialiseDatabase();
if (isset(self::$db)) {
return;
}
self::$db = self::initialiseDatabase();
}
private static function initialiseDatabase(): Database
@@ -50,9 +52,8 @@ class DatabaseTest extends Base
public static function tearDownAfterClass(): void
{
if (self::$db !== null) {
if (isset(self::$db)) {
self::$db->delete();
self::$db = null;
}
}
}
+6 -8
View File
@@ -8,10 +8,7 @@ use Utopia\Exception;
class RedisClusterTest extends Base
{
/**
* @var \RedisCluster|null
*/
protected static ?\RedisCluster $redis = null;
protected static \RedisCluster $redis;
/**
* @throws Exception
@@ -19,9 +16,11 @@ class RedisClusterTest extends Base
*/
public static function setUpBeforeClass(): void
{
if (self::$redis === null) {
self::$redis = self::initialiseRedis();
if (isset(self::$redis)) {
return;
}
self::$redis = self::initialiseRedis();
}
private static function initialiseRedis(): \RedisCluster
@@ -44,9 +43,8 @@ class RedisClusterTest extends Base
*/
public static function tearDownAfterClass(): void
{
if (self::$redis !== null) {
if (isset(self::$redis)) {
self::$redis->close();
self::$redis = null;
}
}
}
+6 -5
View File
@@ -9,7 +9,7 @@ use Utopia\Exception;
class RedisTest extends Base
{
protected static ?\Redis $redis = null;
protected static \Redis $redis;
/**
* @throws Exception
@@ -17,9 +17,11 @@ class RedisTest extends Base
*/
public static function setUpBeforeClass(): void
{
if (self::$redis === null) {
self::$redis = self::initialiseRedis();
if (isset(self::$redis)) {
return;
}
self::$redis = self::initialiseRedis();
}
private static function initialiseRedis(): \Redis
@@ -39,9 +41,8 @@ class RedisTest extends Base
*/
public static function tearDownAfterClass(): void
{
if (self::$redis !== null) {
if (isset(self::$redis)) {
self::$redis->close();
self::$redis = null;
}
}
}