diff --git a/VERSION b/VERSION index a49f880..ccb1560 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2410.191450 +0.2410.191502 diff --git a/src/Cache/ArrayCache/ArrayCacheProvider.php b/src/Cache/ArrayCache/ArrayCacheProvider.php index de08f69..2e7f826 100644 --- a/src/Cache/ArrayCache/ArrayCacheProvider.php +++ b/src/Cache/ArrayCache/ArrayCacheProvider.php @@ -1,7 +1,7 @@ increment($key, $amount * -1); } - - public function close(): void {} } diff --git a/src/Cache/CacheProvider.php b/src/Cache/CacheProvider.php index d66ab64..5a4fd95 100644 --- a/src/Cache/CacheProvider.php +++ b/src/Cache/CacheProvider.php @@ -1,16 +1,14 @@ close(); - } } diff --git a/src/Cache/Memcached/MemcachedProviderLegacy.php b/src/Cache/Memcached/MemcachedProviderLegacy.php index 5ac9917..ac66dde 100644 --- a/src/Cache/Memcached/MemcachedProviderLegacy.php +++ b/src/Cache/Memcached/MemcachedProviderLegacy.php @@ -1,7 +1,7 @@ persistent) $this->memcache->close(); } diff --git a/src/Cache/Memcached/MemcachedProviderModern.php b/src/Cache/Memcached/MemcachedProviderModern.php index 91ae74d..080abb0 100644 --- a/src/Cache/Memcached/MemcachedProviderModern.php +++ b/src/Cache/Memcached/MemcachedProviderModern.php @@ -1,7 +1,7 @@ memcached->isPersistent()) $this->memcached->quit(); } diff --git a/src/Cache/Valkey/ValkeyProvider.php b/src/Cache/Valkey/ValkeyProvider.php index 670b21d..4bbfa02 100644 --- a/src/Cache/Valkey/ValkeyProvider.php +++ b/src/Cache/Valkey/ValkeyProvider.php @@ -1,7 +1,7 @@ persist) $this->redis->close(); } - - public function __destruct() { - $this->close(); - } } diff --git a/src/Closeable.php b/src/Closeable.php deleted file mode 100644 index 63b43ae..0000000 --- a/src/Closeable.php +++ /dev/null @@ -1,30 +0,0 @@ - - * public function close(): void { - * fclose($this->resource); - * } - * - * public function __destruct() { - * $this->close(); - * } - * - * - * However if close() is only implemented because a parent interface requires it, the __destruct() implementation may be omitted. - */ -interface Closeable { - /** - * Free, release or reset unmanaged resources. - */ - function close(): void; -} diff --git a/src/Db/DbConnection.php b/src/Db/DbConnection.php index 209de9b..1dbc52d 100644 --- a/src/Db/DbConnection.php +++ b/src/Db/DbConnection.php @@ -6,12 +6,11 @@ namespace Index\Db; use RuntimeException; -use Index\Closeable; /** * Represents a connection to a database service. */ -interface DbConnection extends Closeable { +interface DbConnection { /** * Returns the ID of the last inserted row. * diff --git a/src/Db/DbResult.php b/src/Db/DbResult.php index bc32807..c357c56 100644 --- a/src/Db/DbResult.php +++ b/src/Db/DbResult.php @@ -1,16 +1,14 @@ stmts as $stmt) - $stmt->close(); $this->stmts = []; } } diff --git a/src/Db/DbTransaction.php b/src/Db/DbTransaction.php index 17bc417..bc434d3 100644 --- a/src/Db/DbTransaction.php +++ b/src/Db/DbTransaction.php @@ -6,12 +6,11 @@ namespace Index\Db; use RuntimeException; -use Index\Closeable; /** * Represents a transaction to be performed on the database. */ -interface DbTransaction extends Closeable { +interface DbTransaction { /** * Commits the actions done during a transaction and ends the transaction. * A new transaction will be started if auto-commit is disabled. diff --git a/src/Db/MariaDb/MariaDbConnection.php b/src/Db/MariaDb/MariaDbConnection.php index 009e373..5c1e057 100644 --- a/src/Db/MariaDb/MariaDbConnection.php +++ b/src/Db/MariaDb/MariaDbConnection.php @@ -387,16 +387,9 @@ class MariaDbConnection implements DbConnection { /** * Closes the connection and associated resources. */ - public function close(): void { + public function __destruct() { try { $this->connection->close(); } catch(\Error $ex) {} } - - /** - * Closes the connection and associated resources. - */ - public function __destruct() { - $this->close(); - } } diff --git a/src/Db/MariaDb/MariaDbResult.php b/src/Db/MariaDb/MariaDbResult.php index 0fc8a96..75376d4 100644 --- a/src/Db/MariaDb/MariaDbResult.php +++ b/src/Db/MariaDb/MariaDbResult.php @@ -1,7 +1,7 @@ currentRow[$index] ?? null; } - - abstract function close(): void; - - public function __destruct() { - $this->close(); - } } diff --git a/src/Db/MariaDb/MariaDbResultLib.php b/src/Db/MariaDb/MariaDbResultLib.php index 3ac7669..d40d0b0 100644 --- a/src/Db/MariaDb/MariaDbResultLib.php +++ b/src/Db/MariaDb/MariaDbResultLib.php @@ -1,7 +1,7 @@ result->free_result(); } catch(\Error $ex) {} diff --git a/src/Db/MariaDb/MariaDbResultNative.php b/src/Db/MariaDb/MariaDbResultNative.php index 0e7242b..b6e4fd5 100644 --- a/src/Db/MariaDb/MariaDbResultNative.php +++ b/src/Db/MariaDb/MariaDbResultNative.php @@ -1,7 +1,7 @@ result->close(); } catch(\Error $ex) {} diff --git a/src/Db/MariaDb/MariaDbStatement.php b/src/Db/MariaDb/MariaDbStatement.php index c4eeea5..4b9d644 100644 --- a/src/Db/MariaDb/MariaDbStatement.php +++ b/src/Db/MariaDb/MariaDbStatement.php @@ -1,7 +1,7 @@ getLastErrorString(), $this->getLastErrorCode()); } - public function close(): void { - $this->statement->close(); - } - public function __destruct() { - $this->close(); + $this->statement->close(); } } diff --git a/src/Db/MariaDb/MariaDbTransaction.php b/src/Db/MariaDb/MariaDbTransaction.php index cb38708..bbc9fc8 100644 --- a/src/Db/MariaDb/MariaDbTransaction.php +++ b/src/Db/MariaDb/MariaDbTransaction.php @@ -40,6 +40,4 @@ class MariaDbTransaction implements DbTransaction { if(!$this->connRaw->rollback(0, $name)) $this->conn->throwLastError(); } - - public function close(): void {} } diff --git a/src/Db/NullDb/NullDbConnection.php b/src/Db/NullDb/NullDbConnection.php index 7cb87c7..b286ed1 100644 --- a/src/Db/NullDb/NullDbConnection.php +++ b/src/Db/NullDb/NullDbConnection.php @@ -34,6 +34,4 @@ class NullDbConnection implements DbConnection { public function beginTransaction(): DbTransaction { return new NullDbTransaction; } - - public function close(): void {} } diff --git a/src/Db/NullDb/NullDbResult.php b/src/Db/NullDb/NullDbResult.php index fd3dab2..94b1962 100644 --- a/src/Db/NullDb/NullDbResult.php +++ b/src/Db/NullDb/NullDbResult.php @@ -1,7 +1,7 @@ connection->close(); } - - /** - * Closes the connection and associated resources. - */ - public function __destruct() { - $this->close(); - } } diff --git a/src/Db/Sqlite/SqliteResult.php b/src/Db/Sqlite/SqliteResult.php index faa9ebd..bfacd3c 100644 --- a/src/Db/Sqlite/SqliteResult.php +++ b/src/Db/Sqlite/SqliteResult.php @@ -1,7 +1,7 @@ currentRow[$index] ?? null; } - - public function close(): void {} } diff --git a/src/Db/Sqlite/SqliteStatement.php b/src/Db/Sqlite/SqliteStatement.php index f69d4cf..594fb01 100644 --- a/src/Db/Sqlite/SqliteStatement.php +++ b/src/Db/Sqlite/SqliteStatement.php @@ -1,7 +1,7 @@ statement->reset()) throw new RuntimeException((string)$this->connection->getLastErrorString(), $this->connection->getLastErrorCode()); } - - public function close(): void {} } diff --git a/src/Db/Sqlite/SqliteTransaction.php b/src/Db/Sqlite/SqliteTransaction.php index c02208e..76eb5fe 100644 --- a/src/Db/Sqlite/SqliteTransaction.php +++ b/src/Db/Sqlite/SqliteTransaction.php @@ -38,6 +38,4 @@ class SqliteTransaction implements DbTransaction { : sprintf('ROLLBACK TO SAVEPOINT %s;', SQLite3::escapeString($name)) ); } - - public function close(): void {} }