1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 04:08:59 +01:00

Move legacy classes

This commit is contained in:
Daniil Gentili 2024-04-11 20:30:08 +02:00
parent 2d03f871ee
commit 0dce27db79
3 changed files with 93 additions and 75 deletions

48
src/Db/CachedArray.php Normal file
View File

@ -0,0 +1,48 @@
<?php declare(strict_types=1);
namespace danog\MadelineProto\Db;
use AssertionError;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Internal\Containers\CacheContainer;
/**
* @internal
* @deprecated Please use https://github.com/danog/AsyncOrm
*/
final class CachedArray extends DbArray
{
private readonly CacheContainer $cache;
public function unset(string|int $key): void
{
throw new AssertionError("Unreachable");
}
public function set(string|int $key, mixed $value): void
{
throw new AssertionError("Unreachable");
}
public function get(string|int $key): mixed
{
throw new AssertionError("Unreachable");
}
public function clear(): void
{
throw new AssertionError("Unreachable");
}
public function count(): int
{
throw new AssertionError("Unreachable");
}
public function getIterator(): \Traversable
{
throw new AssertionError("Unreachable");
}
public static function getInstance(DbArrayBuilder $config, DbArray|null $previous): DbArray
{
throw new AssertionError("Unreachable");
}
}

45
src/Db/MemoryArray.php Normal file
View File

@ -0,0 +1,45 @@
<?php declare(strict_types=1);
namespace danog\MadelineProto\Db;
use ArrayObject;
use AssertionError;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder;
/**
* @internal
* @deprecated Please use https://github.com/danog/AsyncOrm
*/
final class MemoryArray extends ArrayObject
{
public function unset(string|int $key): void
{
throw new AssertionError("Unreachable");
}
public function set(string|int $key, mixed $value): void
{
throw new AssertionError("Unreachable");
}
public function get(string|int $key): mixed
{
throw new AssertionError("Unreachable");
}
public function clear(): void
{
throw new AssertionError("Unreachable");
}
public function count(): int
{
throw new AssertionError("Unreachable");
}
public function getIterator(): \Iterator
{
throw new AssertionError("Unreachable");
}
public static function getInstance(DbArrayBuilder $config, DbArray|null $previous): DbArray
{
throw new AssertionError("Unreachable");
}
}

View File

@ -6,10 +6,6 @@ if (class_exists('\\danog\\MadelineProto\\Db\\NullCache\\MysqlArray')) {
return;
}
use ArrayObject;
use AssertionError;
use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\Internal\Containers\CacheContainer;
use danog\AsyncOrm\Internal\Driver\MysqlArray;
use danog\AsyncOrm\Internal\Driver\PostgresArray;
@ -25,77 +21,6 @@ class_alias(PostgresArray::class, '\\danog\\MadelineProto\\Db\\PostgresArrayByte
class_alias(RedisArray::class, '\\danog\\MadelineProto\\Db\\RedisArray');
class_alias(CacheContainer::class, '\\danog\\MadelineProto\\Db\\CacheContainer');
/** @deprecated */
final class MemoryArray extends ArrayObject
{
public function unset(string|int $key): void
{
throw new AssertionError("Unreachable");
}
public function set(string|int $key, mixed $value): void
{
throw new AssertionError("Unreachable");
}
public function get(string|int $key): mixed
{
throw new AssertionError("Unreachable");
}
public function clear(): void
{
throw new AssertionError("Unreachable");
}
public function count(): int
{
throw new AssertionError("Unreachable");
}
public function getIterator(): \Iterator
{
throw new AssertionError("Unreachable");
}
public static function getInstance(DbArrayBuilder $config, DbArray|null $previous): DbArray
{
throw new AssertionError("Unreachable");
}
}
/** @deprecated */
final class CachedArray extends DbArray
{
private readonly CacheContainer $cache;
public function unset(string|int $key): void
{
throw new AssertionError("Unreachable");
}
public function set(string|int $key, mixed $value): void
{
throw new AssertionError("Unreachable");
}
public function get(string|int $key): mixed
{
throw new AssertionError("Unreachable");
}
public function clear(): void
{
throw new AssertionError("Unreachable");
}
public function count(): int
{
throw new AssertionError("Unreachable");
}
public function getIterator(): \Traversable
{
throw new AssertionError("Unreachable");
}
public static function getInstance(DbArrayBuilder $config, DbArray|null $previous): DbArray
{
throw new AssertionError("Unreachable");
}
}
if ((PHP_MINOR_VERSION === 2 && PHP_VERSION_ID < 80204)
|| PHP_MAJOR_VERSION < 8
|| (PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 2)