Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Aug 14, 2023
1 parent 1b6d7e5 commit f4a268f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class API extends AbstractAPI
*
* @var string
*/
public const RELEASE = '8.0.0-beta130';
public const RELEASE = '8.0.0-beta131';
/**
* Secret chat was not found.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Driver/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function getConnection(DatabaseMysql $settings): array
$settings->getUsername(),
$settings->getPassword(),
);
} catch (PDOException $e) {
} catch (PDOException) {
$config = $config->withPassword(null);
$pdo = new PDO(
"mysql:host={$host};port={$port};charset=UTF8",
Expand Down
8 changes: 4 additions & 4 deletions src/Db/Driver/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ public static function getConnection(DatabasePostgres $settings): PostgresConnec
$lock = self::$mutex->acquire($dbKey);

try {
if (empty(static::$connections[$dbKey])) {
if (empty(self::$connections[$dbKey])) {
$config = PostgresConfig::fromString('host='.\str_replace('tcp://', '', $settings->getUri()))
->withUser($settings->getUsername())
->withPassword($settings->getPassword())
->withDatabase($settings->getDatabase());

static::createDb($config);
static::$connections[$dbKey] = new PostgresConnectionPool($config, $settings->getMaxConnections(), $settings->getIdleTimeout());
self::createDb($config);
self::$connections[$dbKey] = new PostgresConnectionPool($config, $settings->getMaxConnections(), $settings->getIdleTimeout());
}
} finally {
$lock->release();
}

return static::$connections[$dbKey];
return self::$connections[$dbKey];
}

private static function createDb(PostgresConfig $config): void
Expand Down
8 changes: 4 additions & 4 deletions src/Db/Driver/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ public static function getConnection(DatabaseRedis $settings): RedisRedis
$lock = self::$mutex->acquire($dbKey);

try {
if (empty(static::$connections[$dbKey])) {
if (empty(self::$connections[$dbKey])) {
$config = RedisConfig::fromUri($settings->getUri())
->withPassword($settings->getPassword())
->withDatabase($settings->getDatabase());

static::$connections[$dbKey] = new RedisRedis((new RemoteExecutorFactory($config))->createQueryExecutor());
static::$connections[$dbKey]->ping();
self::$connections[$dbKey] = new RedisRedis((new RemoteExecutorFactory($config))->createQueryExecutor());
self::$connections[$dbKey]->ping();
}
} finally {
$lock->release();
}

return static::$connections[$dbKey];
return self::$connections[$dbKey];
}
}
2 changes: 1 addition & 1 deletion src/Db/DriverArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static function getInstance(string $table, DbArray|null $previous, Databa
}
}

static::migrateDataToDb($instance, $previous);
self::migrateDataToDb($instance, $previous);
}

return $instance;
Expand Down
2 changes: 1 addition & 1 deletion src/PTSException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class PTSException extends Exception
use TL\PrettyException;
public function __toString(): string
{
return static::class.($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace:'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL;
return PTSException::class.($this->message !== '' ? ': ' : '').$this->message.PHP_EOL.'TL Trace:'.PHP_EOL.PHP_EOL.$this->getTLTrace().PHP_EOL;
}
public function __construct($message, $file = '')
{
Expand Down

0 comments on commit f4a268f

Please sign in to comment.